@@ -64,7 +64,6 @@ type PerconaServerMySQLSpec struct {
64
64
SecretsName string `json:"secretsName,omitempty"`
65
65
SSLSecretName string `json:"sslSecretName,omitempty"`
66
66
Unsafe UnsafeFlags `json:"unsafeFlags,omitempty"`
67
- InitImage string `json:"initImage,omitempty"`
68
67
IgnoreAnnotations []string `json:"ignoreAnnotations,omitempty"`
69
68
IgnoreLabels []string `json:"ignoreLabels,omitempty"`
70
69
MySQL MySQLSpec `json:"mysql,omitempty"`
@@ -76,6 +75,16 @@ type PerconaServerMySQLSpec struct {
76
75
Toolkit * ToolkitSpec `json:"toolkit,omitempty"`
77
76
UpgradeOptions UpgradeOptions `json:"upgradeOptions,omitempty"`
78
77
UpdateStrategy appsv1.StatefulSetUpdateStrategyType `json:"updateStrategy,omitempty"`
78
+
79
+ // Deprecated: not supported since v0.12.0. Use initContainer instead
80
+ InitImage string `json:"initImage,omitempty"`
81
+ InitContainer InitContainerSpec `json:"initContainer,omitempty"`
82
+ }
83
+
84
+ type InitContainerSpec struct {
85
+ Image string `json:"image,omitempty"`
86
+ Resources * corev1.ResourceRequirements `json:"resources,omitempty"`
87
+ ContainerSecurityContext * corev1.SecurityContext `json:"containerSecurityContext,omitempty"`
79
88
}
80
89
81
90
type UnsafeFlags struct {
@@ -179,7 +188,10 @@ type PodSpec struct {
179
188
Annotations map [string ]string `json:"annotations,omitempty"`
180
189
Labels map [string ]string `json:"labels,omitempty"`
181
190
VolumeSpec * VolumeSpec `json:"volumeSpec,omitempty"`
182
- InitImage string `json:"initImage,omitempty"`
191
+
192
+ // Deprecated: not supported since v0.12.0. Use initContainer instead
193
+ InitImage string `json:"initImage,omitempty"`
194
+ InitContainer * InitContainerSpec `json:"initContainer,omitempty"`
183
195
184
196
Affinity * PodAffinity `json:"affinity,omitempty"`
185
197
TopologySpreadConstraints []corev1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`
@@ -225,9 +237,16 @@ func (s PodSpec) GetTerminationGracePeriodSeconds() *int64 {
225
237
return & gp
226
238
}
227
239
228
- // Retrieves the initialization image for the pod.
229
- func (s * PodSpec ) GetInitImage () string {
230
- return s .InitImage
240
+ func (s * PodSpec ) GetInitSpec (cr * PerconaServerMySQL ) InitContainerSpec {
241
+ if s .InitContainer == nil {
242
+ if cr .CompareVersion ("0.12.0" ) < 0 {
243
+ return InitContainerSpec {
244
+ Image : s .InitImage ,
245
+ }
246
+ }
247
+ return InitContainerSpec {}
248
+ }
249
+ return * s .InitContainer
231
250
}
232
251
233
252
type PMMSpec struct {
@@ -243,7 +262,6 @@ type PMMSpec struct {
243
262
type BackupSpec struct {
244
263
Enabled bool `json:"enabled,omitempty"`
245
264
Image string `json:"image"`
246
- InitImage string `json:"initImage,omitempty"`
247
265
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
248
266
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
249
267
ServiceAccountName string `json:"serviceAccountName,omitempty"`
@@ -253,6 +271,10 @@ type BackupSpec struct {
253
271
BackoffLimit * int32 `json:"backoffLimit,omitempty"`
254
272
PiTR PiTRSpec `json:"pitr,omitempty"`
255
273
Schedule []BackupSchedule `json:"schedule,omitempty"`
274
+
275
+ // Deprecated: not supported since v0.12.0. Use initContainer instead
276
+ InitImage string `json:"initImage,omitempty"`
277
+ InitContainer * InitContainerSpec `json:"initContainer,omitempty"`
256
278
}
257
279
258
280
type BackupSchedule struct {
@@ -265,9 +287,16 @@ type BackupSchedule struct {
265
287
StorageName string `json:"storageName,omitempty"`
266
288
}
267
289
268
- // Retrieves the initialization image for the backup.
269
- func (s * BackupSpec ) GetInitImage () string {
270
- return s .InitImage
290
+ func (s * BackupSpec ) GetInitSpec (cr * PerconaServerMySQL ) InitContainerSpec {
291
+ if s .InitContainer == nil {
292
+ if cr .CompareVersion ("0.12.0" ) < 0 {
293
+ return InitContainerSpec {
294
+ Image : s .InitImage ,
295
+ }
296
+ }
297
+ return InitContainerSpec {}
298
+ }
299
+ return * s .InitContainer
271
300
}
272
301
273
302
type BackupStorageType string
@@ -490,7 +519,7 @@ type ServiceExpose struct {
490
519
ExternalTrafficPolicy corev1.ServiceExternalTrafficPolicyType `json:"externalTrafficPolicy,omitempty"`
491
520
}
492
521
493
- // Determines if both annotations and labels of the service expose are empty.
522
+ // SaveOldMeta determines if both annotations and labels of the service expose are empty.
494
523
func (e * ServiceExpose ) SaveOldMeta () bool {
495
524
return len (e .Annotations ) == 0 && len (e .Labels ) == 0
496
525
}
0 commit comments