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() {
3131 if [[ $( kubectl_bin get pod \
3232 --selector=statefulset.kubernetes.io/pod-name=" ${cluster} -arbiter-0" \
3333 -o jsonpath=' {.items[*].status.containerStatuses[?(@.name == "mongod-arbiter")].restartCount}' ) -gt 0 ]]; then
34+ collect_k8s_logs
3435 echo " Something went wrong with arbiter. Exiting..."
3536 exit 1
3637 fi
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ check_balancer() {
1515 | grep -E -v " Percona Server for MongoDB|connecting to:|Implicit session:|versions do not match|Error saving history file:|bye" )
1616
1717 if [[ $balancer_running != " $expected " ]]; then
18+ collect_k8s_logs
1819 echo " Unexpected output from \" db.adminCommand({balancerStatus: 1}).mode\" : $balancer_running "
1920 echo " Expected $expected "
2021 exit 1
Original file line number Diff line number Diff line change @@ -101,6 +101,7 @@ for i in "rs0" "rs1"; do
101101done
102102
103103if [[ $shards -lt 2 ]]; then
104+ collect_k8s_logs
104105 echo " data is only on some of the shards, maybe sharding is not working"
105106 exit 1
106107fi
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
8383
8484echo " $encrypted_cluster_log "
8585if [ -z " $encrypted_cluster_log " ]; then
86+ collect_k8s_logs
8687 echo " Cluster is not encrypted"
8788 exit 1
8889fi
@@ -99,6 +100,7 @@ until [ "$retry" -ge 10 ]; do
99100 echo " Cluster is not encrypted already"
100101 break
101102 elif [ $retry == 15 ]; then
103+ collect_k8s_logs
102104 echo " Max retry count $retry reached. Cluster is still encrypted"
103105 exit 1
104106 else
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ check_rs_proper_component_deletion() {
1717 until [[ $( kubectl_bin get sts -l app.kubernetes.io/instance=${cluster} ,app.kubernetes.io/replset=${rs_name} -ojson | jq ' .items | length' ) -eq 0 ]]; do
1818 let retry+=1
1919 if [ $retry -ge 70 ]; then
20+ collect_k8s_logs
2021 sts_count=$( kubectl_bin get sts -l app.kubernetes.io/instance=${cluster} ,app.kubernetes.io/replset=${rs_name} -ojson | jq ' .items | length' )
2122 echo " Replset $rs_name not properly removed, expected sts count of 0 but got $sts_count . Exiting after $retry tries..."
2223 exit 1
@@ -115,6 +116,7 @@ main() {
115116 done
116117
117118 if [[ $shards -lt 3 ]]; then
119+ collect_k8s_logs
118120 echo " data is only on some of the shards, maybe sharding is not working"
119121 exit 1
120122 fi
@@ -125,6 +127,7 @@ main() {
125127 " clusterAdmin:clusterAdmin123456@$cluster -mongos.$namespace " " mongodb" " .svc.cluster.local" \
126128 " --tlsCertificateKeyFile /tmp/tls.pem --tlsCAFile /etc/mongodb-ssl/ca.crt --tls" )
127129 if ! echo $res | grep -q ' "ok" : 1' ; then
130+ collect_k8s_logs
128131 echo " app database not dropped. Exiting.."
129132 exit 1
130133 fi
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ function stop_cluster() {
2727 let passed_time=" ${passed_time} +${sleep_time} "
2828 sleep ${sleep_time}
2929 if [[ ${passed_time} -gt ${max_wait_time} ]]; then
30+ collect_k8s_logs
3031 echo " We've been waiting for cluster stop for too long. Exiting..."
3132 exit 1
3233 fi
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ run_recovery_check() {
3838 wait_restore " ${backup_name} " " ${cluster} " " ready" " 0" " 1800"
3939 kubectl_bin get psmdb ${cluster} -o yaml
4040 if [ $( kubectl_bin get psmdb ${cluster} -o yaml | yq ' .metadata.annotations."percona.com/resync-pbm"' ) == null ]; then
41+ collect_k8s_logs
4142 echo " psmdb/${cluster} should be annotated with percona.com/resync-pbm after a physical restore"
4243 exit 1
4344 fi
@@ -52,6 +53,7 @@ check_exported_mongos_service_endpoint() {
5253 local host=$1
5354
5455 if [ " $host " != " $( kubectl_bin get psmdb $cluster -o=jsonpath=' {.status.host}' ) " ]; then
56+ collect_k8s_logs
5557 echo " Exported host is not correct after the restore"
5658 exit 1
5759 fi
@@ -80,6 +82,7 @@ wait_cluster_consistency ${cluster}
8082lbEndpoint=$( kubectl_bin get svc $cluster -mongos -o=jsonpath=' {.status}' |
8183 jq -r ' select(.loadBalancer != null and .loadBalancer.ingress != null and .loadBalancer.ingress != []) | .loadBalancer.ingress[0][]' )
8284if [ -z $lbEndpoint ]; then
85+ collect_k8s_logs
8386 echo " mongos service not exported correctly"
8487 exit 1
8588fi
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ run_recovery_check() {
3838 wait_restore " ${backup_name} " " ${cluster} " " ready" " 0" " 1800"
3939 kubectl_bin get psmdb ${cluster} -o yaml
4040 if [ $( kubectl_bin get psmdb ${cluster} -o yaml | yq ' .metadata.annotations."percona.com/resync-pbm"' ) == null ]; then
41+ collect_k8s_logs
4142 echo " psmdb/${cluster} should be annotated with percona.com/resync-pbm after a physical restore"
4243 exit 1
4344 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
166166 /usr/bin/aws --endpoint-url http://minio-service:9000 s3 ls s3://operator-testing/ \
167167 | grep -c ${backup_dest_minio} _ | cat)
168168if [[ $backup_exists -eq 1 ]]; then
169+ collect_k8s_logs
169170 echo " Backup was not removed from bucket -- minio"
170171 exit 1
171172fi
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
135135 /usr/bin/aws --endpoint-url http://minio-service:9000 s3 ls s3://operator-testing/ \
136136 | grep -c ${backup_dest_minio} | cat)
137137if [[ $backup_exists -eq 1 ]]; then
138+ collect_k8s_logs
138139 echo " Backup was not removed from bucket -- minio"
139140 exit 1
140141fi
@@ -170,6 +171,7 @@ backup_exists=$(kubectl_bin run -i --rm aws-cli --image=perconalab/awscli --rest
170171 /usr/bin/aws --endpoint-url http://minio-service:9000 s3 ls s3://operator-testing/ \
171172 | grep -c ${backup_dest_minio} | cat)
172173if [[ $backup_exists -eq 1 ]]; then
174+ collect_k8s_logs
173175 echo " Backup was not removed from bucket -- minio"
174176 exit 1
175177fi
You can’t perform that action at this time.
0 commit comments