@@ -594,9 +594,13 @@ func (cmd *UpCmd) deployChart() {
594594
595595 if len (podList .Items ) > 0 {
596596 highestRevision := 0
597- var selectedPod k8sv1.Pod
597+ var selectedPod * k8sv1.Pod
598598
599599 for i , pod := range podList .Items {
600+ if kubectl .GetPodStatus (& pod ) == "Terminating" {
601+ continue
602+ }
603+
600604 podRevision , podHasRevision := pod .Annotations ["revision" ]
601605 hasHigherRevision := (i == 0 )
602606
@@ -609,27 +613,30 @@ func (cmd *UpCmd) deployChart() {
609613 }
610614
611615 if hasHigherRevision {
612- selectedPod = pod
616+ selectedPod = & pod
613617 highestRevision , _ = strconv .Atoi (podRevision )
614618 }
615619 }
616- _ , hasRevision := selectedPod .Annotations ["revision" ]
617620
618- if ! hasRevision || highestRevision == releaseRevision {
619- if ! hasRevision {
620- log .Warn ("Found pod without revision. Use annotation 'revision' for your pods to avoid this warning." )
621- }
621+ if selectedPod != nil {
622+ _ , hasRevision := selectedPod .Annotations ["revision" ]
622623
623- cmd .pod = & selectedPod
624- err = waitForPodReady (cmd .kubectl , cmd .pod , 2 * 60 * time .Second , 5 * time .Second )
624+ if ! hasRevision || highestRevision == releaseRevision {
625+ if ! hasRevision {
626+ log .Warn ("Found pod without revision. Use annotation 'revision' for your pods to avoid this warning." )
627+ }
625628
626- if err != nil {
627- log .Fatalf ("Error during waiting for pod: %s" , err .Error ())
628- }
629+ cmd .pod = selectedPod
630+ err = waitForPodReady (cmd .kubectl , cmd .pod , 2 * 60 * time .Second , 5 * time .Second )
629631
630- break
631- } else {
632- log .Info ("Waiting for release upgrade to complete." )
632+ if err != nil {
633+ log .Fatalf ("Error during waiting for pod: %s" , err .Error ())
634+ }
635+
636+ break
637+ } else {
638+ log .Info ("Waiting for release upgrade to complete." )
639+ }
633640 }
634641 } else {
635642 log .Info ("Waiting for release to be deployed." )
0 commit comments