Skip to content

Commit

Permalink
Bug 1735728: Add description to operator user facing CRDs.
Browse files Browse the repository at this point in the history
  • Loading branch information
pliurh committed Aug 16, 2019
1 parent 5a40bcb commit 0f1878c
Show file tree
Hide file tree
Showing 9 changed files with 96 additions and 46 deletions.
12 changes: 10 additions & 2 deletions deploy/crds/sriovnetwork_v1_sriovnetwork_crd.yaml
Expand Up @@ -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
Expand Down
19 changes: 17 additions & 2 deletions deploy/crds/sriovnetwork_v1_sriovnetworknodepolicy_crd.yaml
Expand Up @@ -10,8 +10,6 @@ spec:
plural: sriovnetworknodepolicies
singular: sriovnetworknodepolicy
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
properties:
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/k8s/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions 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!

Expand Down
12 changes: 7 additions & 5 deletions pkg/apis/sriovnetwork/v1/sriovnetwork_types.go
Expand Up @@ -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 {
Expand All @@ -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"`
}
Expand Down
13 changes: 13 additions & 0 deletions pkg/apis/sriovnetwork/v1/sriovnetworknodepolicy_types.go
Expand Up @@ -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"`
}

Expand All @@ -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"`
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/sriovnetwork/v1/sriovnetworknodestate_types.go
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/sriovnetwork/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

76 changes: 45 additions & 31 deletions 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!

Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand All @@ -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{
Expand All @@ -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: "",
},
},
},
Expand Down Expand Up @@ -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: "",
},
},
},
Expand Down

0 comments on commit 0f1878c

Please sign in to comment.