-
Notifications
You must be signed in to change notification settings - Fork 12
/
gather
executable file
·26 lines (19 loc) · 1.01 KB
/
gather
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash
source $(dirname "$0")/common.sh
get_log_collection_args
SUBSCRIPTION_NAME=${SUBSCRIPTION_NAME:-secrets-store-csi-driver-operator}
DESTINATION_DIR=${DESTINATION_DIR:-must-gather/}
NAMESPACE=$(/usr/bin/oc get subscription --all-namespaces --field-selector="metadata.name=${SUBSCRIPTION_NAME}" --output='jsonpath={.items[0].metadata.namespace}')
if [ $? -ne 0 ]; then
echo "Failed to find namespace for subscription ${SUBSCRIPTION_NAME}"
exit 1
fi
echo "Found subscription ${SUBSCRIPTION_NAME} in namespace ${NAMESPACE}"
/usr/bin/oc adm inspect ${log_collection_args} namespace/${NAMESPACE} --dest-dir=must-gather/
for CRD in $(/usr/bin/oc get crd | grep secrets-store.csi.x-k8s.io | awk '{print $1}'); do
echo "Gathering data for CRD ${CRD}"
/usr/bin/oc adm inspect ${log_collection_args} ${CRD} --all-namespaces --dest-dir=must-gather/
done
echo "Gathering data for ClusterCSIDrivers and CSIDrivers"
/usr/bin/oc adm inspect ${log_collection_args} clustercsidrivers,csidrivers --dest-dir=must-gather/
exit 0