Skip to content

Commit

Permalink
kubectl-ko: fix registry/version (#2133)
Browse files Browse the repository at this point in the history
We should get image registry/version from the image being used.
  • Loading branch information
zhangzujian committed Dec 8, 2022
1 parent 2156ef0 commit 9bbf5e4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions dist/images/kubectl-ko
Original file line number Diff line number Diff line change
Expand Up @@ -577,12 +577,13 @@ getOvnCentralPod(){
exit 1
fi
OVN_SB_POD=$SB_POD
VERSION=$(kubectl -n kube-system get pods -l ovn-sb-leader=true -o yaml | grep "image: $REGISTRY/kube-ovn:" | head -n 1 | awk -F ':' '{print $3}')
if [ -z "$VERSION" ]; then
echo "kubeovn version not exists"
image=$(kubectl -n kube-system get pods -l app=kube-ovn-cni -o jsonpath='{.items[0].spec.containers[0].image}')
if [ -z "$image" ]; then
echo "cannot get kube-ovn image"
exit 1
fi
KUBE_OVN_VERSION=$VERSION
REGISTRY=$(dirname $image)
KUBE_OVN_VERSION=$(basename $image | awk -F ':' '{print $2}')
}

getOvnCentralDbStatus(){
Expand Down

0 comments on commit 9bbf5e4

Please sign in to comment.