-
Notifications
You must be signed in to change notification settings - Fork 186
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 #357 from msherif1234/noo-mg-support
NETOBSERV-987: Add must gather script for network observability
- Loading branch information
Showing
2 changed files
with
32 additions
and
0 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,29 @@ | ||
#!/bin/bash | ||
BASE_COLLECTION_PATH="must-gather" | ||
NO_NS="$(oc get subs -A -o template --template '{{range .items}}{{if eq .spec.name "netobserv-operator"}}{{.metadata.namespace}}{{end}}{{end}}')" | ||
|
||
if [ -z "${NO_NS}" ]; then | ||
echo "INFO: Network Observability namespace is not detected. Skipping." | ||
exit 0 | ||
fi | ||
|
||
function get_netobserv_cluster_crs() { | ||
CRD="flowcollectors.flows.netobserv.io" | ||
oc adm inspect --dest-dir "${BASE_COLLECTION_PATH}" "${CRD}" | ||
obj=$(oc get ${CRD} -o custom-columns=:metadata.name --no-headers) | ||
FC_NS=$(oc get ${CRD} ${obj} --output=jsonpath='{.spec.namespace}') | ||
} | ||
|
||
oc adm inspect --dest-dir "${BASE_COLLECTION_PATH}" "ns/${NO_NS}" | ||
|
||
get_netobserv_cluster_crs | ||
if [ -z "${FC_NS}" ]; then | ||
echo "INFO: Network Observability flow collector object namespace is not detected. Skipping." | ||
exit 0 | ||
fi | ||
oc adm inspect --dest-dir "${BASE_COLLECTION_PATH}" "ns/${FC_NS}" | ||
oc adm inspect --dest-dir "${BASE_COLLECTION_PATH}" "ns/${FC_NS}-privileged" | ||
|
||
|
||
# force disk flush to ensure that all data gathered is accessible in the copy container | ||
sync |