Skip to content

Commit

Permalink
K8SPG-619: fix applying backoffLimit for backup jobs (#1024)
Browse files Browse the repository at this point in the history
  • Loading branch information
pooknull and hors authored Jan 28, 2025
1 parent a8405e5 commit 04948b2
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 1 deletion.
2 changes: 2 additions & 0 deletions e2e-tests/tests/demand-backup/01-create-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ commands:
| yq '.spec.backups.pgbackrest.global.repo1-retention-full-type="count"' \
| yq '.spec.backups.pgbackrest.global.repo3-retention-full="2"' \
| yq '.spec.backups.pgbackrest.global.repo3-retention-full-type="count"' \
| yq '.spec.backups.pgbackrest.jobs.backoffLimit=20' \
| yq '.spec.backups.pgbackrest.jobs.restartPolicy="OnFailure"' \
| kubectl -n "${NAMESPACE}" apply -f -
64 changes: 64 additions & 0 deletions e2e-tests/tests/demand-backup/04-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,70 @@ metadata:
kind: PerconaPGBackup
controller: true
blockOwnerDeletion: true
spec:
backoffLimit: 20
template:
metadata:
annotations:
postgres-operator.crunchydata.com/pgbackrest-backup: demand-backup-full-s3
spec:
containers:
- command:
- /opt/crunchy/bin/pgbackrest
imagePullPolicy: Always
name: pgbackrest
resources: {}
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
privileged: false
readOnlyRootFilesystem: true
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /etc/pgbackrest/conf.d
name: pgbackrest-config
readOnly: true
dnsPolicy: ClusterFirst
enableServiceLinks: false
restartPolicy: OnFailure
schedulerName: default-scheduler
securityContext:
fsGroupChangePolicy: OnRootMismatch
serviceAccount: demand-backup-pgbackrest
serviceAccountName: demand-backup-pgbackrest
terminationGracePeriodSeconds: 30
volumes:
- name: pgbackrest-config
projected:
defaultMode: 420
sources:
- secret:
name: demand-backup-pgbackrest-secrets
- configMap:
items:
- key: pgbackrest_repo.conf
path: pgbackrest_repo.conf
- key: config-hash
path: config-hash
- key: pgbackrest-server.conf
path: ~postgres-operator_server.conf
name: demand-backup-pgbackrest-config
- secret:
items:
- key: pgbackrest.ca-roots
path: ~postgres-operator/tls-ca.crt
- key: pgbackrest-client.crt
path: ~postgres-operator/client-tls.crt
- key: pgbackrest-client.key
mode: 384
path: ~postgres-operator/client-tls.key
name: demand-backup-pgbackrest
status:
succeeded: 1
---
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/postgrescluster/pgbackrest.go
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ func generateBackupJobSpecIntent(ctx context.Context, postgresCluster *v1beta1.P
jobSpec.Template.Spec.RestartPolicy = postgresCluster.Spec.Backups.PGBackRest.Jobs.RestartPolicy
}
// K8SPG-619
if jobSpec.BackoffLimit != nil {
if postgresCluster.Spec.Backups.PGBackRest.Jobs.BackoffLimit != nil {
jobSpec.BackoffLimit = postgresCluster.Spec.Backups.PGBackRest.Jobs.BackoffLimit
}
}
Expand Down

0 comments on commit 04948b2

Please sign in to comment.