-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
K8SPG-260: Fix restart after upgrade (#918)
* K8SPG-260: Fix restart after upgrade * fix envtest * Add cluster restart check to upgrade-minor tests * K8SPG-643: Always try stanza-upgrade after a failed stanza-create * fix upgrade-minor test * improve major-upgrade --------- Co-authored-by: Eleonora Zinchenko <[email protected]> Co-authored-by: Viacheslav Sarzhan <[email protected]>
- Loading branch information
1 parent
18b9cde
commit 5a4de3e
Showing
80 changed files
with
1,076 additions
and
371 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ commands: | |
set -o xtrace | ||
source ../../functions | ||
get_cr \ | ||
| yq eval ' | ||
.spec.postgresVersion = 12 | | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,21 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestAssert | ||
timeout: 660 | ||
commands: | ||
- script: |- | ||
kubectl get postgrescluster major-upgrade \ | ||
-n ${NAMESPACE} \ | ||
-o yaml \ | ||
| yq eval '.status.pgbackrest.repos' - | ||
--- | ||
kind: Job | ||
apiVersion: batch/v1 | ||
apiVersion: postgres-operator.crunchydata.com/v1beta1 | ||
kind: PostgresCluster | ||
metadata: | ||
annotations: | ||
postgres-operator.crunchydata.com/pgbackrest-backup: backup-after-12-to-13 | ||
labels: | ||
postgres-operator.crunchydata.com/pgbackrest-backup: manual | ||
postgres-operator.crunchydata.com/pgbackrest-repo: repo1 | ||
ownerReferences: | ||
- apiVersion: pgv2.percona.com/v2 | ||
kind: PerconaPGBackup | ||
controller: true | ||
blockOwnerDeletion: true | ||
name: major-upgrade | ||
status: | ||
succeeded: 1 | ||
--- | ||
apiVersion: pgv2.percona.com/v2 | ||
kind: PerconaPGBackup | ||
metadata: | ||
name: backup-after-12-to-13 | ||
spec: | ||
pgCluster: major-upgrade | ||
repoName: repo1 | ||
options: | ||
- --type=full | ||
status: | ||
state: Succeeded | ||
pgbackrest: | ||
repos: | ||
- bound: true | ||
name: repo2 | ||
replicaCreateBackupComplete: true | ||
stanzaCreated: true |
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,12 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
commands: | ||
- script: |- | ||
set -o errexit | ||
set -o xtrace | ||
kubectl patch \ | ||
-n $NAMESPACE \ | ||
perconapgcluster major-upgrade \ | ||
--type='json' \ | ||
-p='[{"op": "replace", "path": "/spec/backups/pgbackrest/repos/0/name", "value": "repo2"}]' |
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 |
---|---|---|
@@ -1,30 +1,31 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestAssert | ||
timeout: 950 | ||
timeout: 660 | ||
--- | ||
apiVersion: pgv2.percona.com/v2 | ||
kind: PerconaPGRestore | ||
kind: Job | ||
apiVersion: batch/v1 | ||
metadata: | ||
name: restore-after-12-to-13 | ||
spec: | ||
pgCluster: major-upgrade | ||
repoName: repo1 | ||
annotations: | ||
postgres-operator.crunchydata.com/pgbackrest-backup: backup-after-12-to-13 | ||
labels: | ||
postgres-operator.crunchydata.com/pgbackrest-backup: manual | ||
postgres-operator.crunchydata.com/pgbackrest-repo: repo2 | ||
ownerReferences: | ||
- apiVersion: pgv2.percona.com/v2 | ||
kind: PerconaPGBackup | ||
controller: true | ||
blockOwnerDeletion: true | ||
status: | ||
state: Succeeded | ||
succeeded: 1 | ||
--- | ||
apiVersion: pgv2.percona.com/v2 | ||
kind: PerconaPGCluster | ||
kind: PerconaPGBackup | ||
metadata: | ||
name: major-upgrade | ||
name: backup-after-12-to-13 | ||
spec: | ||
pgCluster: major-upgrade | ||
repoName: repo2 | ||
options: | ||
- --type=full | ||
status: | ||
pgbouncer: | ||
ready: 3 | ||
size: 3 | ||
postgres: | ||
instances: | ||
- name: instance1 | ||
ready: 3 | ||
size: 3 | ||
ready: 3 | ||
size: 3 | ||
state: ready | ||
state: Succeeded |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,52 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestAssert | ||
timeout: 30 | ||
timeout: 720 | ||
commands: | ||
- script: |- | ||
set -o errexit | ||
kubectl -n ${NAMESPACE} get pod | ||
for pod in $(kubectl -n ${NAMESPACE} get pods -l postgres-operator.crunchydata.com/data=postgres --no-headers | awk '{print $1}'); do | ||
phase=$(kubectl -n ${NAMESPACE} get pod/${pod} -o jsonpath={".status.phase"}) | ||
if [[ "${phase}" != "Running" ]]; then | ||
echo "Waiting for ${pod} to start running" | ||
continue | ||
fi | ||
echo "PostgreSQL logs from ${pod}:" | ||
echo "find /pgdata/pg13/log -type f -iname 'postgresql*.log' -exec tail -n 30 {} \;" \ | ||
| kubectl -n ${NAMESPACE} exec -it ${pod} -- bash 2>/dev/null | ||
done | ||
sleep 30 | ||
collectors: | ||
- type: pod | ||
selector: "postgres-operator.crunchydata.com/data=postgres" | ||
tail: 30 | ||
--- | ||
kind: ConfigMap | ||
apiVersion: v1 | ||
apiVersion: pgv2.percona.com/v2 | ||
kind: PerconaPGRestore | ||
metadata: | ||
name: 05-read-from-primary | ||
data: | ||
data: ' 100500' | ||
name: restore-after-12-to-13 | ||
spec: | ||
pgCluster: major-upgrade | ||
repoName: repo2 | ||
status: | ||
state: Succeeded | ||
--- | ||
apiVersion: pgv2.percona.com/v2 | ||
kind: PerconaPGCluster | ||
metadata: | ||
name: major-upgrade | ||
status: | ||
pgbouncer: | ||
ready: 3 | ||
size: 3 | ||
postgres: | ||
instances: | ||
- name: instance1 | ||
ready: 3 | ||
size: 3 | ||
ready: 3 | ||
size: 3 | ||
state: ready |
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 |
---|---|---|
|
@@ -4,4 +4,4 @@ metadata: | |
name: restore-after-12-to-13 | ||
spec: | ||
pgCluster: major-upgrade | ||
repoName: repo1 | ||
repoName: repo2 |
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,10 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestAssert | ||
timeout: 30 | ||
--- | ||
kind: ConfigMap | ||
apiVersion: v1 | ||
metadata: | ||
name: 05-read-from-primary | ||
data: | ||
data: ' 100500' |
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,21 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestAssert | ||
timeout: 660 | ||
commands: | ||
- script: |- | ||
kubectl get postgrescluster major-upgrade \ | ||
-n ${NAMESPACE} \ | ||
-o yaml \ | ||
| yq eval '.status.pgbackrest.repos' - | ||
--- | ||
kind: Job | ||
apiVersion: batch/v1 | ||
apiVersion: postgres-operator.crunchydata.com/v1beta1 | ||
kind: PostgresCluster | ||
metadata: | ||
annotations: | ||
postgres-operator.crunchydata.com/pgbackrest-backup: backup-after-13-to-14 | ||
labels: | ||
postgres-operator.crunchydata.com/pgbackrest-backup: manual | ||
postgres-operator.crunchydata.com/pgbackrest-repo: repo1 | ||
ownerReferences: | ||
- apiVersion: pgv2.percona.com/v2 | ||
kind: PerconaPGBackup | ||
controller: true | ||
blockOwnerDeletion: true | ||
name: major-upgrade | ||
status: | ||
succeeded: 1 | ||
--- | ||
apiVersion: pgv2.percona.com/v2 | ||
kind: PerconaPGBackup | ||
metadata: | ||
name: backup-after-13-to-14 | ||
spec: | ||
pgCluster: major-upgrade | ||
repoName: repo1 | ||
options: | ||
- --type=full | ||
status: | ||
state: Succeeded | ||
pgbackrest: | ||
repos: | ||
- bound: true | ||
name: repo3 | ||
replicaCreateBackupComplete: true | ||
stanzaCreated: true |
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,12 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
commands: | ||
- script: |- | ||
set -o errexit | ||
set -o xtrace | ||
kubectl patch \ | ||
-n $NAMESPACE \ | ||
perconapgcluster major-upgrade \ | ||
--type='json' \ | ||
-p='[{"op": "replace", "path": "/spec/backups/pgbackrest/repos/0/name", "value": "repo3"}]' |
Oops, something went wrong.