@@ -189,16 +189,21 @@ func (r *OpenStackDataPlaneDeploymentReconciler) Reconcile(ctx context.Context,
189189 nodeSets .Items = append (nodeSets .Items , * nodeSetInstance )
190190 }
191191
192- // Check that all nodeSets are SetupReady
192+ globalInventorySecrets := map [string ]string {}
193+ globalSSHKeySecrets := map [string ]string {}
194+
195+ // Check that all NodeSets are ready and get TLS certs
193196 for _ , nodeSet := range nodeSets .Items {
197+
198+ // Add inventory secret to list of inventories for global services
199+ globalInventorySecrets [nodeSet .Name ] = fmt .Sprintf ("dataplanenodeset-%s" , nodeSet .Name )
200+ globalSSHKeySecrets [nodeSet .Name ] = nodeSet .Spec .NodeTemplate .AnsibleSSHPrivateKeySecret
201+
194202 if ! nodeSet .Status .Conditions .IsTrue (dataplanev1 .SetupReadyCondition ) {
195203 Log .Info ("NodeSet SetupReadyCondition is not True" , "NodeSet" , nodeSet .Name )
196204 return ctrl.Result {RequeueAfter : time .Second * time .Duration (instance .Spec .DeploymentRequeueTime )}, nil
197205 }
198- }
199206
200- // get TLS certs
201- for _ , nodeSet := range nodeSets .Items {
202207 if nodeSet .Spec .TLSEnabled {
203208 var services []string
204209 if len (instance .Spec .ServicesOverride ) != 0 {
@@ -260,16 +265,6 @@ func (r *OpenStackDataPlaneDeploymentReconciler) Reconcile(ctx context.Context,
260265 var nodesetServiceMap map [string ][]string
261266 backoffLimitReached := false
262267
263- globalInventorySecrets := map [string ]string {}
264- globalSSHKeySecrets := map [string ]string {}
265-
266- // Gathering individual inventory and ssh secrets for later use
267- for _ , nodeSet := range nodeSets .Items {
268- // Add inventory secret to list of inventories for global services
269- globalInventorySecrets [nodeSet .Name ] = fmt .Sprintf ("dataplanenodeset-%s" , nodeSet .Name )
270- globalSSHKeySecrets [nodeSet .Name ] = nodeSet .Spec .NodeTemplate .AnsibleSSHPrivateKeySecret
271- }
272-
273268 if nodesetServiceMap , err = deployment .DedupeServices (ctx , helper , nodeSets .Items ,
274269 instance .Spec .ServicesOverride ); err != nil {
275270 util .LogErrorForObject (helper , err , "OpenStackDeployment error for deployment" , instance )
0 commit comments