File tree 4 files changed +44
-1
lines changed 4 files changed +44
-1
lines changed Original file line number Diff line number Diff line change @@ -142,6 +142,10 @@ pids+=($!)
142
142
/usr/bin/gather_machineconfig_ondisk &
143
143
pids+=($! )
144
144
145
+ # Gather On-Disk MachineConfigDaemon logs
146
+ /usr/bin/gather_machineconfigdaemon_termination_logs &
147
+ pids+=($! )
148
+
145
149
# Gather vSphere resources. This is NOOP on non-vSphere platform.
146
150
/usr/bin/gather_vsphere &
147
151
pids+=($! )
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ function gather_machineconfig_ondisk {
16
16
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)
17
17
# collect the boostrap config that the Node got from the MCS
18
18
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 &
19
20
PIDS+=($! )
20
21
done
21
22
Original file line number Diff line number Diff line change
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
+
Original file line number Diff line number Diff line change @@ -190,7 +190,7 @@ resources=()
190
190
resources+=(performanceprofile)
191
191
192
192
# 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 )
194
194
195
195
echo " INFO: Waiting for node performance related collection to complete ..."
196
196
You can’t perform that action at this time.
0 commit comments