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
// if no container is found, then assuming it should be waiting seems plausible, but the status code requires
1702
+
// that a previous termination be present. If we're offline long enough (or something removed the container?), then
1703
+
// the previous termination may not be present. This next code block ensures that if the container was previously running
1704
+
// then when that container status disappears, we can infer that it terminated even if we don't know the status code.
1705
+
// By setting the lasttermination state we are able to leave the container status waiting and present more accurate
1706
+
// data via the API.
1707
+
1708
+
oldStatus, ok:=oldStatuses[container.Name]
1709
+
if!ok {
1710
+
continue
1711
+
}
1712
+
ifoldStatus.State.Terminated!=nil {
1713
+
// if the old container status was terminated, the lasttermination status is correct
1714
+
continue
1715
+
}
1716
+
ifoldStatus.State.Running==nil {
1717
+
// if the old container status isn't running, then waiting is an appropriate status and we have nothing to do
1718
+
continue
1719
+
}
1720
+
1721
+
ifpod.DeletionTimestamp==nil {
1722
+
continue
1723
+
}
1724
+
1725
+
// and if the pod itself is being deleted, then the CRI may have removed the container already and for whatever reason the kubelet missed the exit code
1726
+
// (this seems not awesome). We know at this point that we will not be restarting the container.
1727
+
status:=statuses[container.Name]
1728
+
// if the status we're about to write indicates the default, the Waiting status will force this pod back into Pending.
1729
+
// That isn't true, we know the pod is going away.
0 commit comments