4 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
7 // EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
8 // NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
10 // NetworkSpec defines the desired state of Network
11 // +k8s:openapi-gen=true
12 type NetworkSpec struct {
13 // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
14 // Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file
15 // Add custom validation using kubebuilder tags: https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html
16 CniType string `json:"cniType"`
17 Ipv4Subnets []IpSubnet `json:"ipv4Subnets"`
18 Ipv6Subnets []IpSubnet `json:"ipv6Subnets,omitempty"`
19 DNS DnsSpec `json:"dns,omitempty"`
20 Routes []Route `json:"routes,omitempty"`
23 type IpSubnet struct {
24 Name string `json:"name"`
25 Subnet string `json:"subnet"`
26 Gateway string `json:"gateway,omitempty"`
27 ExcludeIps string `json:"excludeIps,omitempty"`
31 Dst string `json:"dst"`
32 GW string `json:"gw,omitempty"`
36 Nameservers []string `json:"nameservers,omitempty"`
37 Domain string `json:"domain,omitempty"`
38 Search []string `json:"search,omitempty"`
39 Options []string `json:"options,omitempty"`
43 //Created indicates the status of success
45 //CreateInternalError indicates create internal irrecoverable Error
46 CreateInternalError = "CreateInternalError"
47 //DeleteInternalError indicates delete internal irrecoverable Error
48 DeleteInternalError = "DeleteInternalError"
51 // NetworkStatus defines the observed state of Network
52 // +k8s:openapi-gen=true
53 type NetworkStatus struct {
54 // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
55 // Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file
56 // Add custom validation using kubebuilder tags: https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html
57 State string `json:"state"` // Indicates if Network is in "created" state
60 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
62 // Network is the Schema for the networks API
63 // +k8s:openapi-gen=true
64 // +kubebuilder:subresource:status
66 metav1.TypeMeta `json:",inline"`
67 metav1.ObjectMeta `json:"metadata,omitempty"`
69 Spec NetworkSpec `json:"spec,omitempty"`
70 Status NetworkStatus `json:"status,omitempty"`
73 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
75 // NetworkList contains a list of Network
76 type NetworkList struct {
77 metav1.TypeMeta `json:",inline"`
78 metav1.ListMeta `json:"metadata,omitempty"`
79 Items []Network `json:"items"`
83 SchemeBuilder.Register(&Network{}, &NetworkList{})