Skip to content

Commit 6111cfd

Browse files
Merge pull request #1293 from percona/K8SPS-670-demand-backup-cloud
K8SPS-670 add Spaces to demand-backup-cloud
2 parents e0d47d8 + f3903d6 commit 6111cfd

84 files changed

Lines changed: 899 additions & 743 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

e2e-tests/functions

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1897,31 +1897,33 @@ list_files_on_storage() {
18971897
verify_all_backups_deletion() {
18981898
for backup in $(kubectl get ps-backup -n "$NAMESPACE" -o jsonpath='{.items[*].metadata.name}'); do
18991899
echo "Checking backup: $backup"
1900-
1901-
output=$(
1900+
eval "$(
19021901
kubectl get ps-backup "$backup" -n "$NAMESPACE" -o json \
1903-
| yq -r '
1904-
.status.storage as $storage |
1905-
[
1906-
$storage.type,
1907-
($storage[.type].bucket // $storage[.type].container // ""),
1908-
($storage[.type].credentialsSecret // ""),
1909-
($storage[.type].endpointUrl // ""),
1910-
($storage[.type].region // ""),
1911-
(.status.destination // "")
1912-
] | @tsv
1902+
| jq -r '
1903+
.status.storage.type as $t |
1904+
(if $t then .status.storage[$t] else {} end) as $s |
1905+
"storage_type=\($t // "")",
1906+
"bucket=\($s.bucket // $s.container // "")",
1907+
"secret_name=\($s.credentialsSecret // "")",
1908+
"endpoint=\($s.endpointUrl // "")",
1909+
"region=\($s.region // "")",
1910+
"destination=\(.status.destination // "")"
19131911
'
1914-
)
1912+
)"
19151913

1916-
read -r storage_type bucket secret_name endpoint region destination <<<"$output"
1914+
kubectl delete ps-backup "$backup" -n "$NAMESPACE"
19171915

1918-
prefix="${destination#*://*/}"
1916+
local prefix="${destination#*://}"
1917+
prefix="${prefix#*/}"
19191918
if [[ -z $destination ]]; then
19201919
echo "Backup $backup is missing destination"
1921-
break
1920+
continue
19221921
fi
19231922

1924-
kubectl delete ps-backup "$backup" -n "$NAMESPACE"
1923+
if [[ $storage_type == "azure" ]]; then
1924+
echo "Skipping backup verification, to be implemented on K8SPS-695"
1925+
continue
1926+
fi
19251927

19261928
local removed=false
19271929
for i in {1..5}; do
@@ -1930,7 +1932,6 @@ verify_all_backups_deletion() {
19301932
removed=true
19311933
break
19321934
fi
1933-
19341935
echo "Waiting for backup removal ($i/5): $backup"
19351936
sleep 5
19361937
done

e2e-tests/tests/demand-backup-cloud/00-assert.yaml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,25 @@ apiVersion: kuttl.dev/v1beta1
22
kind: TestAssert
33
timeout: 150
44
---
5-
apiVersion: v1
6-
kind: Secret
5+
apiVersion: apiextensions.k8s.io/v1
6+
kind: CustomResourceDefinition
77
metadata:
8-
name: minio-secret
9-
type: Opaque
8+
name: perconaservermysqls.ps.percona.com
9+
spec:
10+
group: ps.percona.com
11+
names:
12+
kind: PerconaServerMySQL
13+
listKind: PerconaServerMySQLList
14+
plural: perconaservermysqls
15+
shortNames:
16+
- ps
17+
singular: perconaservermysql
18+
scope: Namespaced
19+
---
20+
apiVersion: kuttl.dev/v1beta1
21+
kind: TestAssert
22+
metadata:
23+
name: check-operator-deploy-status
24+
timeout: 120
25+
commands:
26+
- script: kubectl assert exist-enhanced deployment percona-server-mysql-operator -n ${OPERATOR_NS:-$NAMESPACE} --field-selector status.readyReplicas=1

e2e-tests/tests/demand-backup-cloud/01-deploy-operator.yaml renamed to e2e-tests/tests/demand-backup-cloud/00-deploy-operator.yaml

File renamed without changes.

e2e-tests/tests/demand-backup-cloud/00-minio-secret.yaml

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 54 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,60 @@
11
apiVersion: kuttl.dev/v1beta1
22
kind: TestAssert
3-
timeout: 150
3+
timeout: 420
44
---
5-
apiVersion: apiextensions.k8s.io/v1
6-
kind: CustomResourceDefinition
5+
kind: StatefulSet
6+
apiVersion: apps/v1
77
metadata:
8-
name: perconaservermysqls.ps.percona.com
9-
spec:
10-
group: ps.percona.com
11-
names:
12-
kind: PerconaServerMySQL
13-
listKind: PerconaServerMySQLList
14-
plural: perconaservermysqls
15-
shortNames:
16-
- ps
17-
singular: perconaservermysql
18-
scope: Namespaced
8+
name: demand-backup-cloud-mysql
9+
status:
10+
observedGeneration: 1
11+
replicas: 3
12+
readyReplicas: 3
13+
currentReplicas: 3
14+
updatedReplicas: 3
15+
collisionCount: 0
1916
---
20-
apiVersion: kuttl.dev/v1beta1
21-
kind: TestAssert
17+
kind: StatefulSet
18+
apiVersion: apps/v1
19+
metadata:
20+
name: demand-backup-cloud-orc
21+
status:
22+
observedGeneration: 1
23+
replicas: 3
24+
readyReplicas: 3
25+
currentReplicas: 3
26+
updatedReplicas: 3
27+
collisionCount: 0
28+
---
29+
kind: StatefulSet
30+
apiVersion: apps/v1
31+
metadata:
32+
name: demand-backup-cloud-haproxy
33+
status:
34+
observedGeneration: 1
35+
replicas: 3
36+
readyReplicas: 3
37+
currentReplicas: 3
38+
updatedReplicas: 3
39+
collisionCount: 0
40+
---
41+
apiVersion: ps.percona.com/v1
42+
kind: PerconaServerMySQL
2243
metadata:
23-
name: check-operator-deploy-status
24-
timeout: 120
25-
commands:
26-
- script: kubectl assert exist-enhanced deployment percona-server-mysql-operator -n ${OPERATOR_NS:-$NAMESPACE} --field-selector status.readyReplicas=1
44+
name: demand-backup-cloud
45+
finalizers:
46+
- percona.com/delete-mysql-pods-in-order
47+
status:
48+
haproxy:
49+
ready: 3
50+
size: 3
51+
state: ready
52+
mysql:
53+
ready: 3
54+
size: 3
55+
state: ready
56+
orchestrator:
57+
ready: 3
58+
size: 3
59+
state: ready
60+
state: ready
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: kuttl.dev/v1beta1
2+
kind: TestStep
3+
timeout: 10
4+
commands:
5+
- script: |-
6+
set -o errexit
7+
set -o xtrace
8+
9+
source ../../functions
10+
11+
get_cr | kubectl -n "${NAMESPACE}" apply -f -

e2e-tests/tests/demand-backup-cloud/02-assert.yaml

Lines changed: 0 additions & 60 deletions
This file was deleted.

e2e-tests/tests/demand-backup-cloud/02-create-cluster.yaml

Lines changed: 0 additions & 35 deletions
This file was deleted.

e2e-tests/tests/demand-backup-cloud/03-write-data.yaml renamed to e2e-tests/tests/demand-backup-cloud/02-write-data.yaml

File renamed without changes.

e2e-tests/tests/demand-backup-cloud/04-move-primary-before-backup.yaml renamed to e2e-tests/tests/demand-backup-cloud/03-move-primary-before-backup.yaml

File renamed without changes.

0 commit comments

Comments
 (0)