mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 05:27:21 +00:00
Merge pull request #27546 from aveshagarwal/master-delete-ns-pod-reason
Automatic merge from submit-queue Add pod status reason when there are remaining pods. @yujuhong
This commit is contained in:
commit
00e7ab583e
@ -1067,17 +1067,24 @@ func deleteNS(c *client.Client, namespace string, timeout time.Duration) error {
|
|||||||
|
|
||||||
// check for pods that were not deleted
|
// check for pods that were not deleted
|
||||||
remaining := []string{}
|
remaining := []string{}
|
||||||
|
remainingPods := []api.Pod{}
|
||||||
missingTimestamp := false
|
missingTimestamp := false
|
||||||
if pods, perr := c.Pods(namespace).List(api.ListOptions{}); perr == nil {
|
if pods, perr := c.Pods(namespace).List(api.ListOptions{}); perr == nil {
|
||||||
for _, pod := range pods.Items {
|
for _, pod := range pods.Items {
|
||||||
Logf("Pod %s %s on node %s remains, has deletion timestamp %s", namespace, pod.Name, pod.Spec.NodeName, pod.DeletionTimestamp)
|
Logf("Pod %s %s on node %s remains, has deletion timestamp %s", namespace, pod.Name, pod.Spec.NodeName, pod.DeletionTimestamp)
|
||||||
remaining = append(remaining, pod.Name)
|
remaining = append(remaining, fmt.Sprintf("%s{Reason=%s}", pod.Name, pod.Status.Reason))
|
||||||
|
remainingPods = append(remainingPods, pod)
|
||||||
if pod.DeletionTimestamp == nil {
|
if pod.DeletionTimestamp == nil {
|
||||||
missingTimestamp = true
|
missingTimestamp = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// log pod status
|
||||||
|
if len(remainingPods) > 0 {
|
||||||
|
logPodStates(remainingPods)
|
||||||
|
}
|
||||||
|
|
||||||
// a timeout occurred
|
// a timeout occurred
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if missingTimestamp {
|
if missingTimestamp {
|
||||||
|
Loading…
Reference in New Issue
Block a user