-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #360 from fernandoroyosanchez/ovn_controller_healt…
…hchecks Add Liveness and Readiness probes to ovn-controller
- Loading branch information
Showing
21 changed files
with
454 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
error_exit() { | ||
echo "$1" >&2 | ||
exit 1 | ||
} | ||
|
||
# Check if ovn-controller is running | ||
check_ovn_controller_pid() { | ||
if ! pidof -q ovn-controller; then | ||
error_exit "ERROR - ovn-controller is not running" | ||
fi | ||
} | ||
|
||
# Function to check the running status of ovn-controller | ||
check_ovn_controller_status() { | ||
# Capture output and check exit status | ||
if ! output=$(ovn-appctl -t ovn-controller debug/status 2>&1); then | ||
error_exit "ERROR - Failed to get status from ovn-controller, ovn-appctl exit status: $?" | ||
fi | ||
|
||
if [ "$output" != "running" ]; then | ||
error_exit "ERROR - ovn-controller status is '$output', expecting 'running' status" | ||
fi | ||
} | ||
|
||
|
||
check_ovn_controller_pid | ||
check_ovn_controller_status |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
error_exit() { | ||
echo "$1" >&2 | ||
exit 1 | ||
} | ||
|
||
# Check if ovn-controller is connected to the OVN SB database | ||
check_ovn_controller_connection() { | ||
if ! output=$(ovn-appctl -t ovn-controller connection-status 2>&1); then | ||
error_exit "ERROR - Failed to get connection status from ovn-controller, ovn-appctl exit status: $?" | ||
fi | ||
|
||
if [ "$output" != "connected" ]; then | ||
error_exit "ERROR - ovn-controller connection status is '$output', expecting 'connected' status" | ||
fi | ||
} | ||
|
||
|
||
check_ovn_controller_connection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
error_exit() { | ||
echo "$1" >&2 | ||
exit 1 | ||
} | ||
|
||
# Check if ovsdb-server is running | ||
check_ovsdb_server_pid() { | ||
if ! pidof -q ovsdb-server; then | ||
error_exit "ERROR - ovsdb-server is not running" | ||
fi | ||
} | ||
|
||
# Function to check the running status of ovsdb-server | ||
check_ovsdb_server_status() { | ||
if ! /usr/bin/ovs-vsctl show 2>&1; then | ||
error_exit "ERROR - Failed to get output from ovsdb-server, ovs-vsctl exit status: $?" | ||
fi | ||
} | ||
|
||
|
||
check_ovsdb_server_pid | ||
check_ovsdb_server_status |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
error_exit() { | ||
echo "$1" >&2 | ||
exit 1 | ||
} | ||
|
||
# Check ovsdb-server status | ||
check_ovsdb_server_status() { | ||
|
||
if ! pid=$(cat /var/run/openvswitch/ovsdb-server.pid); then | ||
error_exit "ERROR - Failed to get pid for ovsdb-server, exit status: $?" | ||
fi | ||
|
||
if ! output=$(ovs-appctl -t /var/run/openvswitch/ovsdb-server."$pid".ctl ovsdb-server/list-dbs); then | ||
error_exit "ERROR - Failed retrieving list of databases from ovsdb-server" | ||
fi | ||
|
||
if [[ "$output" != *"Open_vSwitch"* ]]; then | ||
error_exit "ERROR - 'Open_vSwitch' not found on databases" | ||
fi | ||
} | ||
|
||
check_ovsdb_server_status |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
error_exit() { | ||
echo "$1" >&2 | ||
exit 1 | ||
} | ||
|
||
# Check if ovs-vswitchd is running | ||
check_ovs_vswitchd_pid() { | ||
if ! pidof -q ovs-vswitchd; then | ||
error_exit "ERROR - ovs-vswitchd is not running" | ||
fi | ||
} | ||
|
||
# Function to check the running status of ovs-vswitchd | ||
check_ovs_vswitchd_status() { | ||
if ! /usr/bin/ovs-appctl bond/show 2>&1; then | ||
error_exit "ERROR - Failed to get output from ovs-vswitchd, ovs-appctl exit status: $?" | ||
fi | ||
} | ||
|
||
|
||
check_ovs_vswitchd_pid | ||
check_ovs_vswitchd_status |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
error_exit() { | ||
echo "$1" >&2 | ||
exit 1 | ||
} | ||
|
||
# Check ovs-vswitchd status | ||
check_ovs_vswitchd_status() { | ||
|
||
if ! pid=$(cat /var/run/openvswitch/ovs-vswitchd.pid); then | ||
error_exit "ERROR - Failed to get pid for ovs-vswitchd, exit status: $?" | ||
fi | ||
|
||
if ! output=$(ovs-appctl -t /var/run/openvswitch/ovs-vswitchd."$pid".ctl ofproto/list); then | ||
error_exit "ERROR - Failed retrieving ofproto/list from ovs-vswitchd" | ||
fi | ||
|
||
if [ -z "$output" ]; then | ||
error_exit "ERROR - No bridges on ofproto/list output" | ||
fi | ||
} | ||
|
||
check_ovs_vswitchd_status |
Oops, something went wrong.