-
Notifications
You must be signed in to change notification settings - Fork 76
Expand file tree
/
Copy path09-deleted-from-server-inventory.yaml
More file actions
37 lines (27 loc) · 1.44 KB
/
09-deleted-from-server-inventory.yaml
File metadata and controls
37 lines (27 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |-
set -o errexit
set -o xtrace
source ../../functions
instance=$(kubectl get -n "${NAMESPACE}" pod -l postgres-operator.crunchydata.com/instance-set=instance1 -o 'jsonpath={.items[].metadata.name}')
node_id=$(kubectl exec -n "${NAMESPACE}" $instance -c pmm-client -- pmm-admin status --json | jq -r '.pmm_agent_status.node_id')
node_id_exist=$(kubectl exec -n "${NAMESPACE}" monitoring-0 -- pmm-admin --server-url=https://admin:admin@$(get_service_ip monitoring-service)/ --server-insecure-tls inventory list nodes --node-type=CONTAINER_NODE | grep $node_id | awk '{print $4}')
if [ -z "$node_id_exist" ]; then
echo "Can't get $node_id node_id from PMM server"
exit 1
fi
get_cr \
| yq eval '.spec.pause=true' - \
| kubectl -n "${NAMESPACE}" apply -f -
wait_for_delete "pod/$instance"
is_node_id_exist=$(kubectl exec -n "${NAMESPACE}" monitoring-0 -- pmm-admin --server-url=https://admin:admin@$(get_service_ip monitoring-service)/ --server-insecure-tls inventory list nodes --node-type=CONTAINER_NODE | grep $node_id | awk '{print $4}')
if [ -n "$is_node_id_exist" ]; then
echo "The $instance pod was not deleted from server inventory"
exit 1
fi
get_cr \
| yq eval '.spec.pause=false' - \
| kubectl -n "${NAMESPACE}" apply -f -
timeout: 200