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

Check both nb.sb #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions dist/images/ovndb-raft-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ check_ovnkube_db_ep() {
}

check_and_apply_ovnkube_db_ep() {
local port=${1}

# Get IPs of all ovnkube-db PODs
ips=()
for ((i = 0; i < ${replicas}; i++)); do
Expand All @@ -78,7 +76,8 @@ check_and_apply_ovnkube_db_ep() {
fi

for ip in ${ips[@]}; do
wait_for_event attempts=10 check_ovnkube_db_ep ${ip} ${port}
wait_for_event attempts=10 check_ovnkube_db_ep ${ip} ${ovn_nb_port}
wait_for_event attempts=10 check_ovnkube_db_ep ${ip} ${ovn_sb_port}
done
set_ovnkube_db_ep ${ips[@]}
else
Expand Down Expand Up @@ -191,9 +190,9 @@ ovsdb_cleanup() {
# v3 - create nb_ovsdb/sb_ovsdb cluster in a separate container
ovsdb-raft() {
local db=${1}
local port=${2}
local raft_port=${3}
local election_timer=${4}
eval port=\$ovn_${db}_port
eval raft_port=\$ovn_${db}_raft_port
eval election_timer=\$ovn_${db}_raft_election_timer
local initialize="false"

ovn_db_pidfile=${OVN_RUNDIR}/ovn${db}_db.pid
Expand Down Expand Up @@ -278,8 +277,8 @@ ovsdb-raft() {
last_node_index=$(expr ${replicas} - 1)
# Create endpoints only if all ovnkube-db pods have started and are running. We do this
# from the last pod of the statefulset.
if [[ ${db} == "nb" && "${POD_NAME}" == "ovnkube-db-"${last_node_index} ]]; then
check_and_apply_ovnkube_db_ep ${port}
if [[ ${db} == "sb" && "${POD_NAME}" == "ovnkube-db-"${last_node_index} ]]; then
check_and_apply_ovnkube_db_ep
fi

tail --follow=name ${OVN_LOGDIR}/ovsdb-server-${db}.log &
Expand Down
6 changes: 4 additions & 2 deletions dist/images/ovnkube.sh
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,9 @@ sb-ovsdb() {
ovn-sbctl --inactivity-probe=0 set-connection p${transport}:${ovn_sb_port}:[${ovn_db_host}]

# create the ovnkube-db endpoints
# first check we can access both NB/SB DBs
wait_for_event attempts=10 check_ovnkube_db_ep ${ovn_db_host} ${ovn_nb_port}
wait_for_event attempts=10 check_ovnkube_db_ep ${ovn_db_host} ${ovn_sb_port}
set_ovnkube_db_ep ${ovn_db_host}

tail --follow=name ${OVN_LOGDIR}/ovsdb-server-sb.log &
Expand Down Expand Up @@ -1016,10 +1018,10 @@ case ${cmd} in
cleanup-ovn-node
;;
"nb-ovsdb-raft")
ovsdb-raft nb ${ovn_nb_port} ${ovn_nb_raft_port} ${ovn_nb_raft_election_timer}
ovsdb-raft nb
;;
"sb-ovsdb-raft")
ovsdb-raft sb ${ovn_sb_port} ${ovn_sb_raft_port} ${ovn_sb_raft_election_timer}
ovsdb-raft sb
;;
"db-raft-metrics")
db-raft-metrics
Expand Down
2 changes: 2 additions & 0 deletions dist/templates/ovnkube-db-raft.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ spec:
value: "{{ ovn_ssl_en }}"
- name: OVN_SB_RAFT_ELECTION_TIMER
value: "{{ ovn_sb_raft_election_timer }}"
- name: OVN_NB_PORT
value: "{{ ovn_nb_port }}"
- name: OVN_SB_PORT
value: "{{ ovn_sb_port }}"
- name: OVN_SB_RAFT_PORT
Expand Down
2 changes: 2 additions & 0 deletions dist/templates/ovnkube-db.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ spec:
fieldPath: status.hostIP
- name: OVN_SSL_ENABLE
value: "{{ ovn_ssl_en }}"
- name: OVN_NB_PORT
value: "{{ ovn_nb_port }}"
- name: OVN_SB_PORT
value: "{{ ovn_sb_port }}"
readinessProbe:
Expand Down