Skip to content

Commit

Permalink
threading mg execution and ensuring that we alway exit 0 (true)
Browse files Browse the repository at this point in the history
  • Loading branch information
sferich888 committed May 28, 2020
1 parent 3cac0b5 commit e87e03e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
22 changes: 16 additions & 6 deletions collection-scripts/gather
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
BASE_COLLECTION_PATH="/must-gather"

# generate /must-gather/version file
. version
Expand Down Expand Up @@ -32,14 +33,23 @@ resources+=(imagecontentsourcepolicies.operator.openshift.io)
# Networking Resources
resources+=(networks.operator.openshift.io)

# Run the Collection of Resources using inspect
# running accross all-namespaces for the few "Autoscaler" resouces.
for resource in "${resources[@]}"; do
oc adm inspect --dest-dir must-gather ${resource}
LOG_DIR="${BASE_COLLECTION_PATH}/must-gather-resource-logs"
mkdir -p ${LOG_DIR}

PIDS=()
# Run the Collection of Resources using must-gather
for resource in ${resources[@]}; do
oc adm inspect ${resource} 2> ${LOG_DIR}/${resource/\//_}.log &
PIDS+=($!)
done

# Collect System Audit Logs
/usr/bin/gather_audit_logs
/usr/bin/gather_audit_logs &
PIDS+=($!)

# Gather Service Logs (using a suplamental Script); Scoped to Masters.
/usr/bin/gather_service_logs master
/usr/bin/gather_service_logs master &
PIDS+=($!)
wait ${PIDS[@]} ### Wait on all threads to complte.

exit 0 #### We always want our script to exit 0 to ensure some data collection.
2 changes: 2 additions & 0 deletions collection-scripts/gather_audit_logs
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ function collect_audit_logs { ### Takes an input of PATH

collect_audit_logs openshift-apiserver
collect_audit_logs kube-apiserver

exit 0
2 changes: 2 additions & 0 deletions collection-scripts/gather_service_logs
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ else
echo "Error: no role supplied or an invalid role was supplied." >&2
echo "Error: valid roles are 'master', 'worker', 'master,worker' or 'worker,master'." >&2
fi

exit 0

0 comments on commit e87e03e

Please sign in to comment.