-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcrd_types.go
More file actions
183 lines (158 loc) · 5.7 KB
/
crd_types.go
File metadata and controls
183 lines (158 loc) · 5.7 KB
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
package main
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)
// ResourceCapsuleCRD represents a custom resource for managing versioned resource capsules
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
type ResourceCapsuleCRD struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec ResourceCapsuleCRDSpec `json:"spec,omitempty"`
Status ResourceCapsuleCRDStatus `json:"status,omitempty"`
}
// ResourceCapsuleCRDSpec defines the desired state of ResourceCapsuleCRD
type ResourceCapsuleCRDSpec struct {
// Data contains the actual resource data
Data map[string]interface{} `json:"data"`
// Version specifies the version of this resource capsule
Version string `json:"version"`
// CapsuleType specifies whether to store as ConfigMap or Secret
// +kubebuilder:validation:Enum=configmap;secret
// +kubebuilder:default=configmap
CapsuleType string `json:"capsuleType,omitempty"`
// Rollback configuration for versioning support
Rollback *RollbackConfig `json:"rollback,omitempty"`
}
// RollbackConfig defines rollback capabilities
type RollbackConfig struct {
// Enabled indicates if rollback is enabled for this capsule
// +kubebuilder:default=true
Enabled bool `json:"enabled,omitempty"`
// PreviousVersion stores the previous version for rollback
PreviousVersion string `json:"previousVersion,omitempty"`
}
// ResourceCapsuleCRDStatus defines the observed state of ResourceCapsuleCRD
type ResourceCapsuleCRDStatus struct {
// Phase represents the current lifecycle phase
// +kubebuilder:validation:Enum=Pending;Active;Failed
// +kubebuilder:default=Pending
Phase string `json:"phase,omitempty"`
// LastUpdated represents when the status was last updated
LastUpdated metav1.Time `json:"lastUpdated,omitempty"`
// Message provides additional information about the current state
Message string `json:"message,omitempty"`
}
// ResourceCapsuleCRDList contains a list of ResourceCapsuleCRD
// +kubebuilder:object:root=true
type ResourceCapsuleCRDList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ResourceCapsuleCRD `json:"items"`
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ResourceCapsuleCRD) DeepCopyInto(out *ResourceCapsuleCRD) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceCapsuleCRD.
func (in *ResourceCapsuleCRD) DeepCopy() *ResourceCapsuleCRD {
if in == nil {
return nil
}
out := new(ResourceCapsuleCRD)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ResourceCapsuleCRD) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ResourceCapsuleCRDList) DeepCopyInto(out *ResourceCapsuleCRDList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ResourceCapsuleCRD, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceCapsuleCRDList.
func (in *ResourceCapsuleCRDList) DeepCopy() *ResourceCapsuleCRDList {
if in == nil {
return nil
}
out := new(ResourceCapsuleCRDList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ResourceCapsuleCRDList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ResourceCapsuleCRDSpec) DeepCopyInto(out *ResourceCapsuleCRDSpec) {
*out = *in
if in.Data != nil {
in, out := &in.Data, &out.Data
*out = make(map[string]interface{}, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.Rollback != nil {
in, out := &in.Rollback, &out.Rollback
*out = new(RollbackConfig)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceCapsuleCRDSpec.
func (in *ResourceCapsuleCRDSpec) DeepCopy() *ResourceCapsuleCRDSpec {
if in == nil {
return nil
}
out := new(ResourceCapsuleCRDSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ResourceCapsuleCRDStatus) DeepCopyInto(out *ResourceCapsuleCRDStatus) {
*out = *in
in.LastUpdated.DeepCopyInto(&out.LastUpdated)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceCapsuleCRDStatus.
func (in *ResourceCapsuleCRDStatus) DeepCopy() *ResourceCapsuleCRDStatus {
if in == nil {
return nil
}
out := new(ResourceCapsuleCRDStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RollbackConfig) DeepCopyInto(out *RollbackConfig) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RollbackConfig.
func (in *RollbackConfig) DeepCopy() *RollbackConfig {
if in == nil {
return nil
}
out := new(RollbackConfig)
in.DeepCopyInto(out)
return out
}