Skip to content

Commit

Permalink
Merge pull request #939 from jlojosnegros/nro_error_messages
Browse files Browse the repository at this point in the history
must-gather: numaresources: Avoid error messages when NRO is not installed
  • Loading branch information
openshift-merge-robot committed Sep 6, 2022
2 parents d8b6678 + 3c1313a commit a78afbc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
27 changes: 16 additions & 11 deletions must-gather/collection-scripts/gather_nro
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
#!/usr/bin/env bash

# get crds
for crd_name in numaresourcesschedulers.nodetopology.openshift.io numaresourcesoperators.nodetopology.openshift.io noderesourcetopologies.topology.node.k8s.io
do
# get crd definition
oc adm inspect --dest-dir must-gather crd/${crd_name}

# get crd instances
oc adm inspect --dest-dir must-gather ${crd_name}
done

# Get NRO namespace and gather all the data there
. namespace
NRO_NAMESPACE=$(nro_namespace)

oc adm inspect --dest-dir must-gather ns/${NRO_NAMESPACE}
if [ -z "$NRO_NAMESPACE" ]
then
echo "Numaresources Operator namespace not detected. Skipping NRO data gathering"
else
# get crds
for crd_name in numaresourcesschedulers.nodetopology.openshift.io numaresourcesoperators.nodetopology.openshift.io noderesourcetopologies.topology.node.k8s.io
do
# get crd definition
oc adm inspect --dest-dir must-gather crd/${crd_name}

# get crd instances
oc adm inspect --dest-dir must-gather ${crd_name}
done

oc adm inspect --dest-dir must-gather ns/${NRO_NAMESPACE}
fi
3 changes: 0 additions & 3 deletions must-gather/collection-scripts/namespace
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,5 @@ function nro_namespace() {
# namespace suggested by the documentation. This is a fancier way to check for its existence
[ -z "${ns}" ] && ns=$(oc get ns openshift-numaresources -o=jsonpath='{.metadata.name}{"\n"}' 2> /dev/null )

# we should never get there. This is the last resort.
[ -z "${ns}" ] && ns="openshift-numaresources"

echo ${ns}
}

0 comments on commit a78afbc

Please sign in to comment.