Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validate nbctl socket path in start-controller.sh #1971

Merged
merged 1 commit into from
Oct 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 24 additions & 6 deletions dist/images/start-controller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,29 @@ function gen_conn_str {
echo "$x"
}

if [[ "$ENABLE_SSL" == "false" ]]; then
export OVN_NB_DAEMON=$(ovn-nbctl --db="$(gen_conn_str 6641)" --pidfile --detach --overwrite-pidfile)
else
export OVN_NB_DAEMON=$(ovn-nbctl -p /var/run/tls/key -c /var/run/tls/cert -C /var/run/tls/cacert --db="$(gen_conn_str 6641)" --pidfile --detach --overwrite-pidfile)
nb_addr="$(gen_conn_str 6641)"
sb_addr="$(gen_conn_str 6642)"

for ((i=0; i<3; i++)); do
if [[ "$ENABLE_SSL" == "false" ]]; then
OVN_NB_DAEMON=$(ovn-nbctl --db="$nb_addr" --pidfile --detach --overwrite-pidfile)
else
OVN_NB_DAEMON=$(ovn-nbctl -p /var/run/tls/key -c /var/run/tls/cert -C /var/run/tls/cacert --db="$nb_addr" --pidfile --detach --overwrite-pidfile)
fi
if echo -n "${OVN_NB_DAEMON}" | grep -qE '^/var/run/ovn/ovn-nbctl\.[0-9]+\.ctl$'; then
export OVN_NB_DAEMON
break
fi
echo "invalid ovn-nbctl daemon socket: \"${OVN_NB_DAEMON}\""
unset OVN_NB_DAEMON
pkill -f ovn-nbctl
done

if [ -z "${OVN_NB_DAEMON}" ]; then
echo "failed to start ovn-nbctl daemon"
exit 1
fi
exec ./kube-ovn-controller --ovn-nb-addr="$(gen_conn_str 6641)" \
--ovn-sb-addr="$(gen_conn_str 6642)" \

exec ./kube-ovn-controller --ovn-nb-addr="$nb_addr" \
--ovn-sb-addr="$sb_addr" \
$@