Skip to content

Commit 5029061

Browse files
handle deployment features in non-blocking way (#2102)
1 parent f750730 commit 5029061

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

internal/controller/atlasdeployment/advanced_deployment.go

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,15 @@ func (r *AtlasDeploymentReconciler) handleAdvancedDeployment(ctx *workflow.Conte
6969
return r.terminate(ctx, workflow.DeploymentConnectionSecretsNotCreated, err)
7070
}
7171

72+
var results []workflow.Result
7273
if !r.AtlasProvider.IsCloudGov() {
7374
searchNodeResult := handleSearchNodes(ctx, akoCluster.GetCustomResource(), akoCluster.GetProjectID())
74-
if transition = r.transitionFromResult(ctx, deploymentService, akoCluster.GetProjectID(), akoCluster.GetCustomResource(), searchNodeResult); transition != nil {
75-
return transition(workflow.Internal)
76-
}
75+
results = append(results, searchNodeResult)
7776
}
7877

7978
searchService := searchindex.NewSearchIndexes(ctx.SdkClientSet.SdkClient20241113001.AtlasSearchApi)
8079
result := handleSearchIndexes(ctx, r.Client, searchService, akoCluster.GetCustomResource(), akoCluster.GetProjectID())
81-
if transition = r.transitionFromResult(ctx, deploymentService, akoCluster.GetProjectID(), akoCluster.GetCustomResource(), result); transition != nil {
82-
return transition(workflow.Internal)
83-
}
80+
results = append(results, result)
8481

8582
result = r.ensureCustomZoneMapping(
8683
ctx,
@@ -89,9 +86,7 @@ func (r *AtlasDeploymentReconciler) handleAdvancedDeployment(ctx *workflow.Conte
8986
akoCluster.GetCustomResource().Spec.DeploymentSpec.CustomZoneMapping,
9087
akoCluster.GetName(),
9188
)
92-
if transition = r.transitionFromResult(ctx, deploymentService, akoCluster.GetProjectID(), akoCluster.GetCustomResource(), result); transition != nil {
93-
return transition(workflow.Internal)
94-
}
89+
results = append(results, result)
9590

9691
result = r.ensureManagedNamespaces(
9792
ctx,
@@ -101,10 +96,13 @@ func (r *AtlasDeploymentReconciler) handleAdvancedDeployment(ctx *workflow.Conte
10196
akoCluster.GetCustomResource().Spec.DeploymentSpec.ManagedNamespaces,
10297
akoCluster.GetName(),
10398
)
104-
if transition = r.transitionFromResult(ctx, deploymentService, akoCluster.GetProjectID(), akoCluster.GetCustomResource(), result); transition != nil {
105-
return transition(workflow.Internal)
106-
}
99+
results = append(results, result)
107100

101+
for i := range results {
102+
if !results[i].IsOk() {
103+
return r.transitionFromResult(ctx, deploymentService, akoCluster.GetProjectID(), akoCluster.GetCustomResource(), results[i])(workflow.Internal)
104+
}
105+
}
108106
err = customresource.ApplyLastConfigApplied(ctx.Context, akoCluster.GetCustomResource(), r.Client)
109107
if err != nil {
110108
return r.terminate(ctx, workflow.Internal, err)

0 commit comments

Comments
 (0)