Skip to content

Commit

Permalink
Merge pull request #357 from msherif1234/noo-mg-support
Browse files Browse the repository at this point in the history
NETOBSERV-987: Add must gather script for network observability
  • Loading branch information
openshift-merge-robot committed Apr 19, 2023
2 parents 0fcd575 + 7fd187c commit fc7a068
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
3 changes: 3 additions & 0 deletions collection-scripts/gather
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,8 @@ oc adm inspect --dest-dir must-gather --rotated-pod-logs "${all_ns_resources[@]}
# Gather PodNetworkConnectivityCheck
/usr/bin/gather_podnetworkconnectivitycheck

# Gather Network Observerability logs
/usr/bin/gather_network_observability

# force disk flush to ensure that all data gathered is accessible in the copy container
sync
29 changes: 29 additions & 0 deletions collection-scripts/gather_network_observability
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

0 comments on commit fc7a068

Please sign in to comment.