@@ -503,6 +503,9 @@ func Test_computeDeploymentRollingOutCondition(t *testing.T) {
503503 replicasAvailable * int32
504504 expectStatus operatorv1.ConditionStatus
505505 expectMessageContains string
506+ expectReasonContains string
507+ differentGeneration bool
508+ hasNewReplicaSet bool
506509 }{
507510 {
508511 name : "Router pod replicas not rolling out" ,
@@ -576,6 +579,42 @@ func Test_computeDeploymentRollingOutCondition(t *testing.T) {
576579 replicasAvailable : pointer .Int32 (2 ),
577580 expectMessageContains : "Deployment is not actively rolling out" ,
578581 },
582+ {
583+ name : "Router pods replicas available < updated and generation is equal to observedGeneration" ,
584+ expectStatus : operatorv1 .ConditionTrue ,
585+ replicasHave : pointer .Int32 (4 ),
586+ replicasWanted : pointer .Int32 (4 ),
587+ replicasUpdated : pointer .Int32 (4 ),
588+ replicasAvailable : pointer .Int32 (1 ),
589+ expectMessageContains : "1 of 4 updated replica(s) are available" ,
590+ expectReasonContains : PodsStarting .String (),
591+ differentGeneration : false ,
592+ hasNewReplicaSet : true ,
593+ },
594+ {
595+ name : "Router pod replicas have > updated, generation is equal to observedGeneration and NewReplicaSet created" ,
596+ expectStatus : operatorv1 .ConditionTrue ,
597+ replicasHave : pointer .Int32 (3 ),
598+ replicasWanted : pointer .Int32 (1 ),
599+ replicasUpdated : pointer .Int32 (1 ),
600+ replicasAvailable : pointer .Int32 (1 ),
601+ expectMessageContains : "2 old replica(s) are pending termination" ,
602+ expectReasonContains : ReplicasStabilizing .String (),
603+ differentGeneration : false ,
604+ hasNewReplicaSet : true ,
605+ },
606+ {
607+ name : "Router pod replicas have/updated < want, generation is equal to observedGeneration and NewReplicaSet created" ,
608+ expectStatus : operatorv1 .ConditionTrue ,
609+ replicasHave : pointer .Int32 (4 ),
610+ replicasWanted : pointer .Int32 (4 ),
611+ replicasUpdated : pointer .Int32 (4 ),
612+ replicasAvailable : pointer .Int32 (1 ),
613+ expectMessageContains : "Waiting for router deployment rollout to finish: 1 of 4 updated replica(s) are available...\n " ,
614+ expectReasonContains : PodsStarting .String (),
615+ differentGeneration : false ,
616+ hasNewReplicaSet : true ,
617+ },
579618 }
580619 for _ , test := range tests {
581620 t .Run (test .name , func (t * testing.T ) {
@@ -589,13 +628,29 @@ func Test_computeDeploymentRollingOutCondition(t *testing.T) {
589628 UpdatedReplicas : * test .replicasUpdated ,
590629 },
591630 }
631+ if ! test .differentGeneration {
632+ routerDeploy .ObjectMeta .Generation = 1
633+ routerDeploy .Status .ObservedGeneration = 1
634+ }
635+ if test .hasNewReplicaSet {
636+ routerDeploy .Status .Conditions = []appsv1.DeploymentCondition {
637+ {
638+ Type : appsv1 .DeploymentProgressing ,
639+ Status : corev1 .ConditionTrue ,
640+ Reason : "NewReplicaSetAvailable" ,
641+ },
642+ }
643+ }
592644 actual := computeDeploymentRollingOutCondition (routerDeploy )
593645 if actual .Status != test .expectStatus {
594646 t .Errorf ("expected status to be %s, got %s" , test .expectStatus , actual .Status )
595647 }
596648 if len (test .expectMessageContains ) != 0 && ! strings .Contains (actual .Message , test .expectMessageContains ) {
597649 t .Errorf ("expected message to include %q, got %q" , test .expectMessageContains , actual .Message )
598650 }
651+ if len (test .expectReasonContains ) != 0 && ! strings .Contains (actual .Reason , test .expectReasonContains ) {
652+ t .Errorf ("expected reason to include %q, got %q" , test .expectReasonContains , actual .Reason )
653+ }
599654 })
600655 }
601656}
@@ -1701,6 +1756,60 @@ func Test_computeIngressProgressingCondition(t *testing.T) {
17011756 },
17021757 expect : operatorv1.OperatorCondition {Type : operatorv1 .OperatorStatusTypeProgressing , Status : operatorv1 .ConditionTrue },
17031758 },
1759+ {
1760+ description : "load balancer is not progressing, but unmanaged load balancer type and router deployment is rolling out due to node reboot (pods starting)" ,
1761+ conditions : []operatorv1.OperatorCondition {
1762+ {Type : IngressControllerLoadBalancerProgressingConditionType , Status : operatorv1 .ConditionFalse },
1763+ {Type : IngressControllerDeploymentRollingOutConditionType , Status : operatorv1 .ConditionTrue , Reason : PodsStarting .String ()},
1764+ {Type : operatorv1 .LoadBalancerManagedIngressConditionType , Status : operatorv1 .ConditionFalse },
1765+ },
1766+ expect : operatorv1.OperatorCondition {Type : operatorv1 .OperatorStatusTypeProgressing , Status : operatorv1 .ConditionFalse },
1767+ },
1768+ {
1769+ description : "load balancer is progressing, but unmanaged load balancer type and router deployment is rolling out due to node reboot (pods starting)" ,
1770+ conditions : []operatorv1.OperatorCondition {
1771+ {Type : IngressControllerLoadBalancerProgressingConditionType , Status : operatorv1 .ConditionTrue },
1772+ {Type : IngressControllerDeploymentRollingOutConditionType , Status : operatorv1 .ConditionTrue , Reason : PodsStarting .String ()},
1773+ {Type : operatorv1 .LoadBalancerManagedIngressConditionType , Status : operatorv1 .ConditionFalse },
1774+ },
1775+ expect : operatorv1.OperatorCondition {Type : operatorv1 .OperatorStatusTypeProgressing , Status : operatorv1 .ConditionFalse },
1776+ },
1777+ {
1778+ description : "load balancer and unmanaged load balancer are progressing, but router deployment is rolling out due to node reboot (pods starting)" ,
1779+ conditions : []operatorv1.OperatorCondition {
1780+ {Type : IngressControllerLoadBalancerProgressingConditionType , Status : operatorv1 .ConditionTrue },
1781+ {Type : IngressControllerDeploymentRollingOutConditionType , Status : operatorv1 .ConditionTrue , Reason : PodsStarting .String ()},
1782+ {Type : operatorv1 .LoadBalancerManagedIngressConditionType , Status : operatorv1 .ConditionTrue },
1783+ },
1784+ expect : operatorv1.OperatorCondition {Type : operatorv1 .OperatorStatusTypeProgressing , Status : operatorv1 .ConditionTrue },
1785+ },
1786+ {
1787+ description : "load balancer is not progressing, but unmanaged load balancer type and router deployment is rolling out due to node reboot (replicas stabilizing)" ,
1788+ conditions : []operatorv1.OperatorCondition {
1789+ {Type : IngressControllerLoadBalancerProgressingConditionType , Status : operatorv1 .ConditionFalse },
1790+ {Type : IngressControllerDeploymentRollingOutConditionType , Status : operatorv1 .ConditionTrue , Reason : ReplicasStabilizing .String ()},
1791+ {Type : operatorv1 .LoadBalancerManagedIngressConditionType , Status : operatorv1 .ConditionFalse },
1792+ },
1793+ expect : operatorv1.OperatorCondition {Type : operatorv1 .OperatorStatusTypeProgressing , Status : operatorv1 .ConditionFalse },
1794+ },
1795+ {
1796+ description : "load balancer is progressing, but unmanaged load balancer type and router deployment is rolling out due to node reboot (replicas stabilizing)" ,
1797+ conditions : []operatorv1.OperatorCondition {
1798+ {Type : IngressControllerLoadBalancerProgressingConditionType , Status : operatorv1 .ConditionTrue },
1799+ {Type : IngressControllerDeploymentRollingOutConditionType , Status : operatorv1 .ConditionTrue , Reason : ReplicasStabilizing .String ()},
1800+ {Type : operatorv1 .LoadBalancerManagedIngressConditionType , Status : operatorv1 .ConditionFalse },
1801+ },
1802+ expect : operatorv1.OperatorCondition {Type : operatorv1 .OperatorStatusTypeProgressing , Status : operatorv1 .ConditionFalse },
1803+ },
1804+ {
1805+ description : "load balancer and unmanaged load balancer are progressing, but router deployment is rolling out due to node reboot (replicas stabilizing)" ,
1806+ conditions : []operatorv1.OperatorCondition {
1807+ {Type : IngressControllerLoadBalancerProgressingConditionType , Status : operatorv1 .ConditionTrue },
1808+ {Type : IngressControllerDeploymentRollingOutConditionType , Status : operatorv1 .ConditionTrue , Reason : ReplicasStabilizing .String ()},
1809+ {Type : operatorv1 .LoadBalancerManagedIngressConditionType , Status : operatorv1 .ConditionTrue },
1810+ },
1811+ expect : operatorv1.OperatorCondition {Type : operatorv1 .OperatorStatusTypeProgressing , Status : operatorv1 .ConditionTrue },
1812+ },
17041813 {
17051814 description : "load balancer is not progressing and router deployment is rolling out" ,
17061815 conditions : []operatorv1.OperatorCondition {
0 commit comments