@@ -63,7 +63,6 @@ type PerconaServerMySQLSpec struct {
63
63
SecretsName string `json:"secretsName,omitempty"`
64
64
SSLSecretName string `json:"sslSecretName,omitempty"`
65
65
Unsafe UnsafeFlags `json:"unsafeFlags,omitempty"`
66
- InitImage string `json:"initImage,omitempty"`
67
66
IgnoreAnnotations []string `json:"ignoreAnnotations,omitempty"`
68
67
IgnoreLabels []string `json:"ignoreLabels,omitempty"`
69
68
MySQL MySQLSpec `json:"mysql,omitempty"`
@@ -75,6 +74,16 @@ type PerconaServerMySQLSpec struct {
75
74
Toolkit * ToolkitSpec `json:"toolkit,omitempty"`
76
75
UpgradeOptions UpgradeOptions `json:"upgradeOptions,omitempty"`
77
76
UpdateStrategy appsv1.StatefulSetUpdateStrategyType `json:"updateStrategy,omitempty"`
77
+
78
+ // Deprecated: not supported since v0.12.0. Use initContainer instead
79
+ InitImage string `json:"initImage,omitempty"`
80
+ InitContainer InitContainerSpec `json:"initContainer,omitempty"`
81
+ }
82
+
83
+ type InitContainerSpec struct {
84
+ Image string `json:"image,omitempty"`
85
+ Resources * corev1.ResourceRequirements `json:"resources,omitempty"`
86
+ ContainerSecurityContext * corev1.SecurityContext `json:"containerSecurityContext,omitempty"`
78
87
}
79
88
80
89
type UnsafeFlags struct {
@@ -178,7 +187,10 @@ type PodSpec struct {
178
187
Annotations map [string ]string `json:"annotations,omitempty"`
179
188
Labels map [string ]string `json:"labels,omitempty"`
180
189
VolumeSpec * VolumeSpec `json:"volumeSpec,omitempty"`
181
- InitImage string `json:"initImage,omitempty"`
190
+
191
+ // Deprecated: not supported since v0.12.0. Use initContainer instead
192
+ InitImage string `json:"initImage,omitempty"`
193
+ InitContainer * InitContainerSpec `json:"initContainer,omitempty"`
182
194
183
195
Affinity * PodAffinity `json:"affinity,omitempty"`
184
196
TopologySpreadConstraints []corev1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`
@@ -208,9 +220,16 @@ func (s PodSpec) GetTerminationGracePeriodSeconds() *int64 {
208
220
return & gp
209
221
}
210
222
211
- // Retrieves the initialization image for the pod.
212
- func (s * PodSpec ) GetInitImage () string {
213
- return s .InitImage
223
+ func (s * PodSpec ) GetInitSpec (cr * PerconaServerMySQL ) InitContainerSpec {
224
+ if s .InitContainer == nil {
225
+ if cr .CompareVersion ("0.12.0" ) < 0 {
226
+ return InitContainerSpec {
227
+ Image : s .InitImage ,
228
+ }
229
+ }
230
+ return InitContainerSpec {}
231
+ }
232
+ return * s .InitContainer
214
233
}
215
234
216
235
type PMMSpec struct {
@@ -226,7 +245,6 @@ type PMMSpec struct {
226
245
type BackupSpec struct {
227
246
Enabled bool `json:"enabled,omitempty"`
228
247
Image string `json:"image"`
229
- InitImage string `json:"initImage,omitempty"`
230
248
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
231
249
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
232
250
ServiceAccountName string `json:"serviceAccountName,omitempty"`
@@ -236,6 +254,10 @@ type BackupSpec struct {
236
254
BackoffLimit * int32 `json:"backoffLimit,omitempty"`
237
255
PiTR PiTRSpec `json:"pitr,omitempty"`
238
256
Schedule []BackupSchedule `json:"schedule,omitempty"`
257
+
258
+ // Deprecated: not supported since v0.12.0. Use initContainer instead
259
+ InitImage string `json:"initImage,omitempty"`
260
+ InitContainer * InitContainerSpec `json:"initContainer,omitempty"`
239
261
}
240
262
241
263
type BackupSchedule struct {
@@ -248,9 +270,16 @@ type BackupSchedule struct {
248
270
StorageName string `json:"storageName,omitempty"`
249
271
}
250
272
251
- // Retrieves the initialization image for the backup.
252
- func (s * BackupSpec ) GetInitImage () string {
253
- return s .InitImage
273
+ func (s * BackupSpec ) GetInitSpec (cr * PerconaServerMySQL ) InitContainerSpec {
274
+ if s .InitContainer == nil {
275
+ if cr .CompareVersion ("0.12.0" ) < 0 {
276
+ return InitContainerSpec {
277
+ Image : s .InitImage ,
278
+ }
279
+ }
280
+ return InitContainerSpec {}
281
+ }
282
+ return * s .InitContainer
254
283
}
255
284
256
285
type BackupStorageType string
0 commit comments