add cluster hash prefix to backup job name
DELETE
e2e-tests/scheduled-backup/compare/cronjob_each-min-pvc-oc.yml
-apiVersion: batch/v1beta1
-kind: CronJob
-metadata:
- annotations:
- testName: scheduled-backup
- labels:
- backupWorker: "True"
- cluster: scheduled-backup
- schedule: N_N_N_N_N
- type: cron
- name: each-min-pvc
- ownerReferences:
- - controller: true
- kind: PerconaXtraDBCluster
- name: scheduled-backup
-spec:
- concurrencyPolicy: Allow
- failedJobsHistoryLimit: 1
- jobTemplate:
- metadata:
- ownerReferences:
- - apiVersion: batch/v1beta1
- kind: CronJob
- name: each-min-pvc
- spec:
- template:
- metadata:
- annotations:
- testName: scheduled-backup
- labels:
- backupWorker: "True"
- cluster: scheduled-backup
- schedule: N_N_N_N_N
- type: cron
- spec:
- affinity:
- nodeAffinity:
- requiredDuringSchedulingIgnoredDuringExecution:
- nodeSelectorTerms:
- - matchExpressions:
- - key: backupWorker
- operator: In
- values:
- - "True"
- containers:
- - args:
- - sh
- - -c
- - "\n\t\t\t\t\t\t\tcat <<-EOF | kubectl apply -f -\n\t\t\t\t\t\t\t\t\tapiVersion: pxc.percona.com/v1\n\t\t\t\t\t\t\t\t\tkind: PerconaXtraDBClusterBackup\n\t\t\t\t\t\t\t\t\tmetadata:\n\t\t\t\t\t\t\t\t\t name: \"cron-${pxcCluster:0:16}-pvc-$(date -u \"+%Y%m%d%H%M%S\")-${suffix}\"\n\t\t\t\t\t\t\t\t\t labels:\n\t\t\t\t\t\t\t\t\t ancestor: \"each-min-pvc\"\n\t\t\t\t\t\t\t\t\t cluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t type: \"cron\"\n\t\t\t\t\t\t\t\t\tspec:\n\t\t\t\t\t\t\t\t\t pxcCluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t storageName: \"pvc\"\n\t\t\t\t\t\t\tEOF\n\t\t\t\t\t\t\t"
- env:
- - name: pxcCluster
- value: scheduled-backup
- imagePullPolicy: Always
- name: run-backup
- resources:
- requests:
- cpu: 600m
- memory: 1G
- terminationMessagePath: /dev/termination-log
- terminationMessagePolicy: File
- dnsPolicy: ClusterFirst
- nodeSelector:
- backupWorker: "True"
- priorityClassName: high-priority
- restartPolicy: Never
- schedulerName: default-scheduler
- securityContext:
- supplementalGroups:
- - 1001
- serviceAccount: percona-xtradb-cluster-operator
- serviceAccountName: percona-xtradb-cluster-operator
- terminationGracePeriodSeconds: 30
- tolerations:
- - effect: NoSchedule
- key: backupWorker
- operator: Equal
- value: "True"
- schedule: '* * * * *'
- successfulJobsHistoryLimit: 1
- suspend: false

DELETE
e2e-tests/scheduled-backup/compare/cronjob_each-min-pvc.yml
-apiVersion: batch/v1beta1
-kind: CronJob
-metadata:
- annotations:
- testName: scheduled-backup
- labels:
- backupWorker: "True"
- cluster: scheduled-backup
- schedule: N_N_N_N_N
- type: cron
- name: each-min-pvc
- ownerReferences:
- - controller: true
- kind: PerconaXtraDBCluster
- name: scheduled-backup
-spec:
- concurrencyPolicy: Allow
- failedJobsHistoryLimit: 1
- jobTemplate:
- metadata:
- ownerReferences:
- - apiVersion: batch/v1beta1
- kind: CronJob
- name: each-min-pvc
- spec:
- template:
- metadata:
- annotations:
- testName: scheduled-backup
- labels:
- backupWorker: "True"
- cluster: scheduled-backup
- schedule: N_N_N_N_N
- type: cron
- spec:
- affinity:
- nodeAffinity:
- requiredDuringSchedulingIgnoredDuringExecution:
- nodeSelectorTerms:
- - matchExpressions:
- - key: backupWorker
- operator: In
- values:
- - "True"
- containers:
- - args:
- - sh
- - -c
- - "\n\t\t\t\t\t\t\tcat <<-EOF | kubectl apply -f -\n\t\t\t\t\t\t\t\t\tapiVersion: pxc.percona.com/v1\n\t\t\t\t\t\t\t\t\tkind: PerconaXtraDBClusterBackup\n\t\t\t\t\t\t\t\t\tmetadata:\n\t\t\t\t\t\t\t\t\t name: \"cron-${pxcCluster:0:16}-pvc-$(date -u \"+%Y%m%d%H%M%S\")-${suffix}\"\n\t\t\t\t\t\t\t\t\t labels:\n\t\t\t\t\t\t\t\t\t ancestor: \"each-min-pvc\"\n\t\t\t\t\t\t\t\t\t cluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t type: \"cron\"\n\t\t\t\t\t\t\t\t\tspec:\n\t\t\t\t\t\t\t\t\t pxcCluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t storageName: \"pvc\"\n\t\t\t\t\t\t\tEOF\n\t\t\t\t\t\t\t"
- env:
- - name: pxcCluster
- value: scheduled-backup
- imagePullPolicy: Always
- name: run-backup
- resources:
- requests:
- cpu: 600m
- memory: 1G
- terminationMessagePath: /dev/termination-log
- terminationMessagePolicy: File
- dnsPolicy: ClusterFirst
- nodeSelector:
- backupWorker: "True"
- priorityClassName: high-priority
- restartPolicy: Never
- schedulerName: default-scheduler
- securityContext:
- fsGroup: 1001
- supplementalGroups:
- - 1001
- serviceAccount: percona-xtradb-cluster-operator
- serviceAccountName: percona-xtradb-cluster-operator
- terminationGracePeriodSeconds: 30
- tolerations:
- - effect: NoSchedule
- key: backupWorker
- operator: Equal
- value: "True"
- schedule: '* * * * *'
- successfulJobsHistoryLimit: 1
- suspend: false

ADD
e2e-tests/scheduled-backup/compare/cronjob_f875c-each-min-aws-s3-oc.yml
+apiVersion: batch/v1beta1
+kind: CronJob
+metadata:
+ annotations:
+ testName: scheduled-backup
+ labels:
+ backupWorker: "True"
+ cluster: scheduled-backup
+ schedule: N_N_N_N_N
+ type: cron
+ name: f875c-each-min-aws-s3
+ ownerReferences:
+ - controller: true
+ kind: PerconaXtraDBCluster
+ name: scheduled-backup
+spec:
+ concurrencyPolicy: Allow
+ failedJobsHistoryLimit: 1
+ jobTemplate:
+ metadata:
+ ownerReferences:
+ - apiVersion: batch/v1beta1
+ kind: CronJob
+ name: f875c-each-min-aws-s3
+ spec:
+ template:
+ metadata:
+ annotations:
+ testName: scheduled-backup
+ labels:
+ backupWorker: "True"
+ cluster: scheduled-backup
+ schedule: N_N_N_N_N
+ type: cron
+ spec:
+ affinity:
+ nodeAffinity:
+ requiredDuringSchedulingIgnoredDuringExecution:
+ nodeSelectorTerms:
+ - matchExpressions:
+ - key: backupWorker
+ operator: In
+ values:
+ - "True"
+ containers:
+ - args:
+ - sh
+ - -c
+ - "\n\t\t\t\t\t\t\tcat <<-EOF | kubectl apply -f -\n\t\t\t\t\t\t\t\t\tapiVersion: pxc.percona.com/v1\n\t\t\t\t\t\t\t\t\tkind: PerconaXtraDBClusterBackup\n\t\t\t\t\t\t\t\t\tmetadata:\n\t\t\t\t\t\t\t\t\t name: \"cron-${pxcCluster:0:16}-aws-s3-$(date -u \"+%Y%m%d%H%M%S\")-${suffix}\"\n\t\t\t\t\t\t\t\t\t labels:\n\t\t\t\t\t\t\t\t\t ancestor: \"f875c-each-min-aws-s3\"\n\t\t\t\t\t\t\t\t\t cluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t type: \"cron\"\n\t\t\t\t\t\t\t\t\tspec:\n\t\t\t\t\t\t\t\t\t pxcCluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t storageName: \"aws-s3\"\n\t\t\t\t\t\t\tEOF\n\t\t\t\t\t\t\t"
+ env:
+ - name: pxcCluster
+ value: scheduled-backup
+ imagePullPolicy: Always
+ name: run-backup
+ resources:
+ requests:
+ cpu: 600m
+ memory: 1G
+ terminationMessagePath: /dev/termination-log
+ terminationMessagePolicy: File
+ dnsPolicy: ClusterFirst
+ nodeSelector:
+ backupWorker: "True"
+ priorityClassName: high-priority
+ restartPolicy: Never
+ schedulerName: default-scheduler
+ securityContext:
+ supplementalGroups:
+ - 1001
+ serviceAccount: percona-xtradb-cluster-operator
+ serviceAccountName: percona-xtradb-cluster-operator
+ terminationGracePeriodSeconds: 30
+ tolerations:
+ - effect: NoSchedule
+ key: backupWorker
+ operator: Equal
+ value: "True"
+ schedule: '* * * * *'
+ successfulJobsHistoryLimit: 1
+ suspend: false

ADD
e2e-tests/scheduled-backup/compare/cronjob_f875c-each-min-aws-s3.yml
+apiVersion: batch/v1beta1
+kind: CronJob
+metadata:
+ annotations:
+ testName: scheduled-backup
+ labels:
+ backupWorker: "True"
+ cluster: scheduled-backup
+ schedule: N_N_N_N_N
+ type: cron
+ name: f875c-each-min-aws-s3
+ ownerReferences:
+ - controller: true
+ kind: PerconaXtraDBCluster
+ name: scheduled-backup
+spec:
+ concurrencyPolicy: Allow
+ failedJobsHistoryLimit: 1
+ jobTemplate:
+ metadata:
+ ownerReferences:
+ - apiVersion: batch/v1beta1
+ kind: CronJob
+ name: f875c-each-min-aws-s3
+ spec:
+ template:
+ metadata:
+ annotations:
+ testName: scheduled-backup
+ labels:
+ backupWorker: "True"
+ cluster: scheduled-backup
+ schedule: N_N_N_N_N
+ type: cron
+ spec:
+ affinity:
+ nodeAffinity:
+ requiredDuringSchedulingIgnoredDuringExecution:
+ nodeSelectorTerms:
+ - matchExpressions:
+ - key: backupWorker
+ operator: In
+ values:
+ - "True"
+ containers:
+ - args:
+ - sh
+ - -c
+ - "\n\t\t\t\t\t\t\tcat <<-EOF | kubectl apply -f -\n\t\t\t\t\t\t\t\t\tapiVersion: pxc.percona.com/v1\n\t\t\t\t\t\t\t\t\tkind: PerconaXtraDBClusterBackup\n\t\t\t\t\t\t\t\t\tmetadata:\n\t\t\t\t\t\t\t\t\t name: \"cron-${pxcCluster:0:16}-aws-s3-$(date -u \"+%Y%m%d%H%M%S\")-${suffix}\"\n\t\t\t\t\t\t\t\t\t labels:\n\t\t\t\t\t\t\t\t\t ancestor: \"f875c-each-min-aws-s3\"\n\t\t\t\t\t\t\t\t\t cluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t type: \"cron\"\n\t\t\t\t\t\t\t\t\tspec:\n\t\t\t\t\t\t\t\t\t pxcCluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t storageName: \"aws-s3\"\n\t\t\t\t\t\t\tEOF\n\t\t\t\t\t\t\t"
+ env:
+ - name: pxcCluster
+ value: scheduled-backup
+ imagePullPolicy: Always
+ name: run-backup
+ resources:
+ requests:
+ cpu: 600m
+ memory: 1G
+ terminationMessagePath: /dev/termination-log
+ terminationMessagePolicy: File
+ dnsPolicy: ClusterFirst
+ nodeSelector:
+ backupWorker: "True"
+ priorityClassName: high-priority
+ restartPolicy: Never
+ schedulerName: default-scheduler
+ securityContext:
+ fsGroup: 1001
+ supplementalGroups:
+ - 1001
+ serviceAccount: percona-xtradb-cluster-operator
+ serviceAccountName: percona-xtradb-cluster-operator
+ terminationGracePeriodSeconds: 30
+ tolerations:
+ - effect: NoSchedule
+ key: backupWorker
+ operator: Equal
+ value: "True"
+ schedule: '* * * * *'
+ successfulJobsHistoryLimit: 1
+ suspend: false

RENAME
e2e-tests/scheduled-backup/compare/cronjob_each-min-gcp-cs-oc.yml
e2e-tests/scheduled-backup/compare/cronjob_f875c-each-min-gcp-cs-oc.yml
@@ -8,7 +8,7 @@ metadata:
cluster: scheduled-backup
schedule: N_N_N_N_N
type: cron
- name: each-min-gcp-cs
+ name: f875c-each-min-gcp-cs
ownerReferences:
- controller: true
kind: PerconaXtraDBCluster
@@ -21,7 +21,7 @@ spec:
ownerReferences:
- apiVersion: batch/v1beta1
kind: CronJob
- name: each-min-gcp-cs
+ name: f875c-each-min-gcp-cs
spec:
template:
metadata:
@@ -46,7 +46,7 @@ spec:
- args:
- sh
- -c
- - "\n\t\t\t\t\t\t\tcat <<-EOF | kubectl apply -f -\n\t\t\t\t\t\t\t\t\tapiVersion: pxc.percona.com/v1\n\t\t\t\t\t\t\t\t\tkind: PerconaXtraDBClusterBackup\n\t\t\t\t\t\t\t\t\tmetadata:\n\t\t\t\t\t\t\t\t\t name: \"cron-${pxcCluster:0:16}-gcp-cs-$(date -u \"+%Y%m%d%H%M%S\")-${suffix}\"\n\t\t\t\t\t\t\t\t\t labels:\n\t\t\t\t\t\t\t\t\t ancestor: \"each-min-gcp-cs\"\n\t\t\t\t\t\t\t\t\t cluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t type: \"cron\"\n\t\t\t\t\t\t\t\t\tspec:\n\t\t\t\t\t\t\t\t\t pxcCluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t storageName: \"gcp-cs\"\n\t\t\t\t\t\t\tEOF\n\t\t\t\t\t\t\t"
+ - "\n\t\t\t\t\t\t\tcat <<-EOF | kubectl apply -f -\n\t\t\t\t\t\t\t\t\tapiVersion: pxc.percona.com/v1\n\t\t\t\t\t\t\t\t\tkind: PerconaXtraDBClusterBackup\n\t\t\t\t\t\t\t\t\tmetadata:\n\t\t\t\t\t\t\t\t\t name: \"cron-${pxcCluster:0:16}-gcp-cs-$(date -u \"+%Y%m%d%H%M%S\")-${suffix}\"\n\t\t\t\t\t\t\t\t\t labels:\n\t\t\t\t\t\t\t\t\t ancestor: \"f875c-each-min-gcp-cs\"\n\t\t\t\t\t\t\t\t\t cluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t type: \"cron\"\n\t\t\t\t\t\t\t\t\tspec:\n\t\t\t\t\t\t\t\t\t pxcCluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t storageName: \"gcp-cs\"\n\t\t\t\t\t\t\tEOF\n\t\t\t\t\t\t\t"
env:
- name: pxcCluster
value: scheduled-backup

RENAME
e2e-tests/scheduled-backup/compare/cronjob_each-min-gcp-cs.yml
e2e-tests/scheduled-backup/compare/cronjob_f875c-each-min-gcp-cs.yml
@@ -8,7 +8,7 @@ metadata:
cluster: scheduled-backup
schedule: N_N_N_N_N
type: cron
- name: each-min-gcp-cs
+ name: f875c-each-min-gcp-cs
ownerReferences:
- controller: true
kind: PerconaXtraDBCluster
@@ -21,7 +21,7 @@ spec:
ownerReferences:
- apiVersion: batch/v1beta1
kind: CronJob
- name: each-min-gcp-cs
+ name: f875c-each-min-gcp-cs
spec:
template:
metadata:
@@ -46,7 +46,7 @@ spec:
- args:
- sh
- -c
- - "\n\t\t\t\t\t\t\tcat <<-EOF | kubectl apply -f -\n\t\t\t\t\t\t\t\t\tapiVersion: pxc.percona.com/v1\n\t\t\t\t\t\t\t\t\tkind: PerconaXtraDBClusterBackup\n\t\t\t\t\t\t\t\t\tmetadata:\n\t\t\t\t\t\t\t\t\t name: \"cron-${pxcCluster:0:16}-gcp-cs-$(date -u \"+%Y%m%d%H%M%S\")-${suffix}\"\n\t\t\t\t\t\t\t\t\t labels:\n\t\t\t\t\t\t\t\t\t ancestor: \"each-min-gcp-cs\"\n\t\t\t\t\t\t\t\t\t cluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t type: \"cron\"\n\t\t\t\t\t\t\t\t\tspec:\n\t\t\t\t\t\t\t\t\t pxcCluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t storageName: \"gcp-cs\"\n\t\t\t\t\t\t\tEOF\n\t\t\t\t\t\t\t"
+ - "\n\t\t\t\t\t\t\tcat <<-EOF | kubectl apply -f -\n\t\t\t\t\t\t\t\t\tapiVersion: pxc.percona.com/v1\n\t\t\t\t\t\t\t\t\tkind: PerconaXtraDBClusterBackup\n\t\t\t\t\t\t\t\t\tmetadata:\n\t\t\t\t\t\t\t\t\t name: \"cron-${pxcCluster:0:16}-gcp-cs-$(date -u \"+%Y%m%d%H%M%S\")-${suffix}\"\n\t\t\t\t\t\t\t\t\t labels:\n\t\t\t\t\t\t\t\t\t ancestor: \"f875c-each-min-gcp-cs\"\n\t\t\t\t\t\t\t\t\t cluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t type: \"cron\"\n\t\t\t\t\t\t\t\t\tspec:\n\t\t\t\t\t\t\t\t\t pxcCluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t storageName: \"gcp-cs\"\n\t\t\t\t\t\t\tEOF\n\t\t\t\t\t\t\t"
env:
- name: pxcCluster
value: scheduled-backup

RENAME
e2e-tests/scheduled-backup/compare/cronjob_each-min-minio-oc.yml
e2e-tests/scheduled-backup/compare/cronjob_f875c-each-min-minio-oc.yml
@@ -8,7 +8,7 @@ metadata:
cluster: scheduled-backup
schedule: N_N_N_N_N
type: cron
- name: each-min-minio
+ name: f875c-each-min-minio
ownerReferences:
- controller: true
kind: PerconaXtraDBCluster
@@ -21,7 +21,7 @@ spec:
ownerReferences:
- apiVersion: batch/v1beta1
kind: CronJob
- name: each-min-minio
+ name: f875c-each-min-minio
spec:
template:
metadata:
@@ -46,7 +46,7 @@ spec:
- args:
- sh
- -c
- - "\n\t\t\t\t\t\t\tcat <<-EOF | kubectl apply -f -\n\t\t\t\t\t\t\t\t\tapiVersion: pxc.percona.com/v1\n\t\t\t\t\t\t\t\t\tkind: PerconaXtraDBClusterBackup\n\t\t\t\t\t\t\t\t\tmetadata:\n\t\t\t\t\t\t\t\t\t name: \"cron-${pxcCluster:0:16}-minio-$(date -u \"+%Y%m%d%H%M%S\")-${suffix}\"\n\t\t\t\t\t\t\t\t\t labels:\n\t\t\t\t\t\t\t\t\t ancestor: \"each-min-minio\"\n\t\t\t\t\t\t\t\t\t cluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t type: \"cron\"\n\t\t\t\t\t\t\t\t\tspec:\n\t\t\t\t\t\t\t\t\t pxcCluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t storageName: \"minio\"\n\t\t\t\t\t\t\tEOF\n\t\t\t\t\t\t\t"
+ - "\n\t\t\t\t\t\t\tcat <<-EOF | kubectl apply -f -\n\t\t\t\t\t\t\t\t\tapiVersion: pxc.percona.com/v1\n\t\t\t\t\t\t\t\t\tkind: PerconaXtraDBClusterBackup\n\t\t\t\t\t\t\t\t\tmetadata:\n\t\t\t\t\t\t\t\t\t name: \"cron-${pxcCluster:0:16}-minio-$(date -u \"+%Y%m%d%H%M%S\")-${suffix}\"\n\t\t\t\t\t\t\t\t\t labels:\n\t\t\t\t\t\t\t\t\t ancestor: \"f875c-each-min-minio\"\n\t\t\t\t\t\t\t\t\t cluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t type: \"cron\"\n\t\t\t\t\t\t\t\t\tspec:\n\t\t\t\t\t\t\t\t\t pxcCluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t storageName: \"minio\"\n\t\t\t\t\t\t\tEOF\n\t\t\t\t\t\t\t"
env:
- name: pxcCluster
value: scheduled-backup

RENAME
e2e-tests/scheduled-backup/compare/cronjob_each-min-minio.yml
e2e-tests/scheduled-backup/compare/cronjob_f875c-each-min-minio.yml
@@ -8,7 +8,7 @@ metadata:
cluster: scheduled-backup
schedule: N_N_N_N_N
type: cron
- name: each-min-minio
+ name: f875c-each-min-minio
ownerReferences:
- controller: true
kind: PerconaXtraDBCluster
@@ -21,7 +21,7 @@ spec:
ownerReferences:
- apiVersion: batch/v1beta1
kind: CronJob
- name: each-min-minio
+ name: f875c-each-min-minio
spec:
template:
metadata:
@@ -46,7 +46,7 @@ spec:
- args:
- sh
- -c
- - "\n\t\t\t\t\t\t\tcat <<-EOF | kubectl apply -f -\n\t\t\t\t\t\t\t\t\tapiVersion: pxc.percona.com/v1\n\t\t\t\t\t\t\t\t\tkind: PerconaXtraDBClusterBackup\n\t\t\t\t\t\t\t\t\tmetadata:\n\t\t\t\t\t\t\t\t\t name: \"cron-${pxcCluster:0:16}-minio-$(date -u \"+%Y%m%d%H%M%S\")-${suffix}\"\n\t\t\t\t\t\t\t\t\t labels:\n\t\t\t\t\t\t\t\t\t ancestor: \"each-min-minio\"\n\t\t\t\t\t\t\t\t\t cluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t type: \"cron\"\n\t\t\t\t\t\t\t\t\tspec:\n\t\t\t\t\t\t\t\t\t pxcCluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t storageName: \"minio\"\n\t\t\t\t\t\t\tEOF\n\t\t\t\t\t\t\t"
+ - "\n\t\t\t\t\t\t\tcat <<-EOF | kubectl apply -f -\n\t\t\t\t\t\t\t\t\tapiVersion: pxc.percona.com/v1\n\t\t\t\t\t\t\t\t\tkind: PerconaXtraDBClusterBackup\n\t\t\t\t\t\t\t\t\tmetadata:\n\t\t\t\t\t\t\t\t\t name: \"cron-${pxcCluster:0:16}-minio-$(date -u \"+%Y%m%d%H%M%S\")-${suffix}\"\n\t\t\t\t\t\t\t\t\t labels:\n\t\t\t\t\t\t\t\t\t ancestor: \"f875c-each-min-minio\"\n\t\t\t\t\t\t\t\t\t cluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t type: \"cron\"\n\t\t\t\t\t\t\t\t\tspec:\n\t\t\t\t\t\t\t\t\t pxcCluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t storageName: \"minio\"\n\t\t\t\t\t\t\tEOF\n\t\t\t\t\t\t\t"
env:
- name: pxcCluster
value: scheduled-backup

RENAME
e2e-tests/scheduled-backup/compare/cronjob_each-min-aws-s3-oc.yml
e2e-tests/scheduled-backup/compare/cronjob_f875c-each-min-pvc-oc.yml
@@ -8,7 +8,7 @@ metadata:
cluster: scheduled-backup
schedule: N_N_N_N_N
type: cron
- name: each-min-aws-s3
+ name: f875c-each-min-pvc
ownerReferences:
- controller: true
kind: PerconaXtraDBCluster
@@ -21,7 +21,7 @@ spec:
ownerReferences:
- apiVersion: batch/v1beta1
kind: CronJob
- name: each-min-aws-s3
+ name: f875c-each-min-pvc
spec:
template:
metadata:
@@ -46,7 +46,7 @@ spec:
- args:
- sh
- -c
- - "\n\t\t\t\t\t\t\tcat <<-EOF | kubectl apply -f -\n\t\t\t\t\t\t\t\t\tapiVersion: pxc.percona.com/v1\n\t\t\t\t\t\t\t\t\tkind: PerconaXtraDBClusterBackup\n\t\t\t\t\t\t\t\t\tmetadata:\n\t\t\t\t\t\t\t\t\t name: \"cron-${pxcCluster:0:16}-aws-s3-$(date -u \"+%Y%m%d%H%M%S\")-${suffix}\"\n\t\t\t\t\t\t\t\t\t labels:\n\t\t\t\t\t\t\t\t\t ancestor: \"each-min-aws-s3\"\n\t\t\t\t\t\t\t\t\t cluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t type: \"cron\"\n\t\t\t\t\t\t\t\t\tspec:\n\t\t\t\t\t\t\t\t\t pxcCluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t storageName: \"aws-s3\"\n\t\t\t\t\t\t\tEOF\n\t\t\t\t\t\t\t"
+ - "\n\t\t\t\t\t\t\tcat <<-EOF | kubectl apply -f -\n\t\t\t\t\t\t\t\t\tapiVersion: pxc.percona.com/v1\n\t\t\t\t\t\t\t\t\tkind: PerconaXtraDBClusterBackup\n\t\t\t\t\t\t\t\t\tmetadata:\n\t\t\t\t\t\t\t\t\t name: \"cron-${pxcCluster:0:16}-pvc-$(date -u \"+%Y%m%d%H%M%S\")-${suffix}\"\n\t\t\t\t\t\t\t\t\t labels:\n\t\t\t\t\t\t\t\t\t ancestor: \"f875c-each-min-pvc\"\n\t\t\t\t\t\t\t\t\t cluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t type: \"cron\"\n\t\t\t\t\t\t\t\t\tspec:\n\t\t\t\t\t\t\t\t\t pxcCluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t storageName: \"pvc\"\n\t\t\t\t\t\t\tEOF\n\t\t\t\t\t\t\t"
env:
- name: pxcCluster
value: scheduled-backup

RENAME
e2e-tests/scheduled-backup/compare/cronjob_each-min-aws-s3.yml
e2e-tests/scheduled-backup/compare/cronjob_f875c-each-min-pvc.yml
@@ -8,7 +8,7 @@ metadata:
cluster: scheduled-backup
schedule: N_N_N_N_N
type: cron
- name: each-min-aws-s3
+ name: f875c-each-min-pvc
ownerReferences:
- controller: true
kind: PerconaXtraDBCluster
@@ -21,7 +21,7 @@ spec:
ownerReferences:
- apiVersion: batch/v1beta1
kind: CronJob
- name: each-min-aws-s3
+ name: f875c-each-min-pvc
spec:
template:
metadata:
@@ -46,7 +46,7 @@ spec:
- args:
- sh
- -c
- - "\n\t\t\t\t\t\t\tcat <<-EOF | kubectl apply -f -\n\t\t\t\t\t\t\t\t\tapiVersion: pxc.percona.com/v1\n\t\t\t\t\t\t\t\t\tkind: PerconaXtraDBClusterBackup\n\t\t\t\t\t\t\t\t\tmetadata:\n\t\t\t\t\t\t\t\t\t name: \"cron-${pxcCluster:0:16}-aws-s3-$(date -u \"+%Y%m%d%H%M%S\")-${suffix}\"\n\t\t\t\t\t\t\t\t\t labels:\n\t\t\t\t\t\t\t\t\t ancestor: \"each-min-aws-s3\"\n\t\t\t\t\t\t\t\t\t cluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t type: \"cron\"\n\t\t\t\t\t\t\t\t\tspec:\n\t\t\t\t\t\t\t\t\t pxcCluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t storageName: \"aws-s3\"\n\t\t\t\t\t\t\tEOF\n\t\t\t\t\t\t\t"
+ - "\n\t\t\t\t\t\t\tcat <<-EOF | kubectl apply -f -\n\t\t\t\t\t\t\t\t\tapiVersion: pxc.percona.com/v1\n\t\t\t\t\t\t\t\t\tkind: PerconaXtraDBClusterBackup\n\t\t\t\t\t\t\t\t\tmetadata:\n\t\t\t\t\t\t\t\t\t name: \"cron-${pxcCluster:0:16}-pvc-$(date -u \"+%Y%m%d%H%M%S\")-${suffix}\"\n\t\t\t\t\t\t\t\t\t labels:\n\t\t\t\t\t\t\t\t\t ancestor: \"f875c-each-min-pvc\"\n\t\t\t\t\t\t\t\t\t cluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t type: \"cron\"\n\t\t\t\t\t\t\t\t\tspec:\n\t\t\t\t\t\t\t\t\t pxcCluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t storageName: \"pvc\"\n\t\t\t\t\t\t\tEOF\n\t\t\t\t\t\t\t"
env:
- name: pxcCluster
value: scheduled-backup

MODIFY
e2e-tests/scheduled-backup/run
e2e-tests/scheduled-backup/run
@@ -177,10 +177,10 @@ main() {
if [ -n "$OPERATOR_NS" ]; then
kubectl_bin config set-context "$(kubectl_bin config current-context)" --namespace="$OPERATOR_NS"
fi
- compare_kubectl cronjob/each-min-pvc
- compare_kubectl cronjob/each-min-aws-s3
- compare_kubectl cronjob/each-min-minio
- compare_kubectl cronjob/each-min-gcp-cs
+ compare_kubectl cronjob/f875c-each-min-pvc
+ compare_kubectl cronjob/f875c-each-min-aws-s3
+ compare_kubectl cronjob/f875c-each-min-minio
+ compare_kubectl cronjob/f875c-each-min-gcp-cs
kubectl_bin config set-context "$(kubectl_bin config current-context)" --namespace="$namespace"
sleep 300

RENAME
e2e-tests/security-context/compare/cronjob_each-hour-pvc.yml
e2e-tests/security-context/compare/cronjob_adc5a-each-hour-pvc.yml
@@ -7,7 +7,7 @@ metadata:
cluster: sec-context
schedule: 0_NE1_N_N_N
type: cron
- name: each-hour-pvc
+ name: adc5a-each-hour-pvc
ownerReferences:
- controller: true
kind: PerconaXtraDBCluster
@@ -20,7 +20,7 @@ spec:
ownerReferences:
- apiVersion: batch/v1beta1
kind: CronJob
- name: each-hour-pvc
+ name: adc5a-each-hour-pvc
spec:
template:
metadata:
@@ -35,7 +35,7 @@ spec:
- args:
- sh
- -c
- - "\n\t\t\t\t\t\t\tcat <<-EOF | kubectl apply -f -\n\t\t\t\t\t\t\t\t\tapiVersion: pxc.percona.com/v1\n\t\t\t\t\t\t\t\t\tkind: PerconaXtraDBClusterBackup\n\t\t\t\t\t\t\t\t\tmetadata:\n\t\t\t\t\t\t\t\t\t name: \"cron-${pxcCluster:0:16}-pvc-$(date -u \"+%Y%m%d%H%M%S\")-${suffix}\"\n\t\t\t\t\t\t\t\t\t labels:\n\t\t\t\t\t\t\t\t\t ancestor: \"each-hour-pvc\"\n\t\t\t\t\t\t\t\t\t cluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t type: \"cron\"\n\t\t\t\t\t\t\t\t\tspec:\n\t\t\t\t\t\t\t\t\t pxcCluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t storageName: \"pvc\"\n\t\t\t\t\t\t\tEOF\n\t\t\t\t\t\t\t"
+ - "\n\t\t\t\t\t\t\tcat <<-EOF | kubectl apply -f -\n\t\t\t\t\t\t\t\t\tapiVersion: pxc.percona.com/v1\n\t\t\t\t\t\t\t\t\tkind: PerconaXtraDBClusterBackup\n\t\t\t\t\t\t\t\t\tmetadata:\n\t\t\t\t\t\t\t\t\t name: \"cron-${pxcCluster:0:16}-pvc-$(date -u \"+%Y%m%d%H%M%S\")-${suffix}\"\n\t\t\t\t\t\t\t\t\t labels:\n\t\t\t\t\t\t\t\t\t ancestor: \"adc5a-each-hour-pvc\"\n\t\t\t\t\t\t\t\t\t cluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t type: \"cron\"\n\t\t\t\t\t\t\t\t\tspec:\n\t\t\t\t\t\t\t\t\t pxcCluster: \"${pxcCluster}\"\n\t\t\t\t\t\t\t\t\t storageName: \"pvc\"\n\t\t\t\t\t\t\tEOF\n\t\t\t\t\t\t\t"
env:
- name: pxcCluster
value: sec-context

MODIFY
e2e-tests/security-context/run
e2e-tests/security-context/run
@@ -50,7 +50,7 @@ compare_kubectl job.batch/xb-$backup
if [ -n "$OPERATOR_NS" ]; then
kubectl_bin config set-context "$(kubectl_bin config current-context)" --namespace="$OPERATOR_NS"
fi
-compare_kubectl cronjob/each-hour-pvc
+compare_kubectl cronjob/adc5a-each-hour-pvc
kubectl_bin config set-context "$(kubectl_bin config current-context)" --namespace="$namespace"
desc 'run pvc restore'

MODIFY
pkg/controller/pxc/backup.go
pkg/controller/pxc/backup.go
@@ -3,6 +3,8 @@ package pxc
import (
"container/heap"
"context"
+ "crypto/sha1"
+ "encoding/hex"
"fmt"
"reflect"
@@ -31,6 +33,7 @@ func (r *ReconcilePerconaXtraDBCluster) reconcileBackups(cr *api.PerconaXtraDBCl
if cr.Spec.Backup != nil {
bcpObj := backup.New(cr)
+ backupNamePrefix := backupJobClusterPrefix(cr.Name)
if cr.Status.Status == api.AppStateReady && cr.Spec.Backup.PITR.Enabled && !cr.Spec.Pause {
binlogCollector, err := deployment.GetBinlogCollectorDeployment(cr)
@@ -63,6 +66,7 @@ func (r *ReconcilePerconaXtraDBCluster) reconcileBackups(cr *api.PerconaXtraDBCl
}
for _, bcp := range cr.Spec.Backup.Schedule {
+ bcp.Name = backupNamePrefix + "-" + bcp.Name
backups[bcp.Name] = bcp
strg, ok := cr.Spec.Backup.Storages[bcp.StorageName]
if !ok {
@@ -138,6 +142,12 @@ func (r *ReconcilePerconaXtraDBCluster) reconcileBackups(cr *api.PerconaXtraDBCl
return nil
}
+func backupJobClusterPrefix(clusterName string) string {
+ h := sha1.New()
+ h.Write([]byte(clusterName))
+ return hex.EncodeToString(h.Sum(nil))[:5]
+}
+
// oldScheduledBackups returns list of the most old pxc-bakups that execeed `keep` limit
func (r *ReconcilePerconaXtraDBCluster) oldScheduledBackups(cr *api.PerconaXtraDBCluster, ancestor string, keep int) ([]api.PerconaXtraDBClusterBackup, error) {
bcpList := api.PerconaXtraDBClusterBackupList{}

K8SPXC-542: add cluster hash prefix to backup job name (#720)