Skip to content

Commit

Permalink
get dbstatus for all ovn-central pod (#1619)
Browse files Browse the repository at this point in the history
  • Loading branch information
hongzhen-ma committed Jun 21, 2022
1 parent 51c409b commit 0877c3a
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions dist/images/kubectl-ko
Expand Up @@ -362,6 +362,18 @@ getOvnCentralPod(){
OVN_SB_POD=$SB_POD
}

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})
Expand Down Expand Up @@ -429,7 +441,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
Expand Down Expand Up @@ -507,7 +519,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"
Expand Down

0 comments on commit 0877c3a

Please sign in to comment.