-
Notifications
You must be signed in to change notification settings - Fork 280
/
awsdatacenterconfig_types.go
93 lines (73 loc) · 2.51 KB
/
awsdatacenterconfig_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
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.
// AWSDatacenterConfigSpec defines the desired state of AWSDatacenterConfig.
type AWSDatacenterConfigSpec struct {
// Important: Run "make generate" to regenerate code after modifying this file
Region string `json:"region"`
AmiID string `json:"amiID"`
}
// AWSDatacenterConfigStatus defines the observed state of AWSDatacenterConfig.
type AWSDatacenterConfigStatus struct { // Important: Run "make generate" to regenerate code after modifying this file
}
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// AWSDatacenterConfig is the Schema for the AWSDatacenterConfigs API.
type AWSDatacenterConfig struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec AWSDatacenterConfigSpec `json:"spec,omitempty"`
Status AWSDatacenterConfigStatus `json:"status,omitempty"`
}
func (a *AWSDatacenterConfig) Kind() string {
return a.TypeMeta.Kind
}
func (a *AWSDatacenterConfig) ExpectedKind() string {
return AWSDatacenterKind
}
func (a *AWSDatacenterConfig) PauseReconcile() {
if a.Annotations == nil {
a.Annotations = map[string]string{}
}
a.Annotations[pausedAnnotation] = "true"
}
func (a *AWSDatacenterConfig) ClearPauseAnnotation() {
if a.Annotations != nil {
delete(a.Annotations, pausedAnnotation)
}
}
func (a *AWSDatacenterConfig) ConvertConfigToConfigGenerateStruct() *AWSDatacenterConfigGenerate {
namespace := defaultEksaNamespace
if a.Namespace != "" {
namespace = a.Namespace
}
config := &AWSDatacenterConfigGenerate{
TypeMeta: a.TypeMeta,
ObjectMeta: ObjectMeta{
Name: a.Name,
Annotations: a.Annotations,
Namespace: namespace,
},
Spec: a.Spec,
}
return config
}
// +kubebuilder:object:generate=false
// Same as AWSDatacenterConfig except stripped down for generation of yaml file during generate clusterconfig.
type AWSDatacenterConfigGenerate struct {
metav1.TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
Spec AWSDatacenterConfigSpec `json:"spec,omitempty"`
}
//+kubebuilder:object:root=true
// AWSDatacenterConfigList contains a list of AWSDatacenterConfig.
type AWSDatacenterConfigList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []AWSDatacenterConfig `json:"items"`
}
func init() {
SchemeBuilder.Register(&AWSDatacenterConfig{}, &AWSDatacenterConfigList{})
}