@@ -204,6 +204,7 @@ func (r *OpenStackReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
204204
205205 cl := condition .CreateList (
206206 condition .UnknownCondition (operatorv1beta1 .OpenStackOperatorReadyCondition , condition .InitReason , string (operatorv1beta1 .OpenStackOperatorReadyInitMessage )),
207+ condition .UnknownCondition (operatorv1beta1 .OpenStackOperatorDeploymentsReadyCondition , condition .InitReason , string (operatorv1beta1 .OpenStackOperatorDeploymentsReadyInitMessage )),
207208 )
208209 instance .Status .Conditions .Init (& cl )
209210 instance .Status .ObservedGeneration = instance .Generation
@@ -268,7 +269,7 @@ func (r *OpenStackReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
268269 }
269270
270271 // Check if all deployments are running
271- deploymentsRunning , err := r .countDeployments (ctx , instance )
272+ deploymentsRunning , deploymentsPending , err := r .countDeployments (ctx , instance )
272273 instance .Status .DeployedOperatorCount = & deploymentsRunning
273274 if err != nil {
274275 instance .Status .Conditions .Set (condition .FalseCondition (
@@ -280,10 +281,20 @@ func (r *OpenStackReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
280281 return ctrl.Result {}, err
281282 }
282283 if deploymentsRunning < OperatorCount {
283- Log .Info ("Waiting for all deployments to be running" , "current" , deploymentsRunning , "expected" , OperatorCount )
284+ Log .Info ("Waiting for all deployments to be running" , "current" , deploymentsRunning , "expected" , OperatorCount , "pending" , deploymentsPending )
285+ instance .Status .Conditions .Set (condition .FalseCondition (
286+ operatorv1beta1 .OpenStackOperatorDeploymentsReadyCondition ,
287+ condition .RequestedReason ,
288+ condition .SeverityInfo ,
289+ operatorv1beta1 .OpenStackOperatorDeploymentsReadyRunningMessage ,
290+ deploymentsPending ))
284291 return ctrl.Result {}, nil
285292 }
286293
294+ instance .Status .Conditions .MarkTrue (
295+ operatorv1beta1 .OpenStackOperatorDeploymentsReadyCondition ,
296+ operatorv1beta1 .OpenStackOperatorDeploymentsReadyMessage )
297+
287298 // Check if Services are running and have an endpoint
288299 ctrlResult , err := r .checkServiceEndpoints (ctx , instance )
289300 if err != nil {
@@ -349,22 +360,28 @@ func (r *OpenStackReconciler) reconcileDelete(ctx context.Context, instance *ope
349360}
350361
351362// countDeployments -
352- func (r * OpenStackReconciler ) countDeployments (ctx context.Context , instance * operatorv1beta1.OpenStack ) (int , error ) {
363+ func (r * OpenStackReconciler ) countDeployments (ctx context.Context , instance * operatorv1beta1.OpenStack ) (int , [] string , error ) {
353364 deployments := & appsv1.DeploymentList {}
365+ pending := []string {}
354366 err := r .Client .List (ctx , deployments , & client.ListOptions {Namespace : instance .Namespace })
355367 if err != nil {
356- return 0 , err
368+ return 0 , pending , err
357369 }
358370
359371 count := 0
360372 for _ , deployment := range deployments .Items {
361373 if metav1 .IsControlledBy (& deployment , instance ) {
362374 if deployment .Status .ReadyReplicas > 0 {
363375 count ++
376+ } else {
377+ name := strings .Replace (deployment .Name , "-operator-controller-manager" , "" , 1 )
378+ name = strings .Replace (name , "-cluster-operator-manager" , "" , 1 )
379+ pending = append (pending , name )
364380 }
365381 }
366382 }
367- return count , nil
383+ sort .Strings (pending )
384+ return count , pending , nil
368385}
369386
370387// containerImageMatch - returns true if the deployedContainerImage matches the operatorImage
0 commit comments