@@ -592,6 +592,7 @@ func TestUpdate(t *testing.T) {
592592 Spec : v1.PodSpec {ReadinessGates : []v1.PodReadinessGate {{ConditionType : appspub .InPlaceUpdateReady }}},
593593 Status : v1.PodStatus {Phase : v1 .PodRunning , Conditions : []v1.PodCondition {
594594 {Type : v1 .PodReady , Status : v1 .ConditionFalse },
595+ {Type : v1 .ContainersReady , Status : v1 .ConditionTrue },
595596 {Type : appspub .InPlaceUpdateReady , Status : v1 .ConditionTrue },
596597 }},
597598 },
@@ -606,6 +607,7 @@ func TestUpdate(t *testing.T) {
606607 Spec : v1.PodSpec {ReadinessGates : []v1.PodReadinessGate {{ConditionType : appspub .InPlaceUpdateReady }}},
607608 Status : v1.PodStatus {Phase : v1 .PodRunning , Conditions : []v1.PodCondition {
608609 {Type : v1 .PodReady , Status : v1 .ConditionFalse },
610+ {Type : v1 .ContainersReady , Status : v1 .ConditionTrue },
609611 {Type : appspub .InPlaceUpdateReady , Status : v1 .ConditionTrue },
610612 }},
611613 },
@@ -669,6 +671,7 @@ func TestUpdate(t *testing.T) {
669671 Spec : v1.PodSpec {ReadinessGates : []v1.PodReadinessGate {{ConditionType : appspub .InPlaceUpdateReady }}},
670672 Status : v1.PodStatus {Phase : v1 .PodRunning , Conditions : []v1.PodCondition {
671673 {Type : v1 .PodReady , Status : v1 .ConditionFalse },
674+ {Type : v1 .ContainersReady , Status : v1 .ConditionTrue },
672675 {Type : appspub .InPlaceUpdateReady , Status : v1 .ConditionTrue },
673676 }},
674677 },
@@ -684,6 +687,7 @@ func TestUpdate(t *testing.T) {
684687 Spec : v1.PodSpec {ReadinessGates : []v1.PodReadinessGate {{ConditionType : appspub .InPlaceUpdateReady }}},
685688 Status : v1.PodStatus {Phase : v1 .PodRunning , Conditions : []v1.PodCondition {
686689 {Type : v1 .PodReady , Status : v1 .ConditionFalse },
690+ {Type : v1 .ContainersReady , Status : v1 .ConditionTrue },
687691 {Type : appspub .InPlaceUpdateReady , Status : v1 .ConditionTrue },
688692 }},
689693 },
@@ -843,6 +847,7 @@ func TestUpdate(t *testing.T) {
843847 Phase : v1 .PodRunning ,
844848 Conditions : []v1.PodCondition {
845849 {Type : v1 .PodReady , Status : v1 .ConditionTrue },
850+ {Type : v1 .ContainersReady , Status : v1 .ConditionTrue },
846851 {Type : appspub .InPlaceUpdateReady , Status : v1 .ConditionTrue , LastTransitionTime : now },
847852 },
848853 ContainerStatuses : []v1.ContainerStatus {{Name : "c1" , ImageID : "image-id-xyz" }},
@@ -867,6 +872,7 @@ func TestUpdate(t *testing.T) {
867872 Phase : v1 .PodRunning ,
868873 Conditions : []v1.PodCondition {
869874 {Type : v1 .PodReady , Status : v1 .ConditionTrue },
875+ {Type : v1 .ContainersReady , Status : v1 .ConditionTrue },
870876 {Type : appspub .InPlaceUpdateReady , Status : v1 .ConditionTrue , LastTransitionTime : now },
871877 },
872878 ContainerStatuses : []v1.ContainerStatus {{Name : "c1" , ImageID : "image-id-xyz" }},
@@ -945,6 +951,41 @@ func TestUpdate(t *testing.T) {
945951 },
946952 },
947953 },
954+ {
955+ name : "create: preparingNormal->Normal without hook, pod not ready" ,
956+ cs : & appsv1alpha1.CloneSet {Spec : appsv1alpha1.CloneSetSpec {Replicas : getInt32Pointer (1 )}},
957+ updateRevision : & apps.ControllerRevision {ObjectMeta : metav1.ObjectMeta {Name : "rev_new" }},
958+ pods : []* v1.Pod {
959+ {
960+ ObjectMeta : metav1.ObjectMeta {Name : "pod-0" , Labels : map [string ]string {
961+ apps .ControllerRevisionHashLabelKey : "rev_new" ,
962+ apps .DefaultDeploymentUniqueLabelKey : "rev_new" ,
963+ appspub .LifecycleStateKey : string (appspub .LifecycleStatePreparingNormal ),
964+ }},
965+ Spec : v1.PodSpec {ReadinessGates : []v1.PodReadinessGate {{ConditionType : appspub .InPlaceUpdateReady }}},
966+ Status : v1.PodStatus {Phase : v1 .PodRunning , Conditions : []v1.PodCondition {
967+ {Type : v1 .PodReady , Status : v1 .ConditionFalse },
968+ {Type : v1 .ContainersReady , Status : v1 .ConditionFalse },
969+ {Type : appspub .InPlaceUpdateReady , Status : v1 .ConditionTrue },
970+ }},
971+ },
972+ },
973+ expectedPods : []* v1.Pod {
974+ {
975+ ObjectMeta : metav1.ObjectMeta {Name : "pod-0" , Labels : map [string ]string {
976+ apps .ControllerRevisionHashLabelKey : "rev_new" ,
977+ apps .DefaultDeploymentUniqueLabelKey : "rev_new" ,
978+ appspub .LifecycleStateKey : string (appspub .LifecycleStatePreparingNormal ),
979+ }},
980+ Spec : v1.PodSpec {ReadinessGates : []v1.PodReadinessGate {{ConditionType : appspub .InPlaceUpdateReady }}},
981+ Status : v1.PodStatus {Phase : v1 .PodRunning , Conditions : []v1.PodCondition {
982+ {Type : v1 .PodReady , Status : v1 .ConditionFalse },
983+ {Type : v1 .ContainersReady , Status : v1 .ConditionFalse },
984+ {Type : appspub .InPlaceUpdateReady , Status : v1 .ConditionTrue },
985+ }},
986+ },
987+ },
988+ },
948989 }
949990
950991 inplaceupdate .Clock = clock .NewFakeClock (now .Time )
0 commit comments