Skip to content

Commit

Permalink
fix: scripts (#4291)
Browse files Browse the repository at this point in the history
* fix: scripts

---------

Signed-off-by: bobz965 <[email protected]>
Co-authored-by: 张祖建 <[email protected]>
  • Loading branch information
bobz965 and zhangzujian authored Jul 23, 2024
1 parent 9229c45 commit 05984fc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
1 change: 1 addition & 0 deletions charts/kube-ovn/templates/central-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions dist/images/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3418,6 +3418,7 @@ spec:
image: "$REGISTRY/kube-ovn:$VERSION"
imagePullPolicy: $IMAGE_PULL_POLICY
command:
- bash
- /kube-ovn/start-db.sh
securityContext:
runAsUser: 0
Expand Down
12 changes: 7 additions & 5 deletions dist/images/start-db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down
10 changes: 4 additions & 6 deletions dist/images/upgrade-ovs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 05984fc

Please sign in to comment.