@@ -194,6 +194,7 @@ func (r *OpenStackReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
194194
195195 cl := condition .CreateList (
196196 condition .UnknownCondition (operatorv1beta1 .OpenStackOperatorReadyCondition , condition .InitReason , string (operatorv1beta1 .OpenStackOperatorReadyInitMessage )),
197+ condition .UnknownCondition (operatorv1beta1 .OpenStackOperatorDeploymentsReadyCondition , condition .InitReason , string (operatorv1beta1 .OpenStackOperatorDeploymentsReadyInitMessage )),
197198 )
198199 instance .Status .Conditions .Init (& cl )
199200 instance .Status .ObservedGeneration = instance .Generation
@@ -258,7 +259,7 @@ func (r *OpenStackReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
258259 }
259260
260261 // Check if all deployments are running
261- deploymentsRunning , err := r .countDeployments (ctx , instance )
262+ deploymentsRunning , deploymentsPending , err := r .countDeployments (ctx , instance )
262263 instance .Status .DeployedOperatorCount = & deploymentsRunning
263264 if err != nil {
264265 instance .Status .Conditions .Set (condition .FalseCondition (
@@ -270,10 +271,20 @@ func (r *OpenStackReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
270271 return ctrl.Result {}, err
271272 }
272273 if deploymentsRunning < OperatorCount {
273- Log .Info ("Waiting for all deployments to be running" , "current" , deploymentsRunning , "expected" , OperatorCount )
274+ Log .Info ("Waiting for all deployments to be running" , "current" , deploymentsRunning , "expected" , OperatorCount , "pending" , deploymentsPending )
275+ instance .Status .Conditions .Set (condition .FalseCondition (
276+ operatorv1beta1 .OpenStackOperatorDeploymentsReadyCondition ,
277+ condition .RequestedReason ,
278+ condition .SeverityInfo ,
279+ operatorv1beta1 .OpenStackOperatorDeploymentsReadyRunningMessage ,
280+ deploymentsPending ))
274281 return ctrl.Result {}, nil
275282 }
276283
284+ instance .Status .Conditions .MarkTrue (
285+ operatorv1beta1 .OpenStackOperatorDeploymentsReadyCondition ,
286+ operatorv1beta1 .OpenStackOperatorDeploymentsReadyMessage )
287+
277288 // Check if Services are running and have an endpoint
278289 ctrlResult , err := r .checkServiceEndpoints (ctx , instance )
279290 if err != nil {
@@ -339,22 +350,28 @@ func (r *OpenStackReconciler) reconcileDelete(ctx context.Context, instance *ope
339350}
340351
341352// countDeployments -
342- func (r * OpenStackReconciler ) countDeployments (ctx context.Context , instance * operatorv1beta1.OpenStack ) (int , error ) {
353+ func (r * OpenStackReconciler ) countDeployments (ctx context.Context , instance * operatorv1beta1.OpenStack ) (int , [] string , error ) {
343354 deployments := & appsv1.DeploymentList {}
355+ pending := []string {}
344356 err := r .Client .List (ctx , deployments , & client.ListOptions {Namespace : instance .Namespace })
345357 if err != nil {
346- return 0 , err
358+ return 0 , pending , err
347359 }
348360
349361 count := 0
350362 for _ , deployment := range deployments .Items {
351363 if metav1 .IsControlledBy (& deployment , instance ) {
352364 if deployment .Status .ReadyReplicas > 0 {
353365 count ++
366+ } else {
367+ name := strings .Replace (deployment .Name , "-operator-controller-manager" , "" , 1 )
368+ name = strings .Replace (name , "-cluster-operator-manager" , "" , 1 )
369+ pending = append (pending , name )
354370 }
355371 }
356372 }
357- return count , nil
373+ sort .Strings (pending )
374+ return count , pending , nil
358375}
359376
360377// containerImageMatch - returns true if the deployedContainerImage matches the operatorImage
0 commit comments