/
kvm_types.go
120 lines (97 loc) · 3.42 KB
/
kvm_types.go
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
package v1alpha1
import (
"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/giantswarm/apiextensions/pkg/crd"
"github.com/giantswarm/apiextensions/pkg/serialization"
)
const (
kindKVMConfig = "KVMConfig"
)
func NewKVMConfigCRD() *v1beta1.CustomResourceDefinition {
return crd.LoadV1Beta1(group, kindKVMConfig)
}
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:storageversion
// +kubebuilder:subresource:status
// +kubebuilder:resource:categories=giantswarm;kvm
type KVMConfig struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"`
Spec KVMConfigSpec `json:"spec"`
// +kubebuilder:validation:Optional
Status KVMConfigStatus `json:"status"`
}
type KVMConfigSpec struct {
Cluster Cluster `json:"cluster"`
KVM KVMConfigSpecKVM `json:"kvm"`
VersionBundle KVMConfigSpecVersionBundle `json:"versionBundle"`
}
type KVMConfigSpecKVM struct {
EndpointUpdater KVMConfigSpecKVMEndpointUpdater `json:"endpointUpdater"`
K8sKVM KVMConfigSpecKVMK8sKVM `json:"k8sKVM" `
Masters []KVMConfigSpecKVMNode `json:"masters"`
Network KVMConfigSpecKVMNetwork `json:"network"`
// NOTE THIS IS DEPRECATED
NodeController KVMConfigSpecKVMNodeController `json:"nodeController"`
PortMappings []KVMConfigSpecKVMPortMappings `json:"portMappings"`
Workers []KVMConfigSpecKVMNode `json:"workers"`
}
type KVMConfigSpecKVMEndpointUpdater struct {
Docker KVMConfigSpecKVMEndpointUpdaterDocker `json:"docker"`
}
type KVMConfigSpecKVMEndpointUpdaterDocker struct {
Image string `json:"image"`
}
type KVMConfigSpecKVMK8sKVM struct {
Docker KVMConfigSpecKVMK8sKVMDocker `json:"docker"`
StorageType string `json:"storageType"`
}
type KVMConfigSpecKVMK8sKVMDocker struct {
Image string `json:"image"`
}
type KVMConfigSpecKVMNode struct {
CPUs int `json:"cpus"`
Disk serialization.Float `json:"disk"`
Memory string `json:"memory"`
DockerVolumeSizeGB int `json:"dockerVolumeSizeGB"`
}
type KVMConfigSpecKVMNetwork struct {
Flannel KVMConfigSpecKVMNetworkFlannel `json:"flannel"`
}
type KVMConfigSpecKVMNetworkFlannel struct {
VNI int `json:"vni"`
}
// NOTE THIS IS DEPRECATED
type KVMConfigSpecKVMNodeController struct {
Docker KVMConfigSpecKVMNodeControllerDocker `json:"docker"`
}
// NOTE THIS IS DEPRECATED
type KVMConfigSpecKVMNodeControllerDocker struct {
Image string `json:"image"`
}
type KVMConfigSpecKVMPortMappings struct {
Name string `json:"name"`
NodePort int `json:"nodePort"`
TargetPort int `json:"targetPort"`
}
type KVMConfigSpecVersionBundle struct {
Version string `json:"version"`
}
type KVMConfigStatus struct {
Cluster StatusCluster `json:"cluster"`
KVM KVMConfigStatusKVM `json:"kvm"`
}
type KVMConfigStatusKVM struct {
// +kubebuilder:validation:Optional
// +nullable
// NodeIndexes is a map from nodeID -> nodeIndex. This is used to create deterministic iSCSI initiator names.
NodeIndexes map[string]int `json:"nodeIndexes"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type KVMConfigList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []KVMConfig `json:"items"`
}