Skip to content

Commit d1636d0

Browse files
committed
Merge remote-tracking branch 'origin/main' into K8SPS-466
2 parents bd432e5 + c2c7ea4 commit d1636d0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+5326
-391
lines changed

Jenkinsfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,10 @@ void runTest(Integer TEST_ID) {
248248

249249
void prepareNode() {
250250
sh """
251-
sudo curl -s -L -o /usr/local/bin/kubectl https://dl.k8s.io/release/\$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl && sudo chmod +x /usr/local/bin/kubectl
251+
if [ ! -f /usr/local/bin/kubectl ]; then
252+
sudo curl -s -L -o /usr/local/bin/kubectl https://dl.k8s.io/release/\$(curl -L -s https://github.com/api/repos/kubernetes/kubernetes/releases/latest | jq -r .tag_name)/bin/linux/amd64/kubectl && sudo chmod +x /usr/local/bin/kubectl
253+
fi
254+
252255
kubectl version --client --output=yaml
253256
254257
curl -fsSL https://get.helm.sh/helm-v3.18.0-linux-amd64.tar.gz | sudo tar -C /usr/local/bin --strip-components 1 -xzf - linux-amd64/helm

api/v1alpha1/perconaservermysql_types.go

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ type PerconaServerMySQLSpec struct {
6464
SecretsName string `json:"secretsName,omitempty"`
6565
SSLSecretName string `json:"sslSecretName,omitempty"`
6666
Unsafe UnsafeFlags `json:"unsafeFlags,omitempty"`
67-
InitImage string `json:"initImage,omitempty"`
6867
IgnoreAnnotations []string `json:"ignoreAnnotations,omitempty"`
6968
IgnoreLabels []string `json:"ignoreLabels,omitempty"`
7069
MySQL MySQLSpec `json:"mysql,omitempty"`
@@ -76,6 +75,16 @@ type PerconaServerMySQLSpec struct {
7675
Toolkit *ToolkitSpec `json:"toolkit,omitempty"`
7776
UpgradeOptions UpgradeOptions `json:"upgradeOptions,omitempty"`
7877
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"`
7988
}
8089

8190
type UnsafeFlags struct {
@@ -179,7 +188,10 @@ type PodSpec struct {
179188
Annotations map[string]string `json:"annotations,omitempty"`
180189
Labels map[string]string `json:"labels,omitempty"`
181190
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"`
183195

184196
Affinity *PodAffinity `json:"affinity,omitempty"`
185197
TopologySpreadConstraints []corev1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`
@@ -225,9 +237,16 @@ func (s PodSpec) GetTerminationGracePeriodSeconds() *int64 {
225237
return &gp
226238
}
227239

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
231250
}
232251

233252
type PMMSpec struct {
@@ -243,7 +262,6 @@ type PMMSpec struct {
243262
type BackupSpec struct {
244263
Enabled bool `json:"enabled,omitempty"`
245264
Image string `json:"image"`
246-
InitImage string `json:"initImage,omitempty"`
247265
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
248266
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
249267
ServiceAccountName string `json:"serviceAccountName,omitempty"`
@@ -253,6 +271,10 @@ type BackupSpec struct {
253271
BackoffLimit *int32 `json:"backoffLimit,omitempty"`
254272
PiTR PiTRSpec `json:"pitr,omitempty"`
255273
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"`
256278
}
257279

258280
type BackupSchedule struct {
@@ -265,9 +287,16 @@ type BackupSchedule struct {
265287
StorageName string `json:"storageName,omitempty"`
266288
}
267289

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
271300
}
272301

273302
type BackupStorageType string
@@ -490,7 +519,7 @@ type ServiceExpose struct {
490519
ExternalTrafficPolicy corev1.ServiceExternalTrafficPolicyType `json:"externalTrafficPolicy,omitempty"`
491520
}
492521

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.
494523
func (e *ServiceExpose) SaveOldMeta() bool {
495524
return len(e.Annotations) == 0 && len(e.Labels) == 0
496525
}

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 64 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)