@@ -617,7 +617,7 @@ wait_for_delete() {
617
617
let retry+=1
618
618
if [ $retry -ge $wait_time ]; then
619
619
collect_k8s_logs
620
- kubectl_bin logs ${OPERATOR_NS: +-n $OPERATOR_NS } $( get_operator_pod) \
620
+ kubectl logs ${OPERATOR_NS: +-n $OPERATOR_NS } $( get_operator_pod) \
621
621
| grep -v ' level=info' \
622
622
| grep -v ' level=debug' \
623
623
| grep -v ' Getting tasks for pod' \
@@ -906,21 +906,21 @@ deploy_cert_manager() {
906
906
delete_crd () {
907
907
desc ' get and delete old CRDs and RBAC'
908
908
909
- kubectl_bin delete -f " ${src_dir} /deploy/crd.yaml" --ignore-not-found --wait=false || :
909
+ kubectl delete -f " ${src_dir} /deploy/crd.yaml" --ignore-not-found --wait=false || :
910
910
for crd_name in $( yq eval ' .metadata.name' " ${src_dir} /deploy/crd.yaml" | grep -v ' \-\-\-' ) ; do
911
911
kubectl get ${crd_name} --all-namespaces -o wide \
912
912
| grep -v ' NAMESPACE' \
913
913
| xargs -L 1 sh -xc ' kubectl patch ' ${crd_name} ' -n $0 $1 --type=merge -p "{\"metadata\":{\"finalizers\":[]}}"' \
914
914
|| :
915
- kubectl_bin wait --for=delete crd ${crd_name} || :
915
+ kubectl wait --for=delete crd ${crd_name} || :
916
916
done
917
917
918
918
local rbac_yaml=' rbac.yaml'
919
919
if [ -n " ${OPERATOR_NS} " ]; then
920
920
rbac_yaml=' cw-rbac.yaml'
921
921
fi
922
922
923
- kubectl_bin delete -f " ${src_dir} /deploy/$rbac_yaml " --ignore-not-found || true
923
+ kubectl delete -f " ${src_dir} /deploy/$rbac_yaml " --ignore-not-found || true
924
924
}
925
925
926
926
destroy () {
@@ -929,7 +929,7 @@ destroy() {
929
929
930
930
desc ' destroy cluster/operator and all other resources'
931
931
if [ ${ignore_logs} == " false" ] && [ " ${DEBUG_TESTS} " == 1 ]; then
932
- kubectl_bin logs ${OPERATOR_NS: +-n $OPERATOR_NS } $( get_operator_pod) \
932
+ kubectl logs ${OPERATOR_NS: +-n $OPERATOR_NS } $( get_operator_pod) \
933
933
| grep -v ' level=info' \
934
934
| grep -v ' level=debug' \
935
935
| grep -v ' Getting tasks for pod' \
@@ -952,9 +952,9 @@ destroy() {
952
952
oc delete --grace-period=0 --force=true project " $OPERATOR_NS " &
953
953
fi
954
954
else
955
- kubectl_bin delete --grace-period=0 --force=true namespace " $namespace " &
955
+ kubectl delete --grace-period=0 --force=true namespace " $namespace " &
956
956
if [ -n " $OPERATOR_NS " ]; then
957
- kubectl_bin delete --grace-period=0 --force=true namespace " $OPERATOR_NS " &
957
+ kubectl delete --grace-period=0 --force=true namespace " $OPERATOR_NS " &
958
958
fi
959
959
fi
960
960
rm -rf ${tmp_dir}
@@ -1257,7 +1257,7 @@ check_crd_for_deletion() {
1257
1257
local git_tag=" $1 "
1258
1258
1259
1259
for crd_name in $( curl -s https://raw.githubusercontent.com/percona/percona-server-mongodb-operator/${git_tag} /deploy/crd.yaml | yq eval ' .metadata.name' | $sed ' s/---//g' | $sed ' :a;N;$!ba;s/\n/ /g' ) ; do
1260
- if [[ $( kubectl_bin get crd/${crd_name} -o jsonpath=' {.status.conditions[-1].type}' ) == " Terminating" ]]; then
1260
+ if [[ $( kubectl get crd/${crd_name} -o jsonpath=' {.status.conditions[-1].type}' ) == " Terminating" ]]; then
1261
1261
kubectl get ${crd_name} --all-namespaces -o wide \
1262
1262
| grep -v ' NAMESPACE' \
1263
1263
| xargs -L 1 sh -xc ' kubectl patch ' ${crd_name} ' -n $0 $1 --type=merge -p "{\"metadata\":{\"finalizers\":[]}}"' \
@@ -1335,39 +1335,39 @@ collect_k8s_logs() {
1335
1335
mkdir -p ${logs_path}
1336
1336
1337
1337
for ns in ${check_namespaces} ; do
1338
- local pods=$( kubectl_bin get pods -n " ${ns} " -o name | awk -F " /" ' {print $2}' )
1338
+ local pods=$( kubectl get pods -n " ${ns} " -o name | awk -F " /" ' {print $2}' )
1339
1339
for p in ${pods} ; do
1340
- kubectl_bin -n " ${ns} " describe pod ${p} > ${logs_path} /pod_${ns} _${p} .dsc || :
1341
- local containers=$( kubectl_bin -n " ${ns} " get pod ${p} -o jsonpath=' {.spec.containers[*].name}' )
1340
+ kubectl -n " ${ns} " describe pod ${p} > ${logs_path} /pod_${ns} _${p} .dsc || :
1341
+ local containers=$( kubectl -n " ${ns} " get pod ${p} -o jsonpath=' {.spec.containers[*].name}' )
1342
1342
for c in ${containers} ; do
1343
- kubectl_bin -n " ${ns} " logs ${p} -c ${c} > ${logs_path} /container_${p} _${c} .log || :
1343
+ kubectl -n " ${ns} " logs ${p} -c ${c} > ${logs_path} /container_${p} _${c} .log || :
1344
1344
echo " logs saved in: ${logs_path} /${ns} _${p} _${c} .log"
1345
1345
done
1346
1346
done
1347
1347
done
1348
1348
for object in psmdb psmdb-backup psmdb-restore pods deployments replicasets services sts configmaps persistentvolumeclaims persistentvolumes secrets roles issuer certificate; do
1349
1349
echo " ##### START: ${object} NS: ${namespace} #####" >> ${logs_path} /_overview_${namespace} .txt
1350
- kubectl_bin get ${object} -n " ${namespace} " >> ${logs_path} /_overview_${namespace} .txt || :
1350
+ kubectl get ${object} -n " ${namespace} " >> ${logs_path} /_overview_${namespace} .txt || :
1351
1351
echo -e " ##### END: ${object} NS: ${namespace} #####\n" >> ${logs_path} /_overview_${namespace} .txt
1352
- kubectl_bin get ${object} -n " ${namespace} " -oyaml > ${logs_path} /${object} _${namespace} .yaml || :
1353
- kubectl_bin describe ${object} -n " ${namespace} " > ${logs_path} /${object} _${namespace} .dsc || :
1352
+ kubectl get ${object} -n " ${namespace} " -oyaml > ${logs_path} /${object} _${namespace} .yaml || :
1353
+ kubectl describe ${object} -n " ${namespace} " > ${logs_path} /${object} _${namespace} .dsc || :
1354
1354
done
1355
- kubectl_bin get events --all-namespaces > ${logs_path} /_events.log || :
1356
- kubectl_bin get nodes > ${logs_path} /_nodes.log || :
1357
- kubectl_bin get clusterroles > ${logs_path} /_clusterroles.log || :
1355
+ kubectl get events --all-namespaces > ${logs_path} /_events.log || :
1356
+ kubectl get nodes > ${logs_path} /_nodes.log || :
1357
+ kubectl get clusterroles > ${logs_path} /_clusterroles.log || :
1358
1358
1359
1359
local secret psmdb_secret psmdb_user psmdb_pass
1360
- for psmdb_name in " $( kubectl_bin get psmdb -n ${namespace} -o custom-columns=NAME:.metadata.name --no-headers=true) " ; do
1361
- psmdb_secret=" $( kubectl_bin get psmdb ${psmdb_name} -n ${namespace} -ojsonpath=' {.spec.secrets.users}' ) "
1360
+ for psmdb_name in " $( kubectl get psmdb -n ${namespace} -o custom-columns=NAME:.metadata.name --no-headers=true) " ; do
1361
+ psmdb_secret=" $( kubectl get psmdb ${psmdb_name} -n ${namespace} -ojsonpath=' {.spec.secrets.users}' ) "
1362
1362
if [[ ${psmdb_secret} ]]; then secret=" ${psmdb_secret} " ; else secret=" ${psmdb_name} -secrets" ; fi
1363
- psmdb_user=" $( kubectl_bin get secrets ${psmdb_secret} -ojsonpath=' {.data.MONGODB_BACKUP_USER}' | base64 --decode) "
1364
- psmdb_pass=" $( kubectl_bin get secrets ${psmdb_secret} -ojsonpath=' {.data.MONGODB_BACKUP_PASSWORD}' | base64 --decode) "
1365
- if [[ " $( kubectl_bin get psmdb ${psmdb_name} -n ${namespace} -ojsonpath=' {.spec.sharding.enabled}' ) " == " true" ]]; then
1363
+ psmdb_user=" $( kubectl get secrets ${psmdb_secret} -ojsonpath=' {.data.MONGODB_BACKUP_USER}' | base64 --decode) "
1364
+ psmdb_pass=" $( kubectl get secrets ${psmdb_secret} -ojsonpath=' {.data.MONGODB_BACKUP_PASSWORD}' | base64 --decode) "
1365
+ if [[ " $( kubectl get psmdb ${psmdb_name} -n ${namespace} -ojsonpath=' {.spec.sharding.enabled}' ) " == " true" ]]; then
1366
1366
local cfg_replica=" cfg"
1367
1367
echo " ##### sh.status() #####" > ${logs_path} /mongos_${psmdb_name} .mongo
1368
1368
run_mongos ' sh.status()' " ${psmdb_user} :${psmdb_pass} @${psmdb_name} -mongos.${namespace} " >> ${logs_path} /mongos_${psmdb_name} .mongo
1369
1369
fi
1370
- for psmdb_replset in $( kubectl_bin get psmdb ${psmdb_name} -n ${namespace} -ojsonpath=' {.spec.replsets[*].name}' | awk ' {print $0" ' ${cfg_replica} ' "}' ) ; do
1370
+ for psmdb_replset in $( kubectl get psmdb ${psmdb_name} -n ${namespace} -ojsonpath=' {.spec.replsets[*].name}' | awk ' {print $0" ' ${cfg_replica} ' "}' ) ; do
1371
1371
local command=(" rs.status()" " rs.config()" " db.printSlaveReplicationInfo()" " db.serverCmdLineOpts()" " db.getRoles()" " db.getUsers()" )
1372
1372
for com in " ${command[@]} " ; do
1373
1373
echo " ##### START: ${com} #####" >> ${logs_path} /mongodb_${psmdb_name} _${psmdb_replset} .mongo
0 commit comments