aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/apis/k8s/v1alpha1/providernetwork_types.go
blob: 3f8444faa0ce2179ba72ff11f50b68c10790c845 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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"`
	VlanNodeSelector      string   `json:"vlanNodeSelector"`        // "all"/"any"(in which case a node will be randomly selected)/"specific"(see below)
	NodeLabelList         []string `json:"nodeLabelList,omitempty"` // if VlanNodeSelector is value "specific" then this array provides a list of nodes labels
	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{})
}