You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Check if the container has restarted by examining its restart count
182
-
restartCount=$(kubectl --context="${context}" get pod -n "${namespace}""${pod}" -o jsonpath="{.status.containerStatuses[?(@.name=='${container}')].restartCount}")
177
+
forcontainerin$(kubectl --context="${context}" get pods -n "${namespace}""${pod}" -o jsonpath='{.spec.containers[*].name}');do
178
+
echo"Writing log file for pod ${pod} - container ${container} to logs/${prefix}${pod}-${container}.log"
# Check if the container has restarted by examining its restart count
182
+
restartCount=$(kubectl --context="${context}" get pod -n "${namespace}""${pod}" -o jsonpath="{.status.containerStatuses[?(@.name=='${container}')].restartCount}")
188
183
189
-
done
190
-
fi
184
+
if [ "${restartCount}"-gt 0 ];then
185
+
echo"Writing log file for restarted ${pod} - container ${container} to logs/${prefix}${pod}-${container}-previous.log"
0 commit comments