-
Notifications
You must be signed in to change notification settings - Fork 272
/
snowdatacenterconfig_types.go
77 lines (60 loc) 路 2.14 KB
/
snowdatacenterconfig_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
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.
// SnowDatacenterConfigSpec defines the desired state of SnowDatacenterConfig
type SnowDatacenterConfigSpec struct { // Important: Run "make generate" to regenerate code after modifying this file
}
// SnowDatacenterConfigStatus defines the observed state of SnowDatacenterConfig
type SnowDatacenterConfigStatus struct{}
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// SnowDatacenterConfig is the Schema for the SnowDatacenterConfigs API
type SnowDatacenterConfig struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec SnowDatacenterConfigSpec `json:"spec,omitempty"`
Status SnowDatacenterConfigStatus `json:"status,omitempty"`
}
func (s *SnowDatacenterConfig) Kind() string {
return s.TypeMeta.Kind
}
func (s *SnowDatacenterConfig) ExpectedKind() string {
return SnowDatacenterKind
}
func (s *SnowDatacenterConfig) PauseReconcile() {
if s.Annotations == nil {
s.Annotations = map[string]string{}
}
s.Annotations[pausedAnnotation] = "true"
}
func (s *SnowDatacenterConfig) ClearPauseAnnotation() {
if s.Annotations != nil {
delete(s.Annotations, pausedAnnotation)
}
}
func (s *SnowDatacenterConfig) ConvertConfigToConfigGenerateStruct() *SnowDatacenterConfigGenerate {
namespace := defaultEksaNamespace
if s.Namespace != "" {
namespace = s.Namespace
}
config := &SnowDatacenterConfigGenerate{
TypeMeta: s.TypeMeta,
ObjectMeta: ObjectMeta{
Name: s.Name,
Annotations: s.Annotations,
Namespace: namespace,
},
Spec: s.Spec,
}
return config
}
func (s *SnowDatacenterConfig) Marshallable() Marshallable {
return s.ConvertConfigToConfigGenerateStruct()
}
// +kubebuilder:object:generate=false
// Same as SnowDatacenterConfig except stripped down for generation of yaml file during generate clusterconfig
type SnowDatacenterConfigGenerate struct {
metav1.TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
Spec SnowDatacenterConfigSpec `json:"spec,omitempty"`
}