Skip to content

Commit 04948b2

Browse files
pooknullhors
andauthored
K8SPG-619: fix applying backoffLimit for backup jobs (#1024)
https://perconadev.atlassian.net/browse/K8SPG-619 Co-authored-by: Viacheslav Sarzhan <[email protected]>
1 parent a8405e5 commit 04948b2

File tree

3 files changed

+67
-1
lines changed

3 files changed

+67
-1
lines changed

e2e-tests/tests/demand-backup/01-create-cluster.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ commands:
1414
| yq '.spec.backups.pgbackrest.global.repo1-retention-full-type="count"' \
1515
| yq '.spec.backups.pgbackrest.global.repo3-retention-full="2"' \
1616
| yq '.spec.backups.pgbackrest.global.repo3-retention-full-type="count"' \
17+
| yq '.spec.backups.pgbackrest.jobs.backoffLimit=20' \
18+
| yq '.spec.backups.pgbackrest.jobs.restartPolicy="OnFailure"' \
1719
| kubectl -n "${NAMESPACE}" apply -f -

e2e-tests/tests/demand-backup/04-assert.yaml

+64
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,70 @@ metadata:
1515
kind: PerconaPGBackup
1616
controller: true
1717
blockOwnerDeletion: true
18+
spec:
19+
backoffLimit: 20
20+
template:
21+
metadata:
22+
annotations:
23+
postgres-operator.crunchydata.com/pgbackrest-backup: demand-backup-full-s3
24+
spec:
25+
containers:
26+
- command:
27+
- /opt/crunchy/bin/pgbackrest
28+
imagePullPolicy: Always
29+
name: pgbackrest
30+
resources: {}
31+
securityContext:
32+
allowPrivilegeEscalation: false
33+
capabilities:
34+
drop:
35+
- ALL
36+
privileged: false
37+
readOnlyRootFilesystem: true
38+
runAsNonRoot: true
39+
seccompProfile:
40+
type: RuntimeDefault
41+
terminationMessagePath: /dev/termination-log
42+
terminationMessagePolicy: File
43+
volumeMounts:
44+
- mountPath: /etc/pgbackrest/conf.d
45+
name: pgbackrest-config
46+
readOnly: true
47+
dnsPolicy: ClusterFirst
48+
enableServiceLinks: false
49+
restartPolicy: OnFailure
50+
schedulerName: default-scheduler
51+
securityContext:
52+
fsGroupChangePolicy: OnRootMismatch
53+
serviceAccount: demand-backup-pgbackrest
54+
serviceAccountName: demand-backup-pgbackrest
55+
terminationGracePeriodSeconds: 30
56+
volumes:
57+
- name: pgbackrest-config
58+
projected:
59+
defaultMode: 420
60+
sources:
61+
- secret:
62+
name: demand-backup-pgbackrest-secrets
63+
- configMap:
64+
items:
65+
- key: pgbackrest_repo.conf
66+
path: pgbackrest_repo.conf
67+
- key: config-hash
68+
path: config-hash
69+
- key: pgbackrest-server.conf
70+
path: ~postgres-operator_server.conf
71+
name: demand-backup-pgbackrest-config
72+
- secret:
73+
items:
74+
- key: pgbackrest.ca-roots
75+
path: ~postgres-operator/tls-ca.crt
76+
- key: pgbackrest-client.crt
77+
path: ~postgres-operator/client-tls.crt
78+
- key: pgbackrest-client.key
79+
mode: 384
80+
path: ~postgres-operator/client-tls.key
81+
name: demand-backup-pgbackrest
1882
status:
1983
succeeded: 1
2084
---

internal/controller/postgrescluster/pgbackrest.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ func generateBackupJobSpecIntent(ctx context.Context, postgresCluster *v1beta1.P
866866
jobSpec.Template.Spec.RestartPolicy = postgresCluster.Spec.Backups.PGBackRest.Jobs.RestartPolicy
867867
}
868868
// K8SPG-619
869-
if jobSpec.BackoffLimit != nil {
869+
if postgresCluster.Spec.Backups.PGBackRest.Jobs.BackoffLimit != nil {
870870
jobSpec.BackoffLimit = postgresCluster.Spec.Backups.PGBackRest.Jobs.BackoffLimit
871871
}
872872
}

0 commit comments

Comments
 (0)