forked from RHsyseng/openshift-checks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ovs-hostnames
12 lines (11 loc) · 707 Bytes
/
ovs-hostnames
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/env bash
if oc auth can-i exec pod -n openshift-ovn-kubernetes > /dev/null 2>&1 && oc get ns openshift-ovn-kubernetes > /dev/null 2>&1; then
OVSHOSTNAMES=$(oc -n openshift-ovn-kubernetes exec pod/"$(oc -n openshift-ovn-kubernetes get pod -l app=ovnkube-master,component=network -o jsonpath='{.items[0].metadata.name}')" -c northd -- ovn-sbctl --no-leader-only list chassis | awk '/hostname/ { print $3 }' | sort -n)
if [ -n "${OVSHOSTNAMES}" ]; then
msg "OVS hostnames:\n${OVSHOSTNAMES}"
else
msg "Couldn't get ovs-hostnames, check permissions"
fi
else
msg "Couldn't get ovs-hostnames, either the cluster is not using OVN, or the running user has insufficient permissions"
fi