Skip to content

Commit f22ef3b

Browse files
authored
Merge branch 'main' into K8SPS-400
2 parents a7d5688 + 13af0e1 commit f22ef3b

Some content is hidden

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

50 files changed

+4730
-376
lines changed

Jenkinsfile

Lines changed: 64 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://api.github.com/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
@@ -628,6 +631,66 @@ pipeline {
628631
clusterRunner('cluster7')
629632
}
630633
}
634+
stage('cluster8') {
635+
when {
636+
expression {
637+
isPRJob && needToRunTests
638+
}
639+
}
640+
agent {
641+
label 'docker-x64-min'
642+
}
643+
steps {
644+
prepareNode()
645+
unstash "sourceFILES"
646+
clusterRunner('cluster8')
647+
}
648+
}
649+
stage('cluster9') {
650+
when {
651+
expression {
652+
isPRJob && needToRunTests
653+
}
654+
}
655+
agent {
656+
label 'docker-x64-min'
657+
}
658+
steps {
659+
prepareNode()
660+
unstash "sourceFILES"
661+
clusterRunner('cluster9')
662+
}
663+
}
664+
stage('cluster10') {
665+
when {
666+
expression {
667+
isPRJob && needToRunTests
668+
}
669+
}
670+
agent {
671+
label 'docker-x64-min'
672+
}
673+
steps {
674+
prepareNode()
675+
unstash "sourceFILES"
676+
clusterRunner('cluster10')
677+
}
678+
}
679+
stage('cluster11') {
680+
when {
681+
expression {
682+
isPRJob && needToRunTests
683+
}
684+
}
685+
agent {
686+
label 'docker-x64-min'
687+
}
688+
steps {
689+
prepareNode()
690+
unstash "sourceFILES"
691+
clusterRunner('cluster11')
692+
}
693+
}
631694
}
632695
}
633696
}

api/v1alpha1/perconaservermysql_types.go

Lines changed: 38 additions & 9 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"`
@@ -209,9 +221,16 @@ func (s PodSpec) GetTerminationGracePeriodSeconds() *int64 {
209221
return &gp
210222
}
211223

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
215234
}
216235

217236
type PMMSpec struct {
@@ -227,7 +246,6 @@ type PMMSpec struct {
227246
type BackupSpec struct {
228247
Enabled bool `json:"enabled,omitempty"`
229248
Image string `json:"image"`
230-
InitImage string `json:"initImage,omitempty"`
231249
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
232250
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
233251
ServiceAccountName string `json:"serviceAccountName,omitempty"`
@@ -237,6 +255,10 @@ type BackupSpec struct {
237255
BackoffLimit *int32 `json:"backoffLimit,omitempty"`
238256
PiTR PiTRSpec `json:"pitr,omitempty"`
239257
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"`
240262
}
241263

242264
type BackupSchedule struct {
@@ -249,9 +271,16 @@ type BackupSchedule struct {
249271
StorageName string `json:"storageName,omitempty"`
250272
}
251273

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
255284
}
256285

257286
type BackupStorageType string

0 commit comments

Comments
 (0)