diff --git a/deploy/crds/sriovnetwork_v1_sriovnetwork_crd.yaml b/deploy/crds/sriovnetwork_v1_sriovnetwork_crd.yaml index 6a195e960..c0edacb47 100644 --- a/deploy/crds/sriovnetwork_v1_sriovnetwork_crd.yaml +++ b/deploy/crds/sriovnetwork_v1_sriovnetwork_crd.yaml @@ -26,22 +26,30 @@ spec: metadata: type: object spec: + description: Specification describing how a NetworkAttachmentDefinition + custom resource shall be defined for SR-IOV CNI plugin. properties: ipam: + description: IPAM configuration to be used for this network. type: string networkNamespace: + description: Namespace of the NetworkAttachmentDefinition custom resource type: string resourceName: + description: SRIOV Network device plugin endpoint resource name type: string spoofChk: + description: VF spoof check type: boolean trust: + description: VF trust mode type: boolean vlan: + description: VLAN ID to assign for the VF. Defaults to 0. format: int64 - type: integer - minimum: 0 maximum: 4096 + minimum: 0 + type: integer required: - resourceName type: object diff --git a/deploy/crds/sriovnetwork_v1_sriovnetworknodepolicy_crd.yaml b/deploy/crds/sriovnetwork_v1_sriovnetworknodepolicy_crd.yaml index a6fae2a8a..8c96179a8 100644 --- a/deploy/crds/sriovnetwork_v1_sriovnetworknodepolicy_crd.yaml +++ b/deploy/crds/sriovnetwork_v1_sriovnetworknodepolicy_crd.yaml @@ -10,8 +10,6 @@ spec: plural: sriovnetworknodepolicies singular: sriovnetworknodepolicy scope: Namespaced - subresources: - status: {} validation: openAPIV3Schema: properties: @@ -28,32 +26,44 @@ spec: metadata: type: object spec: + description: Spec hold the intent of how this operator should configure + the SR-IoV on host. properties: deviceType: + description: The driver type for configured VFs. Allowed value "netdevice", + "vfio-pci". Defaults to netdevice. enum: - netdevice - vfio-pci type: string isRdma: + description: RDMA mode. Defaults to false. type: boolean mtu: + description: MTU of VF format: int64 maximum: 9000 minimum: 1 type: integer nicSelector: + description: NicSelector selects the NICs to be configured properties: deviceID: + description: The device hex code of SR-IoV device. type: string pfNames: + description: Name of SR-IoV PF. items: type: string type: array rootDevices: + description: PCI address of SR-IoV PF. items: type: string type: array vendor: + description: The vendor hex code of SR-IoV device. Allowed value + "8086", "15b3". enum: - "8086" - 15b3 @@ -62,17 +72,22 @@ spec: nodeSelector: additionalProperties: type: string + description: NodeSelector selects the nodes to be configured type: object numVfs: + description: Number of VFs for each PF format: int64 minimum: 0 type: integer priority: + description: Priority of the policy, higher priority policies can override + lower ones. format: int64 maximum: 99 minimum: 0 type: integer resourceName: + description: SRIOV Network device plugin endpoint resource name type: string required: - resourceName diff --git a/pkg/apis/k8s/v1/zz_generated.deepcopy.go b/pkg/apis/k8s/v1/zz_generated.deepcopy.go index 0376e461f..5f59e4d56 100644 --- a/pkg/apis/k8s/v1/zz_generated.deepcopy.go +++ b/pkg/apis/k8s/v1/zz_generated.deepcopy.go @@ -1,6 +1,6 @@ // +build !ignore_autogenerated -// Code generated by deepcopy-gen. DO NOT EDIT. +// Code generated by operator-sdk. DO NOT EDIT. package v1 diff --git a/pkg/apis/k8s/v1/zz_generated.openapi.go b/pkg/apis/k8s/v1/zz_generated.openapi.go index 7b38b7933..c0aea0f26 100644 --- a/pkg/apis/k8s/v1/zz_generated.openapi.go +++ b/pkg/apis/k8s/v1/zz_generated.openapi.go @@ -1,6 +1,4 @@ -// +build !ignore_autogenerated - -// Code generated by openapi-gen. DO NOT EDIT. +// +build ! // This file was autogenerated by openapi-gen. Do not edit it manually! diff --git a/pkg/apis/sriovnetwork/v1/sriovnetwork_types.go b/pkg/apis/sriovnetwork/v1/sriovnetwork_types.go index 53d004c37..1941389cd 100644 --- a/pkg/apis/sriovnetwork/v1/sriovnetwork_types.go +++ b/pkg/apis/sriovnetwork/v1/sriovnetwork_types.go @@ -10,21 +10,22 @@ import ( // SriovNetworkSpec defines the desired state of SriovNetwork // +k8s:openapi-gen=true type SriovNetworkSpec struct { + // Namespace of the NetworkAttachmentDefinition custom resource NetworkNamespace string `json:"networkNamespace,omitempty"` + // SRIOV Network device plugin endpoint resource name ResourceName string `json:"resourceName"` + //IPAM configuration to be used for this network. IPAM string `json:"ipam,omitempty"` // +kubebuilder:validation:Minimum=0 // +kubebuilder:validation:Maximum=4096 + // VLAN ID to assign for the VF. Defaults to 0. Vlan int `json:"vlan,omitempty"` + // VF spoof check SpoofChk *bool `json:"spoofChk,omitempty"` + // VF trust mode Trust *bool `json:"trust,omitempty"` } -// // Ipam defines the desired state of IPAM -// type Ipam struct { -// Type string `json:"type,omitempty"` -// } - // SriovNetworkStatus defines the observed state of SriovNetwork // +k8s:openapi-gen=true type SriovNetworkStatus struct { @@ -41,6 +42,7 @@ type SriovNetwork struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` + // Specification describing how a NetworkAttachmentDefinition custom resource shall be defined for SR-IOV CNI plugin. Spec SriovNetworkSpec `json:"spec,omitempty"` Status SriovNetworkStatus `json:"status,omitempty"` } diff --git a/pkg/apis/sriovnetwork/v1/sriovnetworknodepolicy_types.go b/pkg/apis/sriovnetwork/v1/sriovnetworknodepolicy_types.go index ead2402c7..3fc9a44c0 100644 --- a/pkg/apis/sriovnetwork/v1/sriovnetworknodepolicy_types.go +++ b/pkg/apis/sriovnetwork/v1/sriovnetworknodepolicy_types.go @@ -10,29 +10,41 @@ import ( // SriovNetworkNodePolicySpec defines the desired state of SriovNetworkNodePolicy // +k8s:openapi-gen=true type SriovNetworkNodePolicySpec struct { + // SRIOV Network device plugin endpoint resource name ResourceName string `json:"resourceName"` // +kubebuilder:validation:MinItems=0 // +kubebuilder:validation:UniqueItems=true + // NodeSelector selects the nodes to be configured NodeSelector map[string]string `json:"nodeSelector"` // +kubebuilder:validation:Minimum=0 // +kubebuilder:validation:Maximum=99 + // Priority of the policy, higher priority policies can override lower ones. Priority int `json:"priority,omitempty"` // +kubebuilder:validation:Minimum=1 // +kubebuilder:validation:Maximum=9000 + // MTU of VF Mtu int `json:"mtu,omitempty"` // +kubebuilder:validation:Minimum=0 + // Number of VFs for each PF NumVfs int `json:"numVfs"` + // NicSelector selects the NICs to be configured NicSelector SriovNetworkNicSelector `json:"nicSelector"` // +kubebuilder:validation:Enum=netdevice,vfio-pci + // The driver type for configured VFs. Allowed value "netdevice", "vfio-pci". Defaults to netdevice. DeviceType string `json:"deviceType,omitempty"` + // RDMA mode. Defaults to false. IsRdma bool `json:"isRdma,omitempty"` } type SriovNetworkNicSelector struct { // +kubebuilder:validation:Enum=8086,15b3 + // The vendor hex code of SR-IoV device. Allowed value "8086", "15b3". Vendor string `json:"vendor,omitempty"` + // The device hex code of SR-IoV device. DeviceID string `json:"deviceID,omitempty"` + // PCI address of SR-IoV PF. RootDevices []string `json:"rootDevices,omitempty"` + // Name of SR-IoV PF. PfNames []string `json:"pfNames,omitempty"` } @@ -52,6 +64,7 @@ type SriovNetworkNodePolicy struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` + // Spec hold the intent of how this operator should configure the SR-IoV on host. Spec SriovNetworkNodePolicySpec `json:"spec,omitempty"` Status SriovNetworkNodePolicyStatus `json:"status,omitempty"` } diff --git a/pkg/apis/sriovnetwork/v1/sriovnetworknodestate_types.go b/pkg/apis/sriovnetwork/v1/sriovnetworknodestate_types.go index 19cda6348..36ea62a3c 100644 --- a/pkg/apis/sriovnetwork/v1/sriovnetworknodestate_types.go +++ b/pkg/apis/sriovnetwork/v1/sriovnetworknodestate_types.go @@ -53,7 +53,7 @@ type SriovNetworkNodeStateStatus struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - +// +kubebuilder:subresource:status // SriovNetworkNodeState is the Schema for the sriovnetworknodestates API // +k8s:openapi-gen=true type SriovNetworkNodeState struct { diff --git a/pkg/apis/sriovnetwork/v1/zz_generated.deepcopy.go b/pkg/apis/sriovnetwork/v1/zz_generated.deepcopy.go index 1392561a4..94ebdf08d 100644 --- a/pkg/apis/sriovnetwork/v1/zz_generated.deepcopy.go +++ b/pkg/apis/sriovnetwork/v1/zz_generated.deepcopy.go @@ -1,6 +1,6 @@ // +build !ignore_autogenerated -// Code generated by deepcopy-gen. DO NOT EDIT. +// Code generated by operator-sdk. DO NOT EDIT. package v1 diff --git a/pkg/apis/sriovnetwork/v1/zz_generated.openapi.go b/pkg/apis/sriovnetwork/v1/zz_generated.openapi.go index 5af19f4a4..dc1b1baba 100644 --- a/pkg/apis/sriovnetwork/v1/zz_generated.openapi.go +++ b/pkg/apis/sriovnetwork/v1/zz_generated.openapi.go @@ -1,6 +1,4 @@ -// +build !ignore_autogenerated - -// Code generated by openapi-gen. DO NOT EDIT. +// +build ! // This file was autogenerated by openapi-gen. Do not edit it manually! @@ -52,7 +50,8 @@ func schema_pkg_apis_sriovnetwork_v1_SriovNetwork(ref common.ReferenceCallback) }, "spec": { SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/openshift/sriov-network-operator/pkg/apis/sriovnetwork/v1.SriovNetworkSpec"), + Description: "Specification describing how a NetworkAttachmentDefinition custom resource shall be defined for SR-IOV CNI plugin.", + Ref: ref("github.com/openshift/sriov-network-operator/pkg/apis/sriovnetwork/v1.SriovNetworkSpec"), }, }, "status": { @@ -95,7 +94,8 @@ func schema_pkg_apis_sriovnetwork_v1_SriovNetworkNodePolicy(ref common.Reference }, "spec": { SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/openshift/sriov-network-operator/pkg/apis/sriovnetwork/v1.SriovNetworkNodePolicySpec"), + Description: "Spec hold the intent of how this operator should configure the SR-IoV on host.", + Ref: ref("github.com/openshift/sriov-network-operator/pkg/apis/sriovnetwork/v1.SriovNetworkNodePolicySpec"), }, }, "status": { @@ -119,13 +119,15 @@ func schema_pkg_apis_sriovnetwork_v1_SriovNetworkNodePolicySpec(ref common.Refer Properties: map[string]spec.Schema{ "resourceName": { SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", + Description: "SRIOV Network device plugin endpoint resource name", + Type: []string{"string"}, + Format: "", }, }, "nodeSelector": { SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, + Description: "NodeSelector selects the nodes to be configured", + Type: []string{"object"}, AdditionalProperties: &spec.SchemaOrBool{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ @@ -138,37 +140,43 @@ func schema_pkg_apis_sriovnetwork_v1_SriovNetworkNodePolicySpec(ref common.Refer }, "priority": { SchemaProps: spec.SchemaProps{ - Type: []string{"integer"}, - Format: "int32", + Description: "Priority of the policy, higher priority policies can override lower ones.", + Type: []string{"integer"}, + Format: "int32", }, }, "mtu": { SchemaProps: spec.SchemaProps{ - Type: []string{"integer"}, - Format: "int32", + Description: "MTU of VF", + Type: []string{"integer"}, + Format: "int32", }, }, "numVfs": { SchemaProps: spec.SchemaProps{ - Type: []string{"integer"}, - Format: "int32", + Description: "Number of VFs for each PF", + Type: []string{"integer"}, + Format: "int32", }, }, "nicSelector": { SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/openshift/sriov-network-operator/pkg/apis/sriovnetwork/v1.SriovNetworkNicSelector"), + Description: "NicSelector selects the NICs to be configured", + Ref: ref("github.com/openshift/sriov-network-operator/pkg/apis/sriovnetwork/v1.SriovNetworkNicSelector"), }, }, "deviceType": { SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", + Description: "The driver type for configured VFs. Allowed value \"netdevice\", \"vfio-pci\". Defaults to netdevice.", + Type: []string{"string"}, + Format: "", }, }, "isRdma": { SchemaProps: spec.SchemaProps{ - Type: []string{"boolean"}, - Format: "", + Description: "RDMA mode. Defaults to false.", + Type: []string{"boolean"}, + Format: "", }, }, }, @@ -313,38 +321,44 @@ func schema_pkg_apis_sriovnetwork_v1_SriovNetworkSpec(ref common.ReferenceCallba Properties: map[string]spec.Schema{ "networkNamespace": { SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", + Description: "Namespace of the NetworkAttachmentDefinition custom resource", + Type: []string{"string"}, + Format: "", }, }, "resourceName": { SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", + Description: "SRIOV Network device plugin endpoint resource name", + Type: []string{"string"}, + Format: "", }, }, "ipam": { SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "", + Description: "IPAM configuration to be used for this network.", + Type: []string{"string"}, + Format: "", }, }, "vlan": { SchemaProps: spec.SchemaProps{ - Type: []string{"integer"}, - Format: "int32", + Description: "VLAN ID to assign for the VF. Defaults to 0.", + Type: []string{"integer"}, + Format: "int32", }, }, "spoofChk": { SchemaProps: spec.SchemaProps{ - Type: []string{"boolean"}, - Format: "", + Description: "VF spoof check", + Type: []string{"boolean"}, + Format: "", }, }, "trust": { SchemaProps: spec.SchemaProps{ - Type: []string{"boolean"}, - Format: "", + Description: "VF trust mode", + Type: []string{"boolean"}, + Format: "", }, }, },