Skip to content

Commit

Permalink
ovs: get controllerrevision with option --ignore-not-found
Browse files Browse the repository at this point in the history
Signed-off-by: zhangzujian <[email protected]>
  • Loading branch information
zhangzujian committed May 21, 2024
1 parent f983087 commit 29c84d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion dist/images/cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,10 @@ while :; do
if [ $(kubectl get pod -n kube-system -l component=network -o name | wc -l) -eq 0 ]; then
break
fi
kubectl -n kube-system get pod -l component=network -o wide
for pod in `kubectl -n kube-system get pod -l component=network -o name`; do
echo "$pod logs:"
kubectl -n kube-system logs $pod --timestamps --tail 50
done
done

# wait for all pods to be deleted before deleting serviceaccount/clusterrole/clusterrolebinding
Expand Down
4 changes: 2 additions & 2 deletions dist/images/start-ovs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ function cgroup_match {
function quit {
gen_name=$(kubectl -n "${POD_NAMESPACE}" get pod "${POD_NAME}" -o jsonpath='{.metadata.generateName}')
revision_hash=$(kubectl -n "${POD_NAMESPACE}" get pod "${POD_NAME}" -o jsonpath='{.metadata.labels.controller-revision-hash}')
revision=$(kubectl -n "${POD_NAMESPACE}" get controllerrevision "${gen_name}${revision_hash}" -o jsonpath='{.revision}')
revision=$(kubectl -n "${POD_NAMESPACE}" get controllerrevision "${gen_name}${revision_hash}" --ignore-not-found -o jsonpath='{.revision}')
ds_name=${gen_name%-}
latest_revision=$(kubectl -n "${POD_NAMESPACE}" get controllerrevision --no-headers | awk '$2 == "daemonset.apps/'$ds_name'" {print $3}' | sort -nr | head -n1)
if [ "x$latest_revision" = "x$revision" ]; then
if [ "x$revision" = "x" -o "x$latest_revision" = "x$revision" ]; then
# stop ovn-controller/ovs only when the processes are in the same cgroup
pid=$(/usr/share/ovn/scripts/ovn-ctl status_controller | awk '{print $NF}')
if cgroup_match "${pid}" self; then
Expand Down

0 comments on commit 29c84d5

Please sign in to comment.