@@ -710,8 +710,9 @@ func (r *IronicInspectorReconciler) reconcileStatefulSet(
710710 }
711711
712712 // Only check readiness if controller sees the last version of the CR
713- if ss .GetStatefulSet ().Generation == ss .GetStatefulSet ().Status .ObservedGeneration {
714- instance .Status .ReadyCount = ss .GetStatefulSet ().Status .ReadyReplicas
713+ deploy := ss .GetStatefulSet ()
714+ if deploy .Generation == deploy .Status .ObservedGeneration {
715+ instance .Status .ReadyCount = deploy .Status .ReadyReplicas
715716
716717 // verify if network attachment matches expectations
717718 networkReady , networkAttachmentStatus , err := nad .VerifyNetworkStatusFromAnnotation (ctx , helper , instance .Spec .NetworkAttachments , serviceLabels , instance .Status .ReadyCount )
@@ -733,11 +734,20 @@ func (r *IronicInspectorReconciler) reconcileStatefulSet(
733734
734735 return ctrl.Result {}, err
735736 }
736- if instance .Status .ReadyCount == * instance .Spec .Replicas {
737- instance .Status .Conditions .MarkTrue (
738- condition .DeploymentReadyCondition ,
739- condition .DeploymentReadyMessage )
737+
738+ // Mark the Deployment as Ready only if the number of Replicas is equals
739+ // to the Deployed instances (ReadyCount), and the the Status.Replicas
740+ // match Status.ReadyReplicas. If a deployment update is in progress,
741+ // Replicas > ReadyReplicas.
742+ if statefulset .IsReady (deploy ) {
743+ instance .Status .Conditions .MarkTrue (condition .DeploymentReadyCondition , condition .DeploymentReadyMessage )
740744 } else {
745+ instance .Status .Conditions .Set (condition .FalseCondition (
746+ condition .DeploymentReadyCondition ,
747+ condition .RequestedReason ,
748+ condition .SeverityInfo ,
749+ condition .DeploymentReadyRunningMessage ))
750+
741751 return ctrl.Result {RequeueAfter : time .Second * 10 }, nil
742752 }
743753 }
0 commit comments