File tree Expand file tree Collapse file tree 26 files changed +56
-4
lines changed
demand-backup-physical-sharded
mongod-major-upgrade-sharded Expand file tree Collapse file tree 26 files changed +56
-4
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ check_cr_config() {
31
31
if [[ $( kubectl_bin get pod \
32
32
--selector=statefulset.kubernetes.io/pod-name=" ${cluster} -arbiter-0" \
33
33
-o jsonpath=' {.items[*].status.containerStatuses[?(@.name == "mongod-arbiter")].restartCount}' ) -gt 0 ]]; then
34
+ collect_k8s_logs
34
35
echo " Something went wrong with arbiter. Exiting..."
35
36
exit 1
36
37
fi
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ check_balancer() {
15
15
| grep -E -v " Percona Server for MongoDB|connecting to:|Implicit session:|versions do not match|Error saving history file:|bye" )
16
16
17
17
if [[ $balancer_running != " $expected " ]]; then
18
+ collect_k8s_logs
18
19
echo " Unexpected output from \" db.adminCommand({balancerStatus: 1}).mode\" : $balancer_running "
19
20
echo " Expected $expected "
20
21
exit 1
Original file line number Diff line number Diff line change @@ -81,6 +81,7 @@ for i in "rs0" "rs1"; do
81
81
done
82
82
83
83
if [[ $shards -lt 2 ]]; then
84
+ collect_k8s_logs
84
85
echo " data is only on some of the shards, maybe sharding is not working"
85
86
exit 1
86
87
fi
Original file line number Diff line number Diff line change @@ -83,6 +83,7 @@ encrypted_cluster_log=$(kubectl_bin logs some-name-rs0-0 -c mongod -n $namespace
83
83
84
84
echo " $encrypted_cluster_log "
85
85
if [ -z " $encrypted_cluster_log " ]; then
86
+ collect_k8s_logs
86
87
echo " Cluster is not encrypted"
87
88
exit 1
88
89
fi
@@ -99,6 +100,7 @@ until [ "$retry" -ge 10 ]; do
99
100
echo " Cluster is not encrypted already"
100
101
break
101
102
elif [ $retry == 15 ]; then
103
+ collect_k8s_logs
102
104
echo " Max retry count $retry reached. Cluster is still encrypted"
103
105
exit 1
104
106
else
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ check_rs_proper_component_deletion() {
17
17
until [[ $( kubectl_bin get sts -l app.kubernetes.io/instance=${cluster} ,app.kubernetes.io/replset=${rs_name} -ojson | jq ' .items | length' ) -eq 0 ]]; do
18
18
let retry+=1
19
19
if [ $retry -ge 70 ]; then
20
+ collect_k8s_logs
20
21
sts_count=$( kubectl_bin get sts -l app.kubernetes.io/instance=${cluster} ,app.kubernetes.io/replset=${rs_name} -ojson | jq ' .items | length' )
21
22
echo " Replset $rs_name not properly removed, expected sts count of 0 but got $sts_count . Exiting after $retry tries..."
22
23
exit 1
@@ -115,6 +116,7 @@ main() {
115
116
done
116
117
117
118
if [[ $shards -lt 3 ]]; then
119
+ collect_k8s_logs
118
120
echo " data is only on some of the shards, maybe sharding is not working"
119
121
exit 1
120
122
fi
@@ -125,6 +127,7 @@ main() {
125
127
" clusterAdmin:clusterAdmin123456@$cluster -mongos.$namespace " " mongodb" " .svc.cluster.local" \
126
128
" --tlsCertificateKeyFile /tmp/tls.pem --tlsCAFile /etc/mongodb-ssl/ca.crt --tls" )
127
129
if ! echo $res | grep -q ' "ok" : 1' ; then
130
+ collect_k8s_logs
128
131
echo " app database not dropped. Exiting.."
129
132
exit 1
130
133
fi
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ function stop_cluster() {
27
27
let passed_time=" ${passed_time} +${sleep_time} "
28
28
sleep ${sleep_time}
29
29
if [[ ${passed_time} -gt ${max_wait_time} ]]; then
30
+ collect_k8s_logs
30
31
echo " We've been waiting for cluster stop for too long. Exiting..."
31
32
exit 1
32
33
fi
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ run_recovery_check() {
38
38
wait_restore " ${backup_name} " " ${cluster} " " ready" " 0" " 900"
39
39
kubectl_bin get psmdb ${cluster} -o yaml
40
40
if [ $( kubectl_bin get psmdb ${cluster} -o yaml | yq ' .metadata.annotations."percona.com/resync-pbm"' ) == null ]; then
41
+ collect_k8s_logs
41
42
echo " psmdb/${cluster} should be annotated with percona.com/resync-pbm after a physical restore"
42
43
exit 1
43
44
fi
@@ -52,6 +53,7 @@ check_exported_mongos_service_endpoint() {
52
53
local host=$1
53
54
54
55
if [ " $host " != " $( kubectl_bin get psmdb $cluster -o=jsonpath=' {.status.host}' ) " ]; then
56
+ collect_k8s_logs
55
57
echo " Exported host is not correct after the restore"
56
58
exit 1
57
59
fi
@@ -80,6 +82,7 @@ wait_cluster_consistency ${cluster}
80
82
lbEndpoint=$( kubectl_bin get svc $cluster -mongos -o=jsonpath=' {.status}' \
81
83
| jq -r ' select(.loadBalancer != null and .loadBalancer.ingress != null and .loadBalancer.ingress != []) | .loadBalancer.ingress[0][]' )
82
84
if [ -z $lbEndpoint ]; then
85
+ collect_k8s_logs
83
86
echo " mongos service not exported correctly"
84
87
exit 1
85
88
fi
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ run_recovery_check() {
38
38
wait_restore " ${backup_name} " " ${cluster} " " ready" " 0" " 900"
39
39
kubectl_bin get psmdb ${cluster} -o yaml
40
40
if [ $( kubectl_bin get psmdb ${cluster} -o yaml | yq ' .metadata.annotations."percona.com/resync-pbm"' ) == null ]; then
41
+ collect_k8s_logs
41
42
echo " psmdb/${cluster} should be annotated with percona.com/resync-pbm after a physical restore"
42
43
exit 1
43
44
fi
Original file line number Diff line number Diff line change @@ -166,6 +166,7 @@ backup_exists=$(kubectl_bin run -i --rm aws-cli --image=perconalab/awscli --rest
166
166
/usr/bin/aws --endpoint-url http://minio-service:9000 s3 ls s3://operator-testing/ \
167
167
| grep -c ${backup_dest_minio} _ | cat)
168
168
if [[ $backup_exists -eq 1 ]]; then
169
+ collect_k8s_logs
169
170
echo " Backup was not removed from bucket -- minio"
170
171
exit 1
171
172
fi
Original file line number Diff line number Diff line change @@ -135,6 +135,7 @@ backup_exists=$(kubectl_bin run -i --rm aws-cli --image=perconalab/awscli --rest
135
135
/usr/bin/aws --endpoint-url http://minio-service:9000 s3 ls s3://operator-testing/ \
136
136
| grep -c ${backup_dest_minio} | cat)
137
137
if [[ $backup_exists -eq 1 ]]; then
138
+ collect_k8s_logs
138
139
echo " Backup was not removed from bucket -- minio"
139
140
exit 1
140
141
fi
@@ -170,6 +171,7 @@ backup_exists=$(kubectl_bin run -i --rm aws-cli --image=perconalab/awscli --rest
170
171
/usr/bin/aws --endpoint-url http://minio-service:9000 s3 ls s3://operator-testing/ \
171
172
| grep -c ${backup_dest_minio} | cat)
172
173
if [[ $backup_exists -eq 1 ]]; then
174
+ collect_k8s_logs
173
175
echo " Backup was not removed from bucket -- minio"
174
176
exit 1
175
177
fi
You can’t perform that action at this time.
0 commit comments