Skip to content

Commit

Permalink
NETOBSERV-1616: collect flow metric object from netobserv ns
Browse files Browse the repository at this point in the history
Signed-off-by: Mohamed Mahmoud <[email protected]>
  • Loading branch information
msherif1234 committed Apr 24, 2024
1 parent 08563f9 commit 468c163
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions collection-scripts/gather_resources
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,23 @@ if [ -z "${NO_NS}" ]; then
exit 0
fi

CRD="flowcollectors.flows.netobserv.io"
obj=$(/usr/bin/oc get "${CRD}" -o custom-columns=:metadata.name --no-headers)
fc_ns=$(/usr/bin/oc get "${CRD}" "${obj}" --output=jsonpath='{.spec.namespace}')
FC_CRD="flowcollectors.flows.netobserv.io"
fc_obj=$(/usr/bin/oc get "${FC_CRD}" -o custom-columns=:metadata.name --no-headers)
fc_ns=$(/usr/bin/oc get "${FC_CRD}" "${fc_obj}" --output=jsonpath='{.spec.namespace}')

if [ -z "${fc_ns}" ]; then
echo "INFO: Network Observability flow collector object namespace is not detected. Skipping."
exit 0
fi

METRIC_CRD="flowmetrics.flows.netobserv.io"
metric_obj=$(/usr/bin/oc get "${METRIC_CRD}" -n "${fc_ns}" -o custom-columns=:metadata.name --no-headers)

"${DIR_NAME}"/version
oc adm inspect --dest-dir "${BASE_COLLECTION_PATH}" "${CRD}/${obj}"
oc adm inspect --dest-dir "${BASE_COLLECTION_PATH}" "${FC_CRD}/${fc_obj}"
if [ -n "${metric_obj}" ]; then
oc adm inspect --dest-dir "${BASE_COLLECTION_PATH}" -n "${fc_ns}" "${METRIC_CRD}/${metric_obj}"
fi
oc adm inspect --dest-dir "${BASE_COLLECTION_PATH}" "ns/${NO_NS}"
oc adm inspect --dest-dir "${BASE_COLLECTION_PATH}" "ns/${fc_ns}"
oc adm inspect --dest-dir "${BASE_COLLECTION_PATH}" "ns/${fc_ns}-privileged"

0 comments on commit 468c163

Please sign in to comment.