From f8a266d69587e6c961917f1ec57fe1f71f29f3f4 Mon Sep 17 00:00:00 2001 From: hzma Date: Sat, 18 Jun 2022 15:13:23 +0800 Subject: [PATCH] get dbstatus for all ovn-central pod (#1619) --- dist/images/kubectl-ko | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/dist/images/kubectl-ko b/dist/images/kubectl-ko index 30a4f590726..76b63efa4bf 100644 --- a/dist/images/kubectl-ko +++ b/dist/images/kubectl-ko @@ -379,6 +379,18 @@ getOvnCentralPod(){ KUBE_OVN_VERSION=$VERSION } +getOvnCentralDbStatus(){ + NB_PODS=$(kubectl get pod -n $KUBE_OVN_NS | grep ovn-central | awk '{print $1}') + for pod in $NB_PODS + do + echo "get dbstatus in pod $pod" + nbstatus=`kubectl exec "$pod" -n $KUBE_OVN_NS -c ovn-central -- ovn-appctl -t /var/run/ovn/ovnnb_db.ctl ovsdb-server/get-db-storage-status OVN_Northbound` + echo "nb db status $nbstatus" + sbstatus=`kubectl exec "$pod" -n $KUBE_OVN_NS -c ovn-central -- ovn-appctl -t /var/run/ovn/ovnsb_db.ctl ovsdb-server/get-db-storage-status OVN_Southbound` + echo "sb db status $sbstatus" + done +} + checkDaemonSet(){ name="$1" currentScheduled=$(kubectl get ds -n $KUBE_OVN_NS "$name" -o jsonpath={.status.currentNumberScheduled}) @@ -452,7 +464,7 @@ dbtool(){ echo "backup ovn-$component db to $(pwd)/ovnnb_db.$suffix.backup" ;; dbstatus) - kubectl exec "$OVN_NB_POD" -n $KUBE_OVN_NS -c ovn-central -- ovn-appctl -t /var/run/ovn/ovnnb_db.ctl ovsdb-server/get-db-storage-status OVN_Northbound + getOvnCentralDbStatus ;; restore) # set ovn-central replicas to 0 @@ -530,7 +542,7 @@ dbtool(){ echo "backup ovn-$component db to $(pwd)/ovnsb_db.$suffix.backup" ;; dbstatus) - kubectl exec "$OVN_NB_POD" -n $KUBE_OVN_NS -c ovn-central -- ovn-appctl -t /var/run/ovn/ovnsb_db.ctl ovsdb-server/get-db-storage-status OVN_Southbound + getOvnCentralDbStatus ;; restore) echo "restore cmd is only used for nb db"