Adding gRPC proto and server
[ovn4nfv-k8s-plugin.git] / pkg / apis / k8s / v1alpha1 / providernetwork_types.go
1 package v1alpha1
2
3 import (
4         metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5 )
6
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.
9
10 // ProviderNetworkSpec defines the desired state of ProviderNetwork
11 // +k8s:openapi-gen=true
12 type ProviderNetworkSpec 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"`
21         ProviderNetType string     `json:"providerNetType"`
22         Vlan            VlanSpec   `json:"vlan"` // For now VLAN is the only supported type
23 }
24
25 type VlanSpec struct {
26         VlanId                string   `json:"vlanId"`
27         VlanNodeSelector      string   `json:"vlanNodeSelector"`        // "all"/"any"(in which case a node will be randomly selected)/"specific"(see below)
28         NodeLabelList         []string `json:"nodeLabelList,omitempty"` // if VlanNodeSelector is value "specific" then this array provides a list of nodes labels
29         ProviderInterfaceName string   `json:"providerInterfaceName"`
30         LogicalInterfaceName  string   `json:"logicalInterfaceName,omitempty"`
31 }
32
33 // ProviderNetworkStatus defines the observed state of ProviderNetwork
34 // +k8s:openapi-gen=true
35 type ProviderNetworkStatus struct {
36         // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
37         // Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file
38         // Add custom validation using kubebuilder tags: https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html
39         State string `json:"state"` // Indicates if ProviderNetwork is in "created" state
40 }
41
42 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
43
44 // ProviderNetwork is the Schema for the providernetworks API
45 // +k8s:openapi-gen=true
46 // +kubebuilder:subresource:status
47 type ProviderNetwork struct {
48         metav1.TypeMeta   `json:",inline"`
49         metav1.ObjectMeta `json:"metadata,omitempty"`
50
51         Spec   ProviderNetworkSpec   `json:"spec,omitempty"`
52         Status ProviderNetworkStatus `json:"status,omitempty"`
53 }
54
55 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
56
57 // ProviderNetworkList contains a list of ProviderNetwork
58 type ProviderNetworkList struct {
59         metav1.TypeMeta `json:",inline"`
60         metav1.ListMeta `json:"metadata,omitempty"`
61         Items           []ProviderNetwork `json:"items"`
62 }
63
64 func init() {
65         SchemeBuilder.Register(&ProviderNetwork{}, &ProviderNetworkList{})
66 }