/
kvm_cluster_types.go
68 lines (56 loc) · 1.99 KB
/
kvm_cluster_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
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/giantswarm/apiextensions/v6/pkg/serialization"
)
// +genclient
// +genclient:noStatus
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:resource:categories=giantswarm;kvm
// +kubebuilder:storageversion
// +k8s:openapi-gen=true
type KVMClusterConfig struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"`
Spec KVMClusterConfigSpec `json:"spec"`
}
// +k8s:openapi-gen=true
type KVMClusterConfigSpec struct {
Guest KVMClusterConfigSpecGuest `json:"guest"`
VersionBundle KVMClusterConfigSpecVersionBundle `json:"versionBundle"`
}
// +k8s:openapi-gen=true
type KVMClusterConfigSpecGuest struct {
ClusterGuestConfig `json:",inline"`
Masters []KVMClusterConfigSpecGuestMaster `json:"masters,omitempty"`
Workers []KVMClusterConfigSpecGuestWorker `json:"workers,omitempty"`
}
// +k8s:openapi-gen=true
type KVMClusterConfigSpecGuestMaster struct {
KVMClusterConfigSpecGuestNode `json:",inline"`
}
// +k8s:openapi-gen=true
type KVMClusterConfigSpecGuestWorker struct {
KVMClusterConfigSpecGuestNode `json:",inline"`
// +kubebuilder:validation:Optional
// +nullable
Labels map[string]string `json:"labels"`
}
// TODO: change MemorySizeGB and StorageSizeGB to resource.Quantity
// +k8s:openapi-gen=true
type KVMClusterConfigSpecGuestNode struct {
ID string `json:"id"`
CPUCores int `json:"cpuCores,omitempty"`
MemorySizeGB serialization.Float `json:"memorySizeGB,omitempty"`
StorageSizeGB serialization.Float `json:"storageSizeGB,omitempty"`
}
// +k8s:openapi-gen=true
type KVMClusterConfigSpecVersionBundle struct {
Version string `json:"version"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type KVMClusterConfigList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []KVMClusterConfig `json:"items"`
}