Repository: Azure/ARO-RP
Pull request #2199 (2022-06-22 01:33:00)

Move initialize aro deployer step to before ensureAroOperator

### What this PR does / why we need it:

When you enable egress lockdown on a cluster, the cluster document which is used in the deploy step becomes stale since it is updated after the initialization of the ARO Deployer within the manager struct.  

Since the ARO deployer manager struct is only used to deploy ARO Operator, let's just wait to initialize it until we need it.  

### Test plan for issue:

e2e tests

### Is there any documentation that needs to be updated for this PR?

nope


Patch:
diff --git a/pkg/cluster/install.go b/pkg/cluster/install.go
index 4c2a9b1fe..b104afe72 100644
--- a/pkg/cluster/install.go
+++ b/pkg/cluster/install.go
@@ -42,7 +42,6 @@ func (m *manager) adminUpdate() []steps.Step {
 	// don't require a running cluster
 	toRun := []steps.Step{
 		steps.Action(m.initializeKubernetesClients), // must be first
-		steps.Action(m.initializeOperatorDeployer),  // depends on kube clients
 		steps.Action(m.ensureBillingRecord),         // belt and braces
 		steps.Action(m.ensureDefaults),
 		steps.Action(m.fixupClusterSPObjectID),
@@ -87,6 +86,7 @@ func (m *manager) adminUpdate() []steps.Step {
 	// Update the ARO Operator
 	if isEverything || isOperator {
 		toRun = append(toRun,
+			steps.Action(m.initializeOperatorDeployer), // depends on kube clients
 			steps.Action(m.ensureAROOperator),
 			steps.Condition(m.aroDeploymentReady, 20*time.Minute, true),
 		)


Test patch:
diff --git a/pkg/cluster/adminupdate_test.go b/pkg/cluster/adminupdate_test.go
index 02f6174a8..cc32a86f0 100644
--- a/pkg/cluster/adminupdate_test.go
+++ b/pkg/cluster/adminupdate_test.go
@@ -41,13 +41,13 @@ func TestAdminUpdateSteps(t *testing.T) {
 			},
 			shouldRunSteps: []string{
 				"[Action initializeKubernetesClients-fm]",
-				"[Action initializeOperatorDeployer-fm]",
 				"[Action ensureBillingRecord-fm]",
 				"[Action ensureDefaults-fm]",
 				"[Action fixupClusterSPObjectID-fm]",
 				"[Action fixInfraID-fm]",
 				"[Action startVMs-fm]",
 				"[Condition apiServersReady-fm, timeout 30m0s]",
+				"[Action initializeOperatorDeployer-fm]",
 				"[Action ensureAROOperator-fm]",
 				"[Condition aroDeploymentReady-fm, timeout 20m0s]",
 			},
@@ -62,7 +62,6 @@ func TestAdminUpdateSteps(t *testing.T) {
 			},
 			shouldRunSteps: []string{
 				"[Action initializeKubernetesClients-fm]",
-				"[Action initializeOperatorDeployer-fm]",
 				"[Action ensureBillingRecord-fm]",
 				"[Action ensureDefaults-fm]",
 				"[Action fixupClusterSPObjectID-fm]",
@@ -86,6 +85,7 @@ func TestAdminUpdateSteps(t *testing.T) {
 				"[Action configureIngressCertificate-fm]",
 				"[Action populateRegistryStorageAccountName-fm]",
 				"[Action ensureMTUSize-fm]",
+				"[Action initializeOperatorDeployer-fm]",
 				"[Action ensureAROOperator-fm]",
 				"[Condition aroDeploymentReady-fm, timeout 20m0s]",
 				"[Action updateProvisionedBy-fm]",
@@ -101,7 +101,6 @@ func TestAdminUpdateSteps(t *testing.T) {
 			},
 			shouldRunSteps: []string{
 				"[Action initializeKubernetesClients-fm]",
-				"[Action initializeOperatorDeployer-fm]",
 				"[Action ensureBillingRecord-fm]",
 				"[Action ensureDefaults-fm]",
 				"[Action fixupClusterSPObjectID-fm]",
@@ -125,6 +124,7 @@ func TestAdminUpdateSteps(t *testing.T) {
 				"[Action configureIngressCertificate-fm]",
 				"[Action populateRegistryStorageAccountName-fm]",
 				"[Action ensureMTUSize-fm]",
+				"[Action initializeOperatorDeployer-fm]",
 				"[Action ensureAROOperator-fm]",
 				"[Condition aroDeploymentReady-fm, timeout 20m0s]",
 				"[Action updateProvisionedBy-fm]",