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 18, 2022
1 parent be66af4 commit fce2cf1
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions dist/images/kubectl-ko
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit fce2cf1

Please sign in to comment.