File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,18 @@ check_component_restart() {
122122 if [ " $restart_count " -gt 0 ]; then
123123 echo " ERROR: ${component_name} pod $pod_name has restarted $restart_count times."
124124 echo " This indicates OOM or panic occurred and needs to be investigated."
125+
126+ # Collect logs from the previous container instance
127+ echo " Collecting logs from previous container instance for ${component_name} pod $pod_name ..."
128+ local log_file=" $ARTIFACTS_PATH /${component_name} -${pod_name} -previous-logs.log"
129+ kubectl --context=" ${KARMADA_HOST_CLUSTER_NAME} " logs -p " $pod_name " -n karmada-system > " $log_file " 2>&1
130+
131+ if [ $? -eq 0 ]; then
132+ echo " Previous container logs saved to: $log_file "
133+ else
134+ echo " Warning: Failed to collect previous container logs for pod $pod_name "
135+ fi
136+
125137 return 1 # Return failure to stop checking
126138 else
127139 echo " ${component_name} pod $pod_name : no restarts"
You can’t perform that action at this time.
0 commit comments