Skip to content

Commit f236e49

Browse files
pooknullhors
andauthored
K8SPS-340: add securityContext to xtrabackup container (#656)
* K8SPS-340: add securityContext to `xtrabackup` container https://perconadev.atlassian.net/browse/K8SPS-340 * update `cr.yaml` --------- Co-authored-by: Viacheslav Sarzhan <[email protected]>
1 parent 613cb7d commit f236e49

File tree

4 files changed

+6
-0
lines changed

4 files changed

+6
-0
lines changed

deploy/cr.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,8 @@ spec:
372372
# backoffLimit: 6
373373
imagePullPolicy: Always
374374
# initImage: percona/percona-server-mysql-operator:0.8.0
375+
# containerSecurityContext:
376+
# privileged: true
375377
storages:
376378
s3-us-west:
377379
type: s3

e2e-tests/tests/gr-security-context/02-assert.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ spec:
2020
- command:
2121
- /opt/percona/sidecar
2222
name: xtrabackup
23+
securityContext:
24+
privileged: false
2325
initContainers:
2426
- command:
2527
- /opt/percona-server-mysql-operator/ps-init-entrypoint.sh

e2e-tests/tests/gr-security-context/02-create-cluster.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ commands:
1818
| yq eval '.spec.backup.storages.minio.containerSecurityContext.privileged=true' - \
1919
| yq eval '.spec.backup.storages.minio.podSecurityContext.fsGroup=1001' - \
2020
| yq eval '.spec.backup.storages.minio.podSecurityContext.supplementalGroups |= [1001, 1002, 1003]' - \
21+
| yq eval '.spec.backup.containerSecurityContext.privileged=false' - \
2122
| yq eval '.spec.mysql.clusterType="group-replication"' - \
2223
| yq eval '.spec.mysql.containerSecurityContext.privileged=true' - \
2324
| yq eval '.spec.mysql.podSecurityContext.fsGroup=1001' - \

pkg/mysql/mysql.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,7 @@ func backupContainer(cr *apiv1alpha1.PerconaServerMySQL) corev1.Container {
591591
Command: []string{"/opt/percona/sidecar"},
592592
TerminationMessagePath: "/dev/termination-log",
593593
TerminationMessagePolicy: corev1.TerminationMessageReadFile,
594+
SecurityContext: cr.Spec.Backup.ContainerSecurityContext,
594595
}
595596
}
596597

0 commit comments

Comments
 (0)