Skip to content

Commit

Permalink
Merge pull request #210 from red-hat-storage/sync_ds--main
Browse files Browse the repository at this point in the history
Syncing latest changes from main for odf-must-gather
  • Loading branch information
openshift-merge-bot[bot] authored Nov 13, 2024
2 parents de70d3e + 7922423 commit bf32b78
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
13 changes: 13 additions & 0 deletions collection-scripts/gather
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespaced=false
clusterscoped=false
help=false
default=true
minimal=false

# Store PIDs of all the subprocesses
pids=()
Expand Down Expand Up @@ -57,6 +58,11 @@ while [[ $# -gt 0 ]]; do
default=false
shift
;;
-m | --minimal)
minimal=true
default=false
shift
;;
-h | --help)
help=true
default=false
Expand Down Expand Up @@ -93,6 +99,7 @@ Options:
-cl, --ceph-logs Collect ceph daemon, kernel, journal logs and crash reports
-ns, --namespaced Collect namespaced resources
-cs, --clusterscoped Collect clusterscoped resources
-m, --minimal Collect storagecluster, cephcluster CRDs and operator CSVs
-h, --help Print this help message
Description:
Expand Down Expand Up @@ -197,6 +204,12 @@ if [ "$clusterscoped" == true ] && [ "$odf" == false ]; then
pids+=($!)
fi

if [ "$minimal" == true ]; then
echo "Collect minimal resource files..."
gather_minimal_resources ${BASE_COLLECTION_PATH} &
pids+=($!)
fi

# Preserve the functionality to accept and forward other args
# This is unused as of now but is there, just in case :)
if [ $# -gt 0 ]; then
Expand Down
32 changes: 32 additions & 0 deletions collection-scripts/gather_minimal_resources
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

# Expect base collection path as an exported variable
# If it is not defined, use PWD instead
BASE_COLLECTION_PATH=${BASE_COLLECTION_PATH:-"$(pwd)"}

MINIMAL_COLLECTION_PATH="${BASE_COLLECTION_PATH}/minimal_resources"

# Create directories for minimal resources collection
mkdir -p "${MINIMAL_COLLECTION_PATH}/oc_output"

# Define minimal resources
minimal_resources=()
minimal_resources+=(cephclusters)
minimal_resources+=(cephblockpools)
minimal_resources+=(cephfilesystems)
minimal_resources+=(csv)
minimal_resources+=(sc)
minimal_resources+=(configmaps)

# Collect resources except for storageclusters
for resource in "${minimal_resources[@]}"; do
dbglog "collecting dump ${resource}"
{ oc adm inspect --dest-dir="${MINIMAL_COLLECTION_PATH}" --all-namespaces ${LOG_FILTER_ARGS:+"${LOG_FILTER_ARGS}"} "${resource}" 2>&1; } | dbglog
done

# Special handling for storageclusters
dbglog "Collecting storageclusters"
{ oc get storageclusters --all-namespaces -o yaml; } > "${MINIMAL_COLLECTION_PATH}/oc_output/storageclusters.yaml" 2>&1

# Final message indicating completion
dbglog "Minimal resources collection completed."

0 comments on commit bf32b78

Please sign in to comment.