diff --git a/charts/kube-ovn/templates/central-deploy.yaml b/charts/kube-ovn/templates/central-deploy.yaml index 481a048e0df..5947e162fbe 100644 --- a/charts/kube-ovn/templates/central-deploy.yaml +++ b/charts/kube-ovn/templates/central-deploy.yaml @@ -45,6 +45,7 @@ spec: image: {{ .Values.global.registry.address }}/{{ .Values.global.images.kubeovn.repository }}:{{ .Values.global.images.kubeovn.tag }} imagePullPolicy: {{ .Values.image.pullPolicy }} command: + - bash - /kube-ovn/start-db.sh securityContext: runAsUser: 0 diff --git a/dist/images/install.sh b/dist/images/install.sh index 6dc342a0d1a..03a0fdd6974 100755 --- a/dist/images/install.sh +++ b/dist/images/install.sh @@ -3418,6 +3418,7 @@ spec: image: "$REGISTRY/kube-ovn:$VERSION" imagePullPolicy: $IMAGE_PULL_POLICY command: + - bash - /kube-ovn/start-db.sh securityContext: runAsUser: 0 diff --git a/dist/images/start-db.sh b/dist/images/start-db.sh index c160f183252..aea83910f25 100755 --- a/dist/images/start-db.sh +++ b/dist/images/start-db.sh @@ -41,6 +41,9 @@ SB_CLUSTER_PORT=${SB_CLUSTER_PORT:-6644} ENABLE_SSL=${ENABLE_SSL:-false} ENABLE_BIND_LOCAL_IP=${ENABLE_BIND_LOCAL_IP:-false} +echo "ENABLE_SSL is set to $ENABLE_SSL" +echo "ENABLE_BIND_LOCAL_IP is set to $ENABLE_BIND_LOCAL_IP" + DB_ADDR=:: DB_ADDRESSES=:: if [[ $ENABLE_BIND_LOCAL_IP == "true" ]]; then @@ -49,11 +52,9 @@ if [[ $ENABLE_BIND_LOCAL_IP == "true" ]]; then fi SSL_OPTIONS= -function ssl_options() { - if "$ENABLE_SSL" != "false" ]; then - SSL_OPTIONS="-p /var/run/tls/key -c /var/run/tls/cert -C /var/run/tls/cacert" - fi -} +if [ "$ENABLE_SSL" != "false" ]; then + SSL_OPTIONS="-p /var/run/tls/key -c /var/run/tls/cert -C /var/run/tls/cacert" +fi . /usr/share/openvswitch/scripts/ovs-lib || exit 1 @@ -139,6 +140,7 @@ function is_clustered { function set_nb_version_compatibility() { if [ -n "$OVN_VERSION_COMPATIBILITY" ]; then if ! ovn-nbctl --db=$(gen_conn_str 6641) $SSL_OPTIONS get NB_Global . options | grep -q version_compatibility=; then + echo "setting ovn NB_Global option version_compatibility to ${OVN_VERSION_COMPATIBILITY}" ovn-nbctl --db=$(gen_conn_str 6641) $SSL_OPTIONS set NB_Global . options:version_compatibility=${OVN_VERSION_COMPATIBILITY} return fi diff --git a/dist/images/upgrade-ovs.sh b/dist/images/upgrade-ovs.sh index 33232bc755c..cfde7f7e6f5 100755 --- a/dist/images/upgrade-ovs.sh +++ b/dist/images/upgrade-ovs.sh @@ -10,11 +10,9 @@ OVN_VERSION_COMPATIBILITY=${OVN_VERSION_COMPATIBILITY:-} UPDATE_STRATEGY=`kubectl -n kube-system get ds ovs-ovn -o jsonpath='{.spec.updateStrategy.type}'` SSL_OPTIONS= -function ssl_options() { - if "$ENABLE_SSL" != "false" ]; then - SSL_OPTIONS="-p /var/run/tls/key -c /var/run/tls/cert -C /var/run/tls/cacert" - fi -} +if [ "$ENABLE_SSL" != "false" ]; then + SSL_OPTIONS="-p /var/run/tls/key -c /var/run/tls/cert -C /var/run/tls/cacert" +fi function gen_conn_str { if [[ -z "${OVN_DB_IPS}" ]]; then @@ -38,7 +36,7 @@ nb_addr="$(gen_conn_str 6641)" while true; do if [ x`ovn-nbctl --db=$nb_addr $SSL_OPTIONS get NB_Global . options | grep -o 'version_compatibility='` != "x" ]; then value=`ovn-nbctl --db=$nb_addr $SSL_OPTIONS get NB_Global . options:version_compatibility | sed -e 's/^"//' -e 's/"$//'` - echo "ovn NB_Global option version_compatibility is set to $value" + echo "ovn NB_Global option version_compatibility is already set to $value" if [ "$value" = "$OVN_VERSION_COMPATIBILITY" -o "$value" = "_$OVN_VERSION_COMPATIBILITY" ]; then break fi