-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a --force-conflicts flag to force annotation updates (#70)
Issue: PGO-39
- Loading branch information
1 parent
9a8503c
commit a7009c6
Showing
6 changed files
with
111 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
testing/kuttl/e2e/backup/12--backup-with-force-conflicts.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
commands: | ||
- script: | | ||
pgbackrest_backup_annotation() { | ||
kubectl get --namespace "${NAMESPACE}" postgrescluster/backup-cluster \ | ||
--output 'go-template={{ index .metadata.annotations "postgres-operator.crunchydata.com/pgbackrest-backup" }}' | ||
} | ||
kubectl --namespace "${NAMESPACE}" annotate postgrescluster/backup-cluster \ | ||
postgres-operator.crunchydata.com/pgbackrest-backup="$(date)" --overwrite || exit | ||
PRIOR=$(pgbackrest_backup_annotation) | ||
RESULT=$(kubectl-pgo --namespace "${NAMESPACE}" backup backup-cluster --force-conflicts) | ||
CURRENT=$(pgbackrest_backup_annotation) | ||
if [ "${CURRENT}" = "${PRIOR}" ]; then | ||
printf 'Expected annotation to change, got %q' "${CURRENT}" | ||
exit 1 | ||
fi | ||
echo "RESULT from taking backup: ${RESULT}" | ||
if [[ -n $RESULT && "$RESULT" == "postgresclusters/backup-cluster backup initiated" ]]; then | ||
exit 0 | ||
fi | ||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
commands: | ||
- script: | | ||
pgbackrest_restore_annotation() { | ||
kubectl --namespace "${NAMESPACE}" get postgrescluster/restore-cluster \ | ||
--output "jsonpath-as-json={.metadata.annotations['postgres-operator\.crunchydata\.com/pgbackrest-restore']}" | ||
} | ||
kubectl --namespace "${NAMESPACE}" annotate postgrescluster/restore-cluster \ | ||
postgres-operator.crunchydata.com/pgbackrest-restore="$(date)" --overwrite || exit | ||
PRIOR=$(pgbackrest_restore_annotation) | ||
# Running restore will update the annotation. | ||
echo yes | kubectl-pgo --namespace="${NAMESPACE}" restore restore-cluster --options="--db-include=restore-cluster" --repoName="repo2" --force-conflicts | ||
CURRENT=$(pgbackrest_restore_annotation) | ||
if [ "${CURRENT}" != "${PRIOR}" ]; then | ||
exit 0 | ||
fi | ||
printf 'Expected annotation to change, got PRIOR %q CURRENT %q' "${PRIOR}" "${CURRENT}" | ||
echo "RESULT from taking restore: ${RESULT}" | ||
exit 1 |