Skip to content

Commit

Permalink
Merge pull request #1714 from marquiz/devel/api-document-fields
Browse files Browse the repository at this point in the history
api/nfd: document all undocumented fields in the types
  • Loading branch information
k8s-ci-robot committed May 24, 2024
2 parents f3051f2 + b3d6282 commit 80d74cd
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 7 deletions.
17 changes: 16 additions & 1 deletion api/nfd/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type NodeFeatureList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`

// List of NodeFeatures.
Items []NodeFeature `json:"items"`
}

Expand All @@ -40,6 +41,7 @@ type NodeFeature struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

// Specification of the NodeFeature, containing features discovered for a node.
Spec NodeFeatureSpec `json:"spec"`
}

Expand Down Expand Up @@ -72,27 +74,31 @@ type Features struct {
//
// +protobuf=true
type FlagFeatureSet struct {
// Individual features of the feature set.
Elements map[string]Nil `json:"elements" protobuf:"bytes,1,rep,name=elements"`
}

// AttributeFeatureSet is a set of features having string value.
//
// +protobuf=true
type AttributeFeatureSet struct {
// Individual features of the feature set.
Elements map[string]string `json:"elements" protobuf:"bytes,1,rep,name=elements"`
}

// InstanceFeatureSet is a set of features each of which is an instance having multiple attributes.
//
// +protobuf=true
type InstanceFeatureSet struct {
// Individual features of the feature set.
Elements []InstanceFeature `json:"elements" protobuf:"bytes,1,rep,name=elements"`
}

// InstanceFeature represents one instance of a complex features, e.g. a device.
//
// +protobuf=true
type InstanceFeature struct {
// Attributes of the instance feature.
Attributes map[string]string `json:"attributes" protobuf:"bytes,1,rep,name=attributes"`
}

Expand All @@ -108,6 +114,7 @@ type NodeFeatureRuleList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`

// List of NodeFeatureRules.
Items []NodeFeatureRule `json:"items"`
}

Expand All @@ -122,6 +129,7 @@ type NodeFeatureRule struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

// Spec defines the rules to be evaluated.
Spec NodeFeatureRuleSpec `json:"spec"`
}

Expand All @@ -141,12 +149,17 @@ type NodeFeatureGroup struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec NodeFeatureGroupSpec `json:"spec"`
// Spec defines the rules to be evaluated.
Spec NodeFeatureGroupSpec `json:"spec"`

// Status of the NodeFeatureGroup after the most recent evaluation of the
// specification.
Status NodeFeatureGroupStatus `json:"status,omitempty"`
}

// NodeFeatureGroupSpec describes a NodeFeatureGroup object.
type NodeFeatureGroupSpec struct {
// List of rules to evaluate to determine nodes that belong in this group.
Rules []GroupRule `json:"featureGroupRules"`
}

Expand All @@ -161,6 +174,7 @@ type NodeFeatureGroupStatus struct {
}

type FeatureGroupNode struct {
// Name of the node.
Name string `json:"name"`
}

Expand All @@ -171,6 +185,7 @@ type NodeFeatureGroupList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`

// List of NodeFeatureGroups.
Items []NodeFeatureGroup `json:"items"`
}

Expand Down
17 changes: 14 additions & 3 deletions deployment/base/nfd-crds/nfd-api-crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ spec:
metadata:
type: object
spec:
description: NodeFeatureSpec describes a NodeFeature object.
description: Specification of the NodeFeature, containing features discovered
for a node.
properties:
features:
description: Features is the full "raw" features data that has been
Expand All @@ -53,6 +54,7 @@ spec:
elements:
additionalProperties:
type: string
description: Individual features of the feature set.
type: object
required:
- elements
Expand All @@ -70,6 +72,7 @@ spec:
description: Nil is a dummy empty struct for protobuf
compatibility
type: object
description: Individual features of the feature set.
type: object
required:
- elements
Expand All @@ -83,13 +86,15 @@ spec:
which is an instance having multiple attributes.
properties:
elements:
description: Individual features of the feature set.
items:
description: InstanceFeature represents one instance of
a complex features, e.g. a device.
properties:
attributes:
additionalProperties:
type: string
description: Attributes of the instance feature.
type: object
required:
- attributes
Expand Down Expand Up @@ -155,9 +160,11 @@ spec:
metadata:
type: object
spec:
description: NodeFeatureGroupSpec describes a NodeFeatureGroup object.
description: Spec defines the rules to be evaluated.
properties:
featureGroupRules:
description: List of rules to evaluate to determine nodes that belong
in this group.
items:
description: GroupRule defines a rule for nodegroup filtering.
properties:
Expand Down Expand Up @@ -356,13 +363,17 @@ spec:
- featureGroupRules
type: object
status:
description: |-
Status of the NodeFeatureGroup after the most recent evaluation of the
specification.
properties:
nodes:
description: Nodes is a list of FeatureGroupNode in the cluster that
match the featureGroupRules
items:
properties:
name:
description: Name of the node.
type: string
required:
- name
Expand Down Expand Up @@ -422,7 +433,7 @@ spec:
metadata:
type: object
spec:
description: NodeFeatureRuleSpec describes a NodeFeatureRule.
description: Spec defines the rules to be evaluated.
properties:
rules:
description: Rules is a list of node customization rules.
Expand Down
17 changes: 14 additions & 3 deletions deployment/helm/node-feature-discovery/crds/nfd-api-crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ spec:
metadata:
type: object
spec:
description: NodeFeatureSpec describes a NodeFeature object.
description: Specification of the NodeFeature, containing features discovered
for a node.
properties:
features:
description: Features is the full "raw" features data that has been
Expand All @@ -53,6 +54,7 @@ spec:
elements:
additionalProperties:
type: string
description: Individual features of the feature set.
type: object
required:
- elements
Expand All @@ -70,6 +72,7 @@ spec:
description: Nil is a dummy empty struct for protobuf
compatibility
type: object
description: Individual features of the feature set.
type: object
required:
- elements
Expand All @@ -83,13 +86,15 @@ spec:
which is an instance having multiple attributes.
properties:
elements:
description: Individual features of the feature set.
items:
description: InstanceFeature represents one instance of
a complex features, e.g. a device.
properties:
attributes:
additionalProperties:
type: string
description: Attributes of the instance feature.
type: object
required:
- attributes
Expand Down Expand Up @@ -155,9 +160,11 @@ spec:
metadata:
type: object
spec:
description: NodeFeatureGroupSpec describes a NodeFeatureGroup object.
description: Spec defines the rules to be evaluated.
properties:
featureGroupRules:
description: List of rules to evaluate to determine nodes that belong
in this group.
items:
description: GroupRule defines a rule for nodegroup filtering.
properties:
Expand Down Expand Up @@ -356,13 +363,17 @@ spec:
- featureGroupRules
type: object
status:
description: |-
Status of the NodeFeatureGroup after the most recent evaluation of the
specification.
properties:
nodes:
description: Nodes is a list of FeatureGroupNode in the cluster that
match the featureGroupRules
items:
properties:
name:
description: Name of the node.
type: string
required:
- name
Expand Down Expand Up @@ -422,7 +433,7 @@ spec:
metadata:
type: object
spec:
description: NodeFeatureRuleSpec describes a NodeFeatureRule.
description: Spec defines the rules to be evaluated.
properties:
rules:
description: Rules is a list of node customization rules.
Expand Down

0 comments on commit 80d74cd

Please sign in to comment.