Skip to content

Commit 6c61d2b

Browse files
committed
Gather NRO related data
Need to gather data regarding new NUMA resources operator but currently must-gather does not collect this data. Different approachs were discussed but in the end we have decided to collect NRO data here to avoid creating new must-gather images.
1 parent c8a7151 commit 6c61d2b

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed

must-gather/collection-scripts/gather

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ echo "performance-addon-operator/must-gather" > /must-gather/version
66
version >> /must-gather/version
77

88
. namespace
9-
PAO_NAMESPACE=$( namespace )
9+
PAO_NAMESPACE=$( pao_namespace )
1010

1111
# resource list
1212
resources=()
@@ -28,5 +28,7 @@ done
2828
# Collect nodes details
2929
/usr/bin/gather_nodes
3030

31+
# Collect NRO details
32+
/usr/bin/gather_nro
3133
exit 0
3234

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
3+
# get crds
4+
for crd_name in numaresourcesschedulers.nodetopology.openshift.io numaresourcesoperators.nodetopology.openshift.io noderesourcetopologies.topology.node.k8s.io
5+
do
6+
# get crd definition
7+
oc adm inspect --dest-dir must-gather crd/${crd_name}
8+
9+
# get crd instances
10+
oc adm inspect --dest-dir must-gather ${crd_name}
11+
done
12+
13+
# Get NRO namespace and gather all the data there
14+
. namespace
15+
NRO_NAMESPACE=$(nro_namespace)
16+
17+
oc adm inspect --dest-dir must-gather ns/${NRO_NAMESPACE}

must-gather/collection-scripts/namespace

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
function namespace() {
3+
function pao_namespace() {
44
# we control the subs, so this is the most reliable way to get the namespace
55
ns=$( oc get subs -A --field-selector metadata.name='performance-addon-operator-subscription' -o=jsonpath='{.items[0].metadata.namespace}{"\n"}' 2> /dev/null )
66
# trying again with the pods, which are _usually_ reliable - but users can change them
@@ -11,3 +11,19 @@ function namespace() {
1111
[ -z "${ns}" ] && ns="openshift-operators"
1212
echo ${ns}
1313
}
14+
15+
function nro_namespace() {
16+
# we control the subs, so this is the most reliable way to get the namespace
17+
ns=$( oc get subs -A --field-selector metadata.name='numaresources-operator-subscription' -o=jsonpath='{.items[0].metadata.namespace}{"\n"}' 2> /dev/null )
18+
19+
# trying again with the pods, which are _usually_ reliable - but users can change them
20+
[ -z "${ns}" ] && ns=$( oc get pods -A -l name='resource-topology' -o=jsonpath='{.items[0].metadata.namespace}{"\n"}' 2> /dev/null )
21+
22+
# namespace suggested by the documentation. This is a fancier way to check for its existence
23+
[ -z "${ns}" ] && ns=$(oc get ns openshift-numaresources -o=jsonpath='{.metadata.name}{"\n"}' 2> /dev/null )
24+
25+
# we should never get there. This is the last resort.
26+
[ -z "${ns}" ] && ns="openshift-numaresources"
27+
28+
echo ${ns}
29+
}

0 commit comments

Comments
 (0)