aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRitu Sood <ritu.sood@intel.com>2019-08-06 21:42:15 -0700
committerTrinath Somanchi <trinaths.dev@gmail.com>2019-08-16 09:29:53 +0000
commit8fe5ed0f2cc522d22d0ca556f48f2e5922c67d3e (patch)
treeef050fa6236460d8d1f8063f087bad84315eecb4
parent8295a28f6d6e14f5adb62138271de393015061e9 (diff)
Add types and generated code for CRDs
Adding Network CRD and Provider Network CRD generated code as per the spec. https://wiki.onap.org/display/DW/K8s+Plugin+Network+Related+CRD%27s+for+R5 Change-Id: If75885205830cf2cef197754ea8f00b61095a4a1 Signed-off-by: Ritu Sood <ritu.sood@intel.com>
-rw-r--r--cmd/nfn-operator/nfn-operator.go10
-rw-r--r--deploy/crds/k8s_v1alpha1_network_cr.yaml13
-rw-r--r--deploy/crds/k8s_v1alpha1_network_crd.yaml117
-rw-r--r--deploy/crds/k8s_v1alpha1_providernetwork_crd.yaml136
-rw-r--r--pkg/apis/addtoscheme_k8s_v1alpha1.go10
-rw-r--r--pkg/apis/apis.go13
-rw-r--r--pkg/apis/k8s/group.go6
-rw-r--r--pkg/apis/k8s/v1alpha1/doc.go4
-rw-r--r--pkg/apis/k8s/v1alpha1/network_types.go82
-rw-r--r--pkg/apis/k8s/v1alpha1/providernetwork_types.go65
-rw-r--r--pkg/apis/k8s/v1alpha1/register.go19
-rw-r--r--pkg/apis/k8s/v1alpha1/zz_generated.deepcopy.go307
-rw-r--r--pkg/apis/k8s/v1alpha1/zz_generated.openapi.go286
13 files changed, 1063 insertions, 5 deletions
diff --git a/cmd/nfn-operator/nfn-operator.go b/cmd/nfn-operator/nfn-operator.go
index 2925ac6..4749506 100644
--- a/cmd/nfn-operator/nfn-operator.go
+++ b/cmd/nfn-operator/nfn-operator.go
@@ -10,7 +10,7 @@ import (
_ "k8s.io/client-go/plugin/pkg/client/auth"
"github.com/spf13/pflag"
-// "ovn4nfv-k8s-plugin/pkg/apis"
+ "ovn4nfv-k8s-plugin/pkg/apis"
"ovn4nfv-k8s-plugin/internal/pkg/ovn"
"ovn4nfv-k8s-plugin/pkg/controller"
"sigs.k8s.io/controller-runtime/pkg/client/config"
@@ -71,10 +71,10 @@ func main() {
log.Info("Registering Components.")
// Setup Scheme for all resources
- //if err := apis.AddToScheme(mgr.GetScheme()); err != nil {
- // log.Error(err, "")
- // os.Exit(1)
- //}
+ if err := apis.AddToScheme(mgr.GetScheme()); err != nil {
+ log.Error(err, "")
+ os.Exit(1)
+ }
// Setup all Controllers
if err := controller.AddToManager(mgr); err != nil {
diff --git a/deploy/crds/k8s_v1alpha1_network_cr.yaml b/deploy/crds/k8s_v1alpha1_network_cr.yaml
new file mode 100644
index 0000000..5f3cd9b
--- /dev/null
+++ b/deploy/crds/k8s_v1alpha1_network_cr.yaml
@@ -0,0 +1,13 @@
+apiVersion: k8s.plugin.opnfv.org/v1alpha1
+kind: Network
+metadata:
+ name: example-network
+spec:
+ # Add fields here
+ cniType: ovn4nfv
+ ipv4Subnets:
+ - subnet: 172.16.33.0/24
+ name: subnet1
+ gateway: 172.16.33.1/24
+ excludeIps: 172.16.33.2 172.16.33.5..172.16.33.10
+
diff --git a/deploy/crds/k8s_v1alpha1_network_crd.yaml b/deploy/crds/k8s_v1alpha1_network_crd.yaml
new file mode 100644
index 0000000..793261e
--- /dev/null
+++ b/deploy/crds/k8s_v1alpha1_network_crd.yaml
@@ -0,0 +1,117 @@
+apiVersion: apiextensions.k8s.io/v1beta1
+kind: CustomResourceDefinition
+metadata:
+ name: networks.k8s.plugin.opnfv.org
+spec:
+ group: k8s.plugin.opnfv.org
+ names:
+ kind: Network
+ listKind: NetworkList
+ plural: networks
+ singular: network
+ scope: Namespaced
+ subresources:
+ status: {}
+ validation:
+ openAPIV3Schema:
+ properties:
+ apiVersion:
+ description: 'APIVersion defines the versioned schema of this representation
+ of an object. Servers should convert recognized schemas to the latest
+ internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
+ type: string
+ kind:
+ description: 'Kind is a string value representing the REST resource this
+ object represents. Servers may infer this from the endpoint the client
+ submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
+ type: string
+ metadata:
+ type: object
+ spec:
+ properties:
+ cniType:
+ description: 'INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
+ Important: Run "operator-sdk generate k8s" to regenerate code after
+ modifying this file Add custom validation using kubebuilder tags:
+ https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html'
+ type: string
+ dns:
+ properties:
+ domain:
+ type: string
+ nameservers:
+ items:
+ type: string
+ type: array
+ options:
+ items:
+ type: string
+ type: array
+ search:
+ items:
+ type: string
+ type: array
+ type: object
+ ipv4Subnets:
+ items:
+ properties:
+ excludeIps:
+ type: string
+ gateway:
+ type: string
+ name:
+ type: string
+ subnet:
+ type: string
+ required:
+ - name
+ - subnet
+ type: object
+ type: array
+ ipv6Subnets:
+ items:
+ properties:
+ excludeIps:
+ type: string
+ gateway:
+ type: string
+ name:
+ type: string
+ subnet:
+ type: string
+ required:
+ - name
+ - subnet
+ type: object
+ type: array
+ routes:
+ items:
+ properties:
+ dst:
+ type: string
+ gw:
+ type: string
+ required:
+ - dst
+ type: object
+ type: array
+ required:
+ - cniType
+ - ipv4Subnets
+ type: object
+ status:
+ properties:
+ state:
+ description: 'INSERT ADDITIONAL STATUS FIELD - define observed state
+ of cluster Important: Run "operator-sdk generate k8s" to regenerate
+ code after modifying this file Add custom validation using kubebuilder
+ tags: https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html'
+ type: string
+ required:
+ - state
+ type: object
+ version: v1alpha1
+ versions:
+ - name: v1alpha1
+ served: true
+ storage: true
diff --git a/deploy/crds/k8s_v1alpha1_providernetwork_crd.yaml b/deploy/crds/k8s_v1alpha1_providernetwork_crd.yaml
new file mode 100644
index 0000000..eabf3f2
--- /dev/null
+++ b/deploy/crds/k8s_v1alpha1_providernetwork_crd.yaml
@@ -0,0 +1,136 @@
+apiVersion: apiextensions.k8s.io/v1beta1
+kind: CustomResourceDefinition
+metadata:
+ name: providernetworks.k8s.plugin.opnfv.org
+spec:
+ group: k8s.plugin.opnfv.org
+ names:
+ kind: ProviderNetwork
+ listKind: ProviderNetworkList
+ plural: providernetworks
+ singular: providernetwork
+ scope: Namespaced
+ subresources:
+ status: {}
+ validation:
+ openAPIV3Schema:
+ properties:
+ apiVersion:
+ description: 'APIVersion defines the versioned schema of this representation
+ of an object. Servers should convert recognized schemas to the latest
+ internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
+ type: string
+ kind:
+ description: 'Kind is a string value representing the REST resource this
+ object represents. Servers may infer this from the endpoint the client
+ submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
+ type: string
+ metadata:
+ type: object
+ spec:
+ properties:
+ cniType:
+ description: 'INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
+ Important: Run "operator-sdk generate k8s" to regenerate code after
+ modifying this file Add custom validation using kubebuilder tags:
+ https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html'
+ type: string
+ dns:
+ properties:
+ domain:
+ type: string
+ nameservers:
+ items:
+ type: string
+ type: array
+ options:
+ items:
+ type: string
+ type: array
+ search:
+ items:
+ type: string
+ type: array
+ type: object
+ ipv4Subnets:
+ items:
+ properties:
+ excludeIps:
+ type: string
+ gateway:
+ type: string
+ name:
+ type: string
+ subnet:
+ type: string
+ required:
+ - name
+ - subnet
+ type: object
+ type: array
+ ipv6Subnets:
+ items:
+ properties:
+ excludeIps:
+ type: string
+ gateway:
+ type: string
+ name:
+ type: string
+ subnet:
+ type: string
+ required:
+ - name
+ - subnet
+ type: object
+ type: array
+ providerNetType:
+ type: string
+ routes:
+ items:
+ properties:
+ dst:
+ type: string
+ gw:
+ type: string
+ required:
+ - dst
+ type: object
+ type: array
+ vlan:
+ properties:
+ logicalInterfaceName:
+ type: string
+ node:
+ type: string
+ providerInterfaceName:
+ type: string
+ vlanId:
+ type: string
+ required:
+ - vlanId
+ - node
+ - providerInterfaceName
+ type: object
+ required:
+ - cniType
+ - ipv4Subnets
+ - providerNetType
+ - vlan
+ type: object
+ status:
+ properties:
+ state:
+ description: 'INSERT ADDITIONAL STATUS FIELD - define observed state
+ of cluster Important: Run "operator-sdk generate k8s" to regenerate
+ code after modifying this file Add custom validation using kubebuilder
+ tags: https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html'
+ type: string
+ required:
+ - state
+ type: object
+ version: v1alpha1
+ versions:
+ - name: v1alpha1
+ served: true
+ storage: true
diff --git a/pkg/apis/addtoscheme_k8s_v1alpha1.go b/pkg/apis/addtoscheme_k8s_v1alpha1.go
new file mode 100644
index 0000000..b6d6189
--- /dev/null
+++ b/pkg/apis/addtoscheme_k8s_v1alpha1.go
@@ -0,0 +1,10 @@
+package apis
+
+import (
+ "ovn4nfv-k8s-plugin/pkg/apis/k8s/v1alpha1"
+)
+
+func init() {
+ // Register the types with the Scheme so the components can map objects to GroupVersionKinds and back
+ AddToSchemes = append(AddToSchemes, v1alpha1.SchemeBuilder.AddToScheme)
+}
diff --git a/pkg/apis/apis.go b/pkg/apis/apis.go
new file mode 100644
index 0000000..07dc961
--- /dev/null
+++ b/pkg/apis/apis.go
@@ -0,0 +1,13 @@
+package apis
+
+import (
+ "k8s.io/apimachinery/pkg/runtime"
+)
+
+// AddToSchemes may be used to add all resources defined in the project to a Scheme
+var AddToSchemes runtime.SchemeBuilder
+
+// AddToScheme adds all Resources to the Scheme
+func AddToScheme(s *runtime.Scheme) error {
+ return AddToSchemes.AddToScheme(s)
+}
diff --git a/pkg/apis/k8s/group.go b/pkg/apis/k8s/group.go
new file mode 100644
index 0000000..8168e37
--- /dev/null
+++ b/pkg/apis/k8s/group.go
@@ -0,0 +1,6 @@
+// Package k8s contains k8s API versions.
+//
+// This file ensures Go source parsers acknowledge the k8s package
+// and any child packages. It can be removed if any other Go source files are
+// added to this package.
+package k8s
diff --git a/pkg/apis/k8s/v1alpha1/doc.go b/pkg/apis/k8s/v1alpha1/doc.go
new file mode 100644
index 0000000..e2e174b
--- /dev/null
+++ b/pkg/apis/k8s/v1alpha1/doc.go
@@ -0,0 +1,4 @@
+// Package v1alpha1 contains API Schema definitions for the k8s v1alpha1 API group
+// +k8s:deepcopy-gen=package,register
+// +groupName=k8s.plugin.opnfv.org
+package v1alpha1
diff --git a/pkg/apis/k8s/v1alpha1/network_types.go b/pkg/apis/k8s/v1alpha1/network_types.go
new file mode 100644
index 0000000..a52dd58
--- /dev/null
+++ b/pkg/apis/k8s/v1alpha1/network_types.go
@@ -0,0 +1,82 @@
+package v1alpha1
+
+import (
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+)
+
+// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
+// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
+
+// NetworkSpec defines the desired state of Network
+// +k8s:openapi-gen=true
+type NetworkSpec struct {
+ // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
+ // Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file
+ // Add custom validation using kubebuilder tags: https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html
+ CniType string `json:"cniType"`
+ Ipv4Subnets []IpSubnet `json:"ipv4Subnets"`
+ Ipv6Subnets []IpSubnet `json:"ipv6Subnets,omitempty"`
+ DNS DnsSpec `json:"dns,omitempty"`
+ Routes []Route `json:"routes,omitempty"`
+}
+
+type IpSubnet struct {
+ Name string `json:"name"`
+ Subnet string `json:"subnet"`
+ Gateway string `json:"gateway,omitempty"`
+ ExcludeIps string `json:"excludeIps,omitempty"`
+}
+
+type Route struct {
+ Dst string `json:"dst"`
+ GW string `json:"gw,omitempty"`
+}
+
+type DnsSpec struct {
+ Nameservers []string `json:"nameservers,omitempty"`
+ Domain string `json:"domain,omitempty"`
+ Search []string `json:"search,omitempty"`
+ Options []string `json:"options,omitempty"`
+}
+
+const (
+ //Created indicates the status of success
+ Created = "Created"
+ //Indicates internal Irrecoverable Error
+ InternalError = "InternalError"
+)
+
+// NetworkStatus defines the observed state of Network
+// +k8s:openapi-gen=true
+type NetworkStatus struct {
+ // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
+ // Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file
+ // Add custom validation using kubebuilder tags: https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html
+ State string `json:"state"` // Indicates if Network is in "created" state
+}
+
+// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
+
+// Network is the Schema for the networks API
+// +k8s:openapi-gen=true
+// +kubebuilder:subresource:status
+type Network struct {
+ metav1.TypeMeta `json:",inline"`
+ metav1.ObjectMeta `json:"metadata,omitempty"`
+
+ Spec NetworkSpec `json:"spec,omitempty"`
+ Status NetworkStatus `json:"status,omitempty"`
+}
+
+// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
+
+// NetworkList contains a list of Network
+type NetworkList struct {
+ metav1.TypeMeta `json:",inline"`
+ metav1.ListMeta `json:"metadata,omitempty"`
+ Items []Network `json:"items"`
+}
+
+func init() {
+ SchemeBuilder.Register(&Network{}, &NetworkList{})
+}
diff --git a/pkg/apis/k8s/v1alpha1/providernetwork_types.go b/pkg/apis/k8s/v1alpha1/providernetwork_types.go
new file mode 100644
index 0000000..b292827
--- /dev/null
+++ b/pkg/apis/k8s/v1alpha1/providernetwork_types.go
@@ -0,0 +1,65 @@
+package v1alpha1
+
+import (
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+)
+
+// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
+// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
+
+// ProviderNetworkSpec defines the desired state of ProviderNetwork
+// +k8s:openapi-gen=true
+type ProviderNetworkSpec struct {
+ // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
+ // Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file
+ // Add custom validation using kubebuilder tags: https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html
+ CniType string `json:"cniType"`
+ Ipv4Subnets []IpSubnet `json:"ipv4Subnets"`
+ Ipv6Subnets []IpSubnet `json:"ipv6Subnets,omitempty"`
+ DNS DnsSpec `json:"dns,omitempty"`
+ Routes []Route `json:"routes,omitempty"`
+ ProviderNetType string `json:"providerNetType"`
+ Vlan VlanSpec `json:"vlan"` // For now VLAN is the only supported type
+}
+
+type VlanSpec struct {
+ VlanId string `json:"vlanId"`
+ Node string `json:"node"`
+ ProviderInterfaceName string `json:"providerInterfaceName"`
+ LogicalInterfaceName string `json:"logicalInterfaceName,omitempty"`
+}
+
+// ProviderNetworkStatus defines the observed state of ProviderNetwork
+// +k8s:openapi-gen=true
+type ProviderNetworkStatus struct {
+ // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
+ // Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file
+ // Add custom validation using kubebuilder tags: https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html
+ State string `json:"state"` // Indicates if ProviderNetwork is in "created" state
+}
+
+// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
+
+// ProviderNetwork is the Schema for the providernetworks API
+// +k8s:openapi-gen=true
+// +kubebuilder:subresource:status
+type ProviderNetwork struct {
+ metav1.TypeMeta `json:",inline"`
+ metav1.ObjectMeta `json:"metadata,omitempty"`
+
+ Spec ProviderNetworkSpec `json:"spec,omitempty"`
+ Status ProviderNetworkStatus `json:"status,omitempty"`
+}
+
+// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
+
+// ProviderNetworkList contains a list of ProviderNetwork
+type ProviderNetworkList struct {
+ metav1.TypeMeta `json:",inline"`
+ metav1.ListMeta `json:"metadata,omitempty"`
+ Items []ProviderNetwork `json:"items"`
+}
+
+func init() {
+ SchemeBuilder.Register(&ProviderNetwork{}, &ProviderNetworkList{})
+}
diff --git a/pkg/apis/k8s/v1alpha1/register.go b/pkg/apis/k8s/v1alpha1/register.go
new file mode 100644
index 0000000..b65f347
--- /dev/null
+++ b/pkg/apis/k8s/v1alpha1/register.go
@@ -0,0 +1,19 @@
+// NOTE: Boilerplate only. Ignore this file.
+
+// Package v1alpha1 contains API Schema definitions for the k8s v1alpha1 API group
+// +k8s:deepcopy-gen=package,register
+// +groupName=k8s.plugin.opnfv.org
+package v1alpha1
+
+import (
+ "k8s.io/apimachinery/pkg/runtime/schema"
+ "sigs.k8s.io/controller-runtime/pkg/runtime/scheme"
+)
+
+var (
+ // SchemeGroupVersion is group version used to register these objects
+ SchemeGroupVersion = schema.GroupVersion{Group: "k8s.plugin.opnfv.org", Version: "v1alpha1"}
+
+ // SchemeBuilder is used to add go types to the GroupVersionKind scheme
+ SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
+)
diff --git a/pkg/apis/k8s/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/k8s/v1alpha1/zz_generated.deepcopy.go
new file mode 100644
index 0000000..b524d40
--- /dev/null
+++ b/pkg/apis/k8s/v1alpha1/zz_generated.deepcopy.go
@@ -0,0 +1,307 @@
+// +build !ignore_autogenerated
+
+// Code generated by operator-sdk. DO NOT EDIT.
+
+package v1alpha1
+
+import (
+ runtime "k8s.io/apimachinery/pkg/runtime"
+)
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *DnsSpec) DeepCopyInto(out *DnsSpec) {
+ *out = *in
+ if in.Nameservers != nil {
+ in, out := &in.Nameservers, &out.Nameservers
+ *out = make([]string, len(*in))
+ copy(*out, *in)
+ }
+ if in.Search != nil {
+ in, out := &in.Search, &out.Search
+ *out = make([]string, len(*in))
+ copy(*out, *in)
+ }
+ if in.Options != nil {
+ in, out := &in.Options, &out.Options
+ *out = make([]string, len(*in))
+ copy(*out, *in)
+ }
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DnsSpec.
+func (in *DnsSpec) DeepCopy() *DnsSpec {
+ if in == nil {
+ return nil
+ }
+ out := new(DnsSpec)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *IpSubnet) DeepCopyInto(out *IpSubnet) {
+ *out = *in
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IpSubnet.
+func (in *IpSubnet) DeepCopy() *IpSubnet {
+ if in == nil {
+ return nil
+ }
+ out := new(IpSubnet)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *Network) DeepCopyInto(out *Network) {
+ *out = *in
+ out.TypeMeta = in.TypeMeta
+ in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
+ in.Spec.DeepCopyInto(&out.Spec)
+ out.Status = in.Status
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Network.
+func (in *Network) DeepCopy() *Network {
+ if in == nil {
+ return nil
+ }
+ out := new(Network)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
+func (in *Network) DeepCopyObject() runtime.Object {
+ if c := in.DeepCopy(); c != nil {
+ return c
+ }
+ return nil
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *NetworkList) DeepCopyInto(out *NetworkList) {
+ *out = *in
+ out.TypeMeta = in.TypeMeta
+ out.ListMeta = in.ListMeta
+ if in.Items != nil {
+ in, out := &in.Items, &out.Items
+ *out = make([]Network, len(*in))
+ for i := range *in {
+ (*in)[i].DeepCopyInto(&(*out)[i])
+ }
+ }
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkList.
+func (in *NetworkList) DeepCopy() *NetworkList {
+ if in == nil {
+ return nil
+ }
+ out := new(NetworkList)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
+func (in *NetworkList) DeepCopyObject() runtime.Object {
+ if c := in.DeepCopy(); c != nil {
+ return c
+ }
+ return nil
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *NetworkSpec) DeepCopyInto(out *NetworkSpec) {
+ *out = *in
+ if in.Ipv4Subnets != nil {
+ in, out := &in.Ipv4Subnets, &out.Ipv4Subnets
+ *out = make([]IpSubnet, len(*in))
+ copy(*out, *in)
+ }
+ if in.Ipv6Subnets != nil {
+ in, out := &in.Ipv6Subnets, &out.Ipv6Subnets
+ *out = make([]IpSubnet, len(*in))
+ copy(*out, *in)
+ }
+ in.DNS.DeepCopyInto(&out.DNS)
+ if in.Routes != nil {
+ in, out := &in.Routes, &out.Routes
+ *out = make([]Route, len(*in))
+ copy(*out, *in)
+ }
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkSpec.
+func (in *NetworkSpec) DeepCopy() *NetworkSpec {
+ if in == nil {
+ return nil
+ }
+ out := new(NetworkSpec)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *NetworkStatus) DeepCopyInto(out *NetworkStatus) {
+ *out = *in
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkStatus.
+func (in *NetworkStatus) DeepCopy() *NetworkStatus {
+ if in == nil {
+ return nil
+ }
+ out := new(NetworkStatus)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ProviderNetwork) DeepCopyInto(out *ProviderNetwork) {
+ *out = *in
+ out.TypeMeta = in.TypeMeta
+ in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
+ in.Spec.DeepCopyInto(&out.Spec)
+ out.Status = in.Status
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderNetwork.
+func (in *ProviderNetwork) DeepCopy() *ProviderNetwork {
+ if in == nil {
+ return nil
+ }
+ out := new(ProviderNetwork)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
+func (in *ProviderNetwork) DeepCopyObject() runtime.Object {
+ if c := in.DeepCopy(); c != nil {
+ return c
+ }
+ return nil
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ProviderNetworkList) DeepCopyInto(out *ProviderNetworkList) {
+ *out = *in
+ out.TypeMeta = in.TypeMeta
+ out.ListMeta = in.ListMeta
+ if in.Items != nil {
+ in, out := &in.Items, &out.Items
+ *out = make([]ProviderNetwork, len(*in))
+ for i := range *in {
+ (*in)[i].DeepCopyInto(&(*out)[i])
+ }
+ }
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderNetworkList.
+func (in *ProviderNetworkList) DeepCopy() *ProviderNetworkList {
+ if in == nil {
+ return nil
+ }
+ out := new(ProviderNetworkList)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
+func (in *ProviderNetworkList) DeepCopyObject() runtime.Object {
+ if c := in.DeepCopy(); c != nil {
+ return c
+ }
+ return nil
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ProviderNetworkSpec) DeepCopyInto(out *ProviderNetworkSpec) {
+ *out = *in
+ if in.Ipv4Subnets != nil {
+ in, out := &in.Ipv4Subnets, &out.Ipv4Subnets
+ *out = make([]IpSubnet, len(*in))
+ copy(*out, *in)
+ }
+ if in.Ipv6Subnets != nil {
+ in, out := &in.Ipv6Subnets, &out.Ipv6Subnets
+ *out = make([]IpSubnet, len(*in))
+ copy(*out, *in)
+ }
+ in.DNS.DeepCopyInto(&out.DNS)
+ if in.Routes != nil {
+ in, out := &in.Routes, &out.Routes
+ *out = make([]Route, len(*in))
+ copy(*out, *in)
+ }
+ out.Vlan = in.Vlan
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderNetworkSpec.
+func (in *ProviderNetworkSpec) DeepCopy() *ProviderNetworkSpec {
+ if in == nil {
+ return nil
+ }
+ out := new(ProviderNetworkSpec)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ProviderNetworkStatus) DeepCopyInto(out *ProviderNetworkStatus) {
+ *out = *in
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderNetworkStatus.
+func (in *ProviderNetworkStatus) DeepCopy() *ProviderNetworkStatus {
+ if in == nil {
+ return nil
+ }
+ out := new(ProviderNetworkStatus)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *Route) DeepCopyInto(out *Route) {
+ *out = *in
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Route.
+func (in *Route) DeepCopy() *Route {
+ if in == nil {
+ return nil
+ }
+ out := new(Route)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *VlanSpec) DeepCopyInto(out *VlanSpec) {
+ *out = *in
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VlanSpec.
+func (in *VlanSpec) DeepCopy() *VlanSpec {
+ if in == nil {
+ return nil
+ }
+ out := new(VlanSpec)
+ in.DeepCopyInto(out)
+ return out
+}
diff --git a/pkg/apis/k8s/v1alpha1/zz_generated.openapi.go b/pkg/apis/k8s/v1alpha1/zz_generated.openapi.go
new file mode 100644
index 0000000..7343285
--- /dev/null
+++ b/pkg/apis/k8s/v1alpha1/zz_generated.openapi.go
@@ -0,0 +1,286 @@
+// +build !
+
+// This file was autogenerated by openapi-gen. Do not edit it manually!
+
+package v1alpha1
+
+import (
+ spec "github.com/go-openapi/spec"
+ common "k8s.io/kube-openapi/pkg/common"
+)
+
+func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition {
+ return map[string]common.OpenAPIDefinition{
+ "ovn4nfv-k8s-plugin/pkg/apis/k8s/v1alpha1.Network": schema_pkg_apis_k8s_v1alpha1_Network(ref),
+ "ovn4nfv-k8s-plugin/pkg/apis/k8s/v1alpha1.NetworkSpec": schema_pkg_apis_k8s_v1alpha1_NetworkSpec(ref),
+ "ovn4nfv-k8s-plugin/pkg/apis/k8s/v1alpha1.NetworkStatus": schema_pkg_apis_k8s_v1alpha1_NetworkStatus(ref),
+ "ovn4nfv-k8s-plugin/pkg/apis/k8s/v1alpha1.ProviderNetwork": schema_pkg_apis_k8s_v1alpha1_ProviderNetwork(ref),
+ "ovn4nfv-k8s-plugin/pkg/apis/k8s/v1alpha1.ProviderNetworkSpec": schema_pkg_apis_k8s_v1alpha1_ProviderNetworkSpec(ref),
+ "ovn4nfv-k8s-plugin/pkg/apis/k8s/v1alpha1.ProviderNetworkStatus": schema_pkg_apis_k8s_v1alpha1_ProviderNetworkStatus(ref),
+ }
+}
+
+func schema_pkg_apis_k8s_v1alpha1_Network(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "Network is the Schema for the networks API",
+ Properties: map[string]spec.Schema{
+ "kind": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "apiVersion": {
+ SchemaProps: spec.SchemaProps{
+ Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "metadata": {
+ SchemaProps: spec.SchemaProps{
+ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
+ },
+ },
+ "spec": {
+ SchemaProps: spec.SchemaProps{
+ Ref: ref("ovn4nfv-k8s-plugin/pkg/apis/k8s/v1alpha1.NetworkSpec"),
+ },
+ },
+ "status": {
+ SchemaProps: spec.SchemaProps{
+ Ref: ref("ovn4nfv-k8s-plugin/pkg/apis/k8s/v1alpha1.NetworkStatus"),
+ },
+ },
+ },
+ },
+ },
+ Dependencies: []string{
+ "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "ovn4nfv-k8s-plugin/pkg/apis/k8s/v1alpha1.NetworkSpec", "ovn4nfv-k8s-plugin/pkg/apis/k8s/v1alpha1.NetworkStatus"},
+ }
+}
+
+func schema_pkg_apis_k8s_v1alpha1_NetworkSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "NetworkSpec defines the desired state of Network",
+ Properties: map[string]spec.Schema{
+ "cniType": {
+ SchemaProps: spec.SchemaProps{
+ Description: "INSERT ADDITIONAL SPEC FIELDS - desired state of cluster Important: Run \"operator-sdk generate k8s\" to regenerate code after modifying this file Add custom validation using kubebuilder tags: https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "ipv4Subnets": {
+ SchemaProps: spec.SchemaProps{
+ Type: []string{"array"},
+ Items: &spec.SchemaOrArray{
+ Schema: &spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Ref: ref("ovn4nfv-k8s-plugin/pkg/apis/k8s/v1alpha1.IpSubnet"),
+ },
+ },
+ },
+ },
+ },
+ "ipv6Subnets": {
+ SchemaProps: spec.SchemaProps{
+ Type: []string{"array"},
+ Items: &spec.SchemaOrArray{
+ Schema: &spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Ref: ref("ovn4nfv-k8s-plugin/pkg/apis/k8s/v1alpha1.IpSubnet"),
+ },
+ },
+ },
+ },
+ },
+ "dns": {
+ SchemaProps: spec.SchemaProps{
+ Ref: ref("ovn4nfv-k8s-plugin/pkg/apis/k8s/v1alpha1.DnsSpec"),
+ },
+ },
+ "routes": {
+ SchemaProps: spec.SchemaProps{
+ Type: []string{"array"},
+ Items: &spec.SchemaOrArray{
+ Schema: &spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Ref: ref("ovn4nfv-k8s-plugin/pkg/apis/k8s/v1alpha1.Route"),
+ },
+ },
+ },
+ },
+ },
+ },
+ Required: []string{"cniType", "ipv4Subnets"},
+ },
+ },
+ Dependencies: []string{
+ "ovn4nfv-k8s-plugin/pkg/apis/k8s/v1alpha1.DnsSpec", "ovn4nfv-k8s-plugin/pkg/apis/k8s/v1alpha1.IpSubnet", "ovn4nfv-k8s-plugin/pkg/apis/k8s/v1alpha1.Route"},
+ }
+}
+
+func schema_pkg_apis_k8s_v1alpha1_NetworkStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "NetworkStatus defines the observed state of Network",
+ Properties: map[string]spec.Schema{
+ "state": {
+ SchemaProps: spec.SchemaProps{
+ Description: "INSERT ADDITIONAL STATUS FIELD - define observed state of cluster Important: Run \"operator-sdk generate k8s\" to regenerate code after modifying this file Add custom validation using kubebuilder tags: https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ },
+ Required: []string{"state"},
+ },
+ },
+ Dependencies: []string{},
+ }
+}
+
+func schema_pkg_apis_k8s_v1alpha1_ProviderNetwork(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "ProviderNetwork is the Schema for the providernetworks API",
+ Properties: map[string]spec.Schema{
+ "kind": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "apiVersion": {
+ SchemaProps: spec.SchemaProps{
+ Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "metadata": {
+ SchemaProps: spec.SchemaProps{
+ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
+ },
+ },
+ "spec": {
+ SchemaProps: spec.SchemaProps{
+ Ref: ref("ovn4nfv-k8s-plugin/pkg/apis/k8s/v1alpha1.ProviderNetworkSpec"),
+ },
+ },
+ "status": {
+ SchemaProps: spec.SchemaProps{
+ Ref: ref("ovn4nfv-k8s-plugin/pkg/apis/k8s/v1alpha1.ProviderNetworkStatus"),
+ },
+ },
+ },
+ },
+ },
+ Dependencies: []string{
+ "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "ovn4nfv-k8s-plugin/pkg/apis/k8s/v1alpha1.ProviderNetworkSpec", "ovn4nfv-k8s-plugin/pkg/apis/k8s/v1alpha1.ProviderNetworkStatus"},
+ }
+}
+
+func schema_pkg_apis_k8s_v1alpha1_ProviderNetworkSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "ProviderNetworkSpec defines the desired state of ProviderNetwork",
+ Properties: map[string]spec.Schema{
+ "cniType": {
+ SchemaProps: spec.SchemaProps{
+ Description: "INSERT ADDITIONAL SPEC FIELDS - desired state of cluster Important: Run \"operator-sdk generate k8s\" to regenerate code after modifying this file Add custom validation using kubebuilder tags: https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "ipv4Subnets": {
+ SchemaProps: spec.SchemaProps{
+ Type: []string{"array"},
+ Items: &spec.SchemaOrArray{
+ Schema: &spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Ref: ref("ovn4nfv-k8s-plugin/pkg/apis/k8s/v1alpha1.IpSubnet"),
+ },
+ },
+ },
+ },
+ },
+ "ipv6Subnets": {
+ SchemaProps: spec.SchemaProps{
+ Type: []string{"array"},
+ Items: &spec.SchemaOrArray{
+ Schema: &spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Ref: ref("ovn4nfv-k8s-plugin/pkg/apis/k8s/v1alpha1.IpSubnet"),
+ },
+ },
+ },
+ },
+ },
+ "dns": {
+ SchemaProps: spec.SchemaProps{
+ Ref: ref("ovn4nfv-k8s-plugin/pkg/apis/k8s/v1alpha1.DnsSpec"),
+ },
+ },
+ "routes": {
+ SchemaProps: spec.SchemaProps{
+ Type: []string{"array"},
+ Items: &spec.SchemaOrArray{
+ Schema: &spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Ref: ref("ovn4nfv-k8s-plugin/pkg/apis/k8s/v1alpha1.Route"),
+ },
+ },
+ },
+ },
+ },
+ "providerNetType": {
+ SchemaProps: spec.SchemaProps{
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "vlan": {
+ SchemaProps: spec.SchemaProps{
+ Ref: ref("ovn4nfv-k8s-plugin/pkg/apis/k8s/v1alpha1.VlanSpec"),
+ },
+ },
+ },
+ Required: []string{"cniType", "ipv4Subnets", "providerNetType", "vlan"},
+ },
+ },
+ Dependencies: []string{
+ "ovn4nfv-k8s-plugin/pkg/apis/k8s/v1alpha1.DnsSpec", "ovn4nfv-k8s-plugin/pkg/apis/k8s/v1alpha1.IpSubnet", "ovn4nfv-k8s-plugin/pkg/apis/k8s/v1alpha1.Route", "ovn4nfv-k8s-plugin/pkg/apis/k8s/v1alpha1.VlanSpec"},
+ }
+}
+
+func schema_pkg_apis_k8s_v1alpha1_ProviderNetworkStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "ProviderNetworkStatus defines the observed state of ProviderNetwork",
+ Properties: map[string]spec.Schema{
+ "state": {
+ SchemaProps: spec.SchemaProps{
+ Description: "INSERT ADDITIONAL STATUS FIELD - define observed state of cluster Important: Run \"operator-sdk generate k8s\" to regenerate code after modifying this file Add custom validation using kubebuilder tags: https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ },
+ Required: []string{"state"},
+ },
+ },
+ Dependencies: []string{},
+ }
+}