@@ -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"`
@@ -209,9 +221,16 @@ func (s PodSpec) GetTerminationGracePeriodSeconds() *int64 {
209
221
return & gp
210
222
}
211
223
212
- // Retrieves the initialization image for the pod.
213
- func (s * PodSpec ) GetInitImage () string {
214
- return s .InitImage
224
+ func (s * PodSpec ) GetInitSpec (cr * PerconaServerMySQL ) InitContainerSpec {
225
+ if s .InitContainer == nil {
226
+ if cr .CompareVersion ("0.12.0" ) < 0 {
227
+ return InitContainerSpec {
228
+ Image : s .InitImage ,
229
+ }
230
+ }
231
+ return InitContainerSpec {}
232
+ }
233
+ return * s .InitContainer
215
234
}
216
235
217
236
type PMMSpec struct {
@@ -227,7 +246,6 @@ type PMMSpec struct {
227
246
type BackupSpec struct {
228
247
Enabled bool `json:"enabled,omitempty"`
229
248
Image string `json:"image"`
230
- InitImage string `json:"initImage,omitempty"`
231
249
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
232
250
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
233
251
ServiceAccountName string `json:"serviceAccountName,omitempty"`
@@ -237,6 +255,10 @@ type BackupSpec struct {
237
255
BackoffLimit * int32 `json:"backoffLimit,omitempty"`
238
256
PiTR PiTRSpec `json:"pitr,omitempty"`
239
257
Schedule []BackupSchedule `json:"schedule,omitempty"`
258
+
259
+ // Deprecated: not supported since v0.12.0. Use initContainer instead
260
+ InitImage string `json:"initImage,omitempty"`
261
+ InitContainer * InitContainerSpec `json:"initContainer,omitempty"`
240
262
}
241
263
242
264
type BackupSchedule struct {
@@ -249,9 +271,16 @@ type BackupSchedule struct {
249
271
StorageName string `json:"storageName,omitempty"`
250
272
}
251
273
252
- // Retrieves the initialization image for the backup.
253
- func (s * BackupSpec ) GetInitImage () string {
254
- return s .InitImage
274
+ func (s * BackupSpec ) GetInitSpec (cr * PerconaServerMySQL ) InitContainerSpec {
275
+ if s .InitContainer == nil {
276
+ if cr .CompareVersion ("0.12.0" ) < 0 {
277
+ return InitContainerSpec {
278
+ Image : s .InitImage ,
279
+ }
280
+ }
281
+ return InitContainerSpec {}
282
+ }
283
+ return * s .InitContainer
255
284
}
256
285
257
286
type BackupStorageType string
0 commit comments