@@ -592,9 +592,13 @@ func (cmd *UpCmd) deployChart() {
592592
593593 if len (podList .Items ) > 0 {
594594 highestRevision := 0
595- var selectedPod k8sv1.Pod
595+ var selectedPod * k8sv1.Pod
596596
597597 for i , pod := range podList .Items {
598+ if kubectl .GetPodStatus (& pod ) == "Terminating" {
599+ continue
600+ }
601+
598602 podRevision , podHasRevision := pod .Annotations ["revision" ]
599603 hasHigherRevision := (i == 0 )
600604
@@ -607,27 +611,30 @@ func (cmd *UpCmd) deployChart() {
607611 }
608612
609613 if hasHigherRevision {
610- selectedPod = pod
614+ selectedPod = & pod
611615 highestRevision , _ = strconv .Atoi (podRevision )
612616 }
613617 }
614- _ , hasRevision := selectedPod .Annotations ["revision" ]
615618
616- if ! hasRevision || highestRevision == releaseRevision {
617- if ! hasRevision {
618- log .Warn ("Found pod without revision. Use annotation 'revision' for your pods to avoid this warning." )
619- }
619+ if selectedPod != nil {
620+ _ , hasRevision := selectedPod .Annotations ["revision" ]
620621
621- cmd .pod = & selectedPod
622- err = waitForPodReady (cmd .kubectl , cmd .pod , 2 * 60 * time .Second , 5 * time .Second )
622+ if ! hasRevision || highestRevision == releaseRevision {
623+ if ! hasRevision {
624+ log .Warn ("Found pod without revision. Use annotation 'revision' for your pods to avoid this warning." )
625+ }
623626
624- if err != nil {
625- log .Fatalf ("Error during waiting for pod: %s" , err .Error ())
626- }
627+ cmd .pod = selectedPod
628+ err = waitForPodReady (cmd .kubectl , cmd .pod , 2 * 60 * time .Second , 5 * time .Second )
627629
628- break
629- } else {
630- log .Info ("Waiting for release upgrade to complete." )
630+ if err != nil {
631+ log .Fatalf ("Error during waiting for pod: %s" , err .Error ())
632+ }
633+
634+ break
635+ } else {
636+ log .Info ("Waiting for release upgrade to complete." )
637+ }
631638 }
632639 } else {
633640 log .Info ("Waiting for release to be deployed." )
0 commit comments