@@ -24,9 +24,8 @@ import (
24
24
type CollaSetConditionType string
25
25
26
26
const (
27
- CollaSetSyncPod CollaSetConditionType = "SyncPod"
28
- CollaSetScale CollaSetConditionType = "Scale"
29
- CollaSetUpdate CollaSetConditionType = "Update"
27
+ CollaSetScale CollaSetConditionType = "Scale"
28
+ CollaSetUpdate CollaSetConditionType = "Update"
30
29
)
31
30
32
31
// PersistentVolumeClaimRetentionPolicyType is a string enumeration of the policies that will determine
@@ -98,9 +97,11 @@ type CollaSetSpec struct {
98
97
// UpdateStrategy indicates the CollaSetUpdateStrategy that will be
99
98
// employed to update Pods in the CollaSet when a revision is made to
100
99
// Template.
100
+ // +optional
101
101
UpdateStrategy UpdateStrategy `json:"updateStrategy,omitempty"`
102
102
103
103
// ScaleStrategy indicates the strategy detail that will be used during pod scaling.
104
+ // +optional
104
105
ScaleStrategy ScaleStrategy `json:"scaleStrategy,omitempty"`
105
106
106
107
// Indicate the number of histories to be conserved
@@ -113,11 +114,15 @@ type ScaleStrategy struct {
113
114
// Context indicates the pool from which to allocate Pod instance ID. CollaSets are allowed to share the
114
115
// same Context. It is not allowed to change.
115
116
// Context defaults to be CollaSet's name.
117
+ // +optional
116
118
Context string `json:"context,omitempty"`
119
+
117
120
// PodToExclude indicates the pods which will be orphaned by CollaSet.
121
+ // +optional
118
122
PodToExclude []string `json:"podToExclude,omitempty"`
119
123
120
124
// PodToInclude indicates the pods which will be adapted by CollaSet.
125
+ // +optional
121
126
PodToInclude []string `json:"podToInclude,omitempty"`
122
127
123
128
// PersistentVolumeClaimRetentionPolicy describes the lifecycle of PersistentVolumeClaim
@@ -126,25 +131,33 @@ type ScaleStrategy struct {
126
131
// by deleting persistent volume claims when their CollaSet is deleted, or when their pod is scaled down.
127
132
// +optional
128
133
PersistentVolumeClaimRetentionPolicy * PersistentVolumeClaimRetentionPolicy `json:"persistentVolumeClaimRetentionPolicy,omitempty"`
134
+
135
+ // OperationDelaySeconds indicates how many seconds it should delay before operating scale.
136
+ // +optional
137
+ OperationDelaySeconds * int32 `json:"operationDelaySeconds,omitempty"`
129
138
}
130
139
131
140
type PersistentVolumeClaimRetentionPolicy struct {
132
141
// WhenDeleted specifies what happens to PVCs created from CollaSet
133
142
// VolumeClaimTemplates when the CollaSet is deleted. The default policy
134
143
// of `Delete` policy causes those PVCs to be deleted.
135
144
//`Retain` causes PVCs to not be affected by StatefulSet deletion. The
145
+ // +optional
136
146
WhenDeleted PersistentVolumeClaimRetentionPolicyType `json:"whenDeleted,omitempty"`
147
+
137
148
// WhenScaled specifies what happens to PVCs created from StatefulSet
138
149
// VolumeClaimTemplates when the StatefulSet is scaled down. The default
139
150
// policy of `Retain` causes PVCs to not be affected by a scaledown. The
140
151
// `Delete` policy causes the associated PVCs for any excess pods above
141
152
// the replica count to be deleted.
153
+ // +optional
142
154
WhenScaled PersistentVolumeClaimRetentionPolicyType `json:"whenScaled,omitempty"`
143
155
}
144
156
145
157
type ByPartition struct {
146
158
// Partition controls the update progress by indicating how many pods should be updated.
147
159
// Defaults to nil (all pods will be updated)
160
+ // +optional
148
161
Partition * int32 `json:"partition,omitempty"`
149
162
}
150
163
@@ -154,19 +167,26 @@ type ByLabel struct {
154
167
// RollingUpdateCollaSetStrategy is used to communicate parameter for rolling update.
155
168
type RollingUpdateCollaSetStrategy struct {
156
169
// ByPartition indicates the update progress is controlled by partition value.
170
+ // +optional
157
171
ByPartition * ByPartition `json:"byPartition,omitempty"`
158
172
159
173
// ByLabel indicates the update progress is controlled by attaching pod label.
174
+ // +optional
160
175
ByLabel * ByLabel `json:"byLabel,omitempty"`
161
176
}
162
177
163
178
type UpdateStrategy struct {
164
179
// RollingUpdate is used to communicate parameters when Type is RollingUpdateStatefulSetStrategyType.
180
+ // +optional
165
181
RollingUpdate * RollingUpdateCollaSetStrategy `json:"rollingUpdate,omitempty"`
166
182
167
183
// PodUpdatePolicy indicates the policy by to update pods.
168
184
// +optional
169
185
PodUpdatePolicy PodUpdateStrategyType `json:"podUpgradePolicy,omitempty"`
186
+
187
+ // OperationDelaySeconds indicates how many seconds it should delay before operating update.
188
+ // +optional
189
+ OperationDelaySeconds * int32 `json:"operationDelaySeconds,omitempty"`
170
190
}
171
191
172
192
// CollaSetStatus defines the observed state of CollaSet
@@ -177,12 +197,14 @@ type CollaSetStatus struct {
177
197
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
178
198
179
199
// CurrentRevision, if not empty, indicates the version of the CollaSet.
200
+ // +optional
180
201
CurrentRevision string `json:"currentRevision,omitempty"`
181
202
182
203
// UpdatedRevision, if not empty, indicates the version of the CollaSet currently updated.
204
+ // +optional
183
205
UpdatedRevision string `json:"updatedRevision,omitempty"`
184
206
185
- // Count of hash collisions for the DaemonSet . The DaemonSet controller
207
+ // Count of hash collisions for the CollaSet . The CollaSet controller
186
208
// uses this field as a collision avoidance mechanism when it needs to
187
209
// create the name for the newest ControllerRevision.
188
210
// +optional
@@ -201,12 +223,15 @@ type CollaSetStatus struct {
201
223
AvailableReplicas int32 `json:"availableReplicas,omitempty"`
202
224
203
225
// Replicas is the most recently observed number of replicas.
226
+ // +optional
204
227
Replicas int32 `json:"replicas,omitempty"`
205
228
206
229
// The number of pods in updated version.
230
+ // +optional
207
231
UpdatedReplicas int32 `json:"updatedReplicas,omitempty"`
208
232
209
233
// OperatingReplicas indicates the number of pods during pod ops lifecycle and not finish update-phase.
234
+ // +optional
210
235
OperatingReplicas int32 `json:"operatingReplicas,omitempty"`
211
236
212
237
// UpdatedReadyReplicas indicates the number of the pod with updated revision and ready condition
@@ -240,8 +265,8 @@ type CollaSetCondition struct {
240
265
Message string `json:"message,omitempty"`
241
266
}
242
267
243
- //+kubebuilder:object:root=true
244
- //+kubebuilder:subresource:status
268
+ // +kubebuilder:object:root=true
269
+ // +kubebuilder:subresource:status
245
270
246
271
// CollaSet is the Schema for the collasets API
247
272
// +k8s:openapi-gen=true
@@ -250,6 +275,7 @@ type CollaSetCondition struct {
250
275
// +kubebuilder:subresource:status
251
276
// +kubebuilder:printcolumn:name="DESIRED",type="integer",JSONPath=".spec.replicas",description="The desired number of pods."
252
277
// +kubebuilder:printcolumn:name="CURRENT",type="integer",JSONPath=".status.replicas",description="The number of currently all pods."
278
+ // +kubebuilder:printcolumn:name="AVAILABLE",type="integer",JSONPath=".status.availableReplicas",description="The number of pods available."
253
279
// +kubebuilder:printcolumn:name="UPDATED",type="integer",JSONPath=".status.updatedReplicas",description="The number of pods updated."
254
280
// +kubebuilder:printcolumn:name="UPDATED_READY",type="integer",JSONPath=".status.updatedReadyReplicas",description="The number of pods ready."
255
281
// +kubebuilder:printcolumn:name="UPDATED_AVAILABLE",type="integer",JSONPath=".status.updatedAvailableReplicas",description="The number of pods updated available."
0 commit comments