Last active
April 2, 2024 23:54
-
-
Save dlbewley/b4d4c85931e7a9c03caf56db1a1a0d2e to your computer and use it in GitHub Desktop.
OpenShift OVN Northbound DB CLI Access
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
#!/bin/bash | |
# Connect to the OVN northbound database pod. | |
# Optionally specify on which node. | |
node=$1 | |
if [[ -n "$node" ]]; then | |
nbdbpod=$(oc get pod \ | |
-l app=ovnkube-node \ | |
-n openshift-ovn-kubernetes \ | |
-o go-template='{{range .items}}{{if eq .spec.nodeName "'$node'"}}{{.metadata.name}}{{"\n"}}{{end}}{{end}}') | |
fi | |
if [[ -z "$nbdbpod" ]]; then | |
nbdbpod=$(oc get pod \ | |
-l app=ovnkube-node \ | |
-n openshift-ovn-kubernetes \ | |
-o jsonpath='{.items[0].metadata.name}') | |
fi | |
oc rsh -c nbdb -n openshift-ovn-kubernetes $nbdbpod |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment