-
Notifications
You must be signed in to change notification settings - Fork 278
/
dockerdatacenterconfig_types.go
99 lines (78 loc) · 2.84 KB
/
dockerdatacenterconfig_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
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.
// DockerDatacenterConfigSpec defines the desired state of DockerDatacenterConfig
type DockerDatacenterConfigSpec struct { // Important: Run "make generate" to regenerate code after modifying this file
// Foo is an example field of DockerDatacenterConfig. Edit DockerDatacenter_types.go to remove/update
// Foo string `json:"foo,omitempty"`
}
// DockerDatacenterConfigStatus defines the observed state of DockerDatacenterConfig
type DockerDatacenterConfigStatus struct { // Important: Run "make generate" to regenerate code after modifying this file
}
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// DockerDatacenterConfig is the Schema for the DockerDatacenterConfigs API
type DockerDatacenterConfig struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec DockerDatacenterConfigSpec `json:"spec,omitempty"`
Status DockerDatacenterConfigStatus `json:"status,omitempty"`
}
func (d *DockerDatacenterConfig) Kind() string {
return d.TypeMeta.Kind
}
func (d *DockerDatacenterConfig) ExpectedKind() string {
return DockerDatacenterKind
}
func (d *DockerDatacenterConfig) PauseReconcile() {
if d.Annotations == nil {
d.Annotations = map[string]string{}
}
d.Annotations[pausedAnnotation] = "true"
}
func (d *DockerDatacenterConfig) ClearPauseAnnotation() {
if d.Annotations != nil {
delete(d.Annotations, pausedAnnotation)
}
}
func (d *DockerDatacenterConfig) ConvertConfigToConfigGenerateStruct() *DockerDatacenterConfigGenerate {
namespace := defaultEksaNamespace
if d.Namespace != "" {
namespace = d.Namespace
}
config := &DockerDatacenterConfigGenerate{
TypeMeta: d.TypeMeta,
ObjectMeta: ObjectMeta{
Name: d.Name,
Annotations: d.Annotations,
Namespace: namespace,
},
Spec: d.Spec,
}
return config
}
func (d *DockerDatacenterConfig) Marshallable() Marshallable {
return d.ConvertConfigToConfigGenerateStruct()
}
func (d *DockerDatacenterConfig) Validate() error {
return nil
}
// +kubebuilder:object:generate=false
// Same as DockerDatacenterConfig except stripped down for generation of yaml file during generate clusterconfig
type DockerDatacenterConfigGenerate struct {
metav1.TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
Spec DockerDatacenterConfigSpec `json:"spec,omitempty"`
}
//+kubebuilder:object:root=true
// DockerDatacenterConfigList contains a list of DockerDatacenterConfig
type DockerDatacenterConfigList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []DockerDatacenterConfig `json:"items"`
}
func init() {
SchemeBuilder.Register(&DockerDatacenterConfig{}, &DockerDatacenterConfigList{})
}