Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

K8SPG-619: fix applying backoffLimit for backup jobs #1024

Merged
merged 2 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💪🏽

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
Loading