-
Notifications
You must be signed in to change notification settings - Fork 278
/
tinkerbelldatacenterconfig_types.go
116 lines (94 loc) · 3.78 KB
/
tinkerbelldatacenterconfig_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
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// Important: Run "make generate" to regenerate code after modifying this file
// TinkerbellDatacenterConfigSpec defines the desired state of TinkerbellDatacenterConfig.
type TinkerbellDatacenterConfigSpec struct {
// TinkerbellIP is used to configure a VIP for hosting the Tinkerbell services.
TinkerbellIP string `json:"tinkerbellIP"`
// OSImageURL can be used to override the default OS image path to pull from a local server.
OSImageURL string `json:"osImageURL,omitempty"`
// HookImagesURLPath can be used to override the default Hook images path to pull from a local server.
HookImagesURLPath string `json:"hookImagesURLPath,omitempty"`
// SkipLoadBalancerDeployment when set to "true" can be used to skip deploying a load balancer to expose Tinkerbell stack.
// Users will need to deploy and configure a load balancer manually after the cluster is created.
SkipLoadBalancerDeployment bool `json:"skipLoadBalancerDeployment,omitempty"`
}
// TinkerbellDatacenterConfigStatus defines the observed state of TinkerbellDatacenterConfig
//
// Important: Run "make generate" to regenerate code after modifying this file.
type TinkerbellDatacenterConfigStatus struct{}
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// TinkerbellDatacenterConfig is the Schema for the TinkerbellDatacenterConfigs API.
type TinkerbellDatacenterConfig struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec TinkerbellDatacenterConfigSpec `json:"spec,omitempty"`
Status TinkerbellDatacenterConfigStatus `json:"status,omitempty"`
}
func (t *TinkerbellDatacenterConfig) Kind() string {
return t.TypeMeta.Kind
}
func (v *TinkerbellDatacenterConfig) ExpectedKind() string {
return TinkerbellDatacenterKind
}
func (t *TinkerbellDatacenterConfig) PauseReconcile() {
if t.Annotations == nil {
t.Annotations = map[string]string{}
}
t.Annotations[pausedAnnotation] = "true"
}
func (t *TinkerbellDatacenterConfig) IsReconcilePaused() bool {
if s, ok := t.Annotations[pausedAnnotation]; ok {
return s == "true"
}
return false
}
func (t *TinkerbellDatacenterConfig) ClearPauseAnnotation() {
if t.Annotations != nil {
delete(t.Annotations, pausedAnnotation)
}
}
// Validate validates the Tinkerbell datacenter config.
func (t *TinkerbellDatacenterConfig) Validate() error {
return validateDatacenterConfig(t)
}
func (t *TinkerbellDatacenterConfig) ConvertConfigToConfigGenerateStruct() *TinkerbellDatacenterConfigGenerate {
namespace := defaultEksaNamespace
if t.Namespace != "" {
namespace = t.Namespace
}
config := &TinkerbellDatacenterConfigGenerate{
TypeMeta: t.TypeMeta,
ObjectMeta: ObjectMeta{
Name: t.Name,
Annotations: t.Annotations,
Namespace: namespace,
},
Spec: t.Spec,
}
return config
}
func (t *TinkerbellDatacenterConfig) Marshallable() Marshallable {
return t.ConvertConfigToConfigGenerateStruct()
}
// +kubebuilder:object:generate=false
// Same as TinkerbellDatacenterConfig except stripped down for generation of yaml file during generate clusterconfig.
type TinkerbellDatacenterConfigGenerate struct {
metav1.TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
Spec TinkerbellDatacenterConfigSpec `json:"spec,omitempty"`
}
//+kubebuilder:object:root=true
// TinkerbellDatacenterConfigList contains a list of TinkerbellDatacenterConfig.
type TinkerbellDatacenterConfigList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []TinkerbellDatacenterConfig `json:"items"`
}
func init() {
SchemeBuilder.Register(&TinkerbellDatacenterConfig{}, &TinkerbellDatacenterConfigList{})
}