Skip to content

Commit 77e5739

Browse files
Merge pull request #468 from djoshy/add-mc-logs
NO-ISSUE: gather additional MCO debug artifacts
2 parents eb21896 + 1781c73 commit 77e5739

File tree

4 files changed

+44
-1
lines changed

4 files changed

+44
-1
lines changed

collection-scripts/gather

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ pids+=($!)
142142
/usr/bin/gather_machineconfig_ondisk &
143143
pids+=($!)
144144

145+
# Gather On-Disk MachineConfigDaemon logs
146+
/usr/bin/gather_machineconfigdaemon_termination_logs &
147+
pids+=($!)
148+
145149
# Gather vSphere resources. This is NOOP on non-vSphere platform.
146150
/usr/bin/gather_vsphere &
147151
pids+=($!)

collection-scripts/gather_machineconfig_ondisk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ function gather_machineconfig_ondisk {
1616
DAEMONPOD=$(oc get pods -n openshift-machine-config-operator --field-selector spec.nodeName=${NODE} --selector k8s-app=machine-config-daemon -o custom-columns=:metadata.name --no-headers)
1717
# collect the boostrap config that the Node got from the MCS
1818
timeout -v 1m oc cp -c machine-config-daemon openshift-machine-config-operator/"${DAEMONPOD}":rootfs/etc/mcs-machine-config-content.json "${MACHINECONFIG_CONFIG_PATH}"/"${NODE}"/mcs-machine-config-content.json &
19+
timeout -v 1m oc cp -c machine-config-daemon openshift-machine-config-operator/"${DAEMONPOD}":rootfs/etc/machine-config-daemon/bootstrapconfigdiff "${MACHINECONFIG_CONFIG_PATH}"/"${NODE}"/bootstrapconfigdiff &
1920
PIDS+=($!)
2021
done
2122

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
3+
BASE_COLLECTION_PATH="must-gather"
4+
MACHINECONFIG_DAEMON_LOG_PATH=${OUT:-"${BASE_COLLECTION_PATH}/machine_config_termination_logs"}
5+
6+
mkdir -p "${MACHINECONFIG_DAEMON_LOG_PATH}"/
7+
8+
# gather_machineconfigdaemon_termination_logs collects the daemon logs before it was last terminated
9+
function gather_machineconfigdaemon_termination_logs {
10+
11+
echo "INFO: Gathering machine config daemon's old logs from all nodes"
12+
NODES=$(oc get nodes -o jsonpath='{.items[?(@.kind=="Node")].metadata.name}')
13+
for NODE in ${NODES}; do
14+
# use the existing MCD pod on the node to get the files
15+
DAEMONPOD=$(oc get pods -n openshift-machine-config-operator --field-selector spec.nodeName=${NODE} --selector k8s-app=machine-config-daemon -o custom-columns=:metadata.name --no-headers)
16+
# Check if the 'previous-logs' folder exists on the MCD pod
17+
FOLDER_EXISTS=$(oc exec -n openshift-machine-config-operator "${DAEMONPOD}" -c machine-config-daemon -- sh -c '[ -d "/rootfs/etc/machine-config-daemon/previous-logs" ] && echo "exists"' 2>/dev/null)
18+
# collect the logs from the location that MCD saves to prior to shutdown
19+
if [ "${FOLDER_EXISTS}" == "exists" ]; then
20+
timeout -v 1m oc cp -c machine-config-daemon openshift-machine-config-operator/"${DAEMONPOD}":rootfs/etc/machine-config-daemon/previous-logs "${MACHINECONFIG_DAEMON_LOG_PATH}"/"${NODE}"/ &
21+
PIDS+=($!)
22+
else
23+
echo "INFO: 'previous-logs' folder not found on ${NODE}, skipping..."
24+
fi
25+
done
26+
27+
}
28+
29+
PIDS=()
30+
gather_machineconfigdaemon_termination_logs
31+
32+
echo "INFO: Waiting for Machine Config Daemon termination log collection to complete ..."
33+
wait "${PIDS[@]}"
34+
echo "INFO: Machine Config Daemon termination log collection complete."
35+
36+
# force disk flush to ensure that all data gathered is accessible in the copy container
37+
sync
38+

collection-scripts/gather_ppc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ resources=()
190190
resources+=(performanceprofile)
191191

192192
# machine/node resources
193-
resources+=(nodes machineconfigs machineconfigpools featuregates kubeletconfigs tuneds runtimeclasses machineosconfigs machineosbuilds)
193+
resources+=(nodes machineconfigs machineconfigpools featuregates kubeletconfigs tuneds runtimeclasses machineosconfigs machineosbuilds machineconfigurations)
194194

195195
echo "INFO: Waiting for node performance related collection to complete ..."
196196

0 commit comments

Comments
 (0)