Skip to content

Commit

Permalink
Correct code flow of node pools
Browse files Browse the repository at this point in the history
Signed-off-by: Vatsal Parekh <[email protected]>
  • Loading branch information
vatsalparekh committed Oct 28, 2024
1 parent 72d18d7 commit f4c048c
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions controller/aks-cluster-config-handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -843,18 +843,19 @@ func (h *Handler) updateUpstreamClusterState(ctx context.Context, config *aksv1.
clusterSpecCopy.ResourceGroup = config.Spec.ResourceGroup
clusterSpecCopy.ResourceLocation = config.Spec.ResourceLocation
clusterSpecCopy.ClusterName = config.Spec.ClusterName
}
clusterSpecCopy.NodePools = make([]aksv1.AKSNodePool, 0, len(config.Spec.NodePools))
for _, n := range config.Spec.NodePools {
if _, ok := upstreamNodePools[*n.Name]; ok {
clusterSpecCopy.NodePools = append(clusterSpecCopy.NodePools, n)

clusterSpecCopy.NodePools = make([]aksv1.AKSNodePool, 0, len(config.Spec.NodePools))
for _, n := range config.Spec.NodePools {
if _, ok := upstreamNodePools[*n.Name]; ok {
clusterSpecCopy.NodePools = append(clusterSpecCopy.NodePools, n)
}
}
err = aks.UpdateCluster(ctx, &h.azureClients.credentials, h.azureClients.clustersClient, h.azureClients.workplacesClient, clusterSpecCopy, config.Status.Phase)
if err != nil {
return config, fmt.Errorf("failed to update cluster: %v", err)
}
return h.enqueueUpdate(config)
}
err = aks.UpdateCluster(ctx, &h.azureClients.credentials, h.azureClients.clustersClient, h.azureClients.workplacesClient, clusterSpecCopy, config.Status.Phase)
if err != nil {
return config, fmt.Errorf("failed to update cluster: %v", err)
}
return h.enqueueUpdate(config)
}

if config.Spec.NodePools != nil {
Expand Down

0 comments on commit f4c048c

Please sign in to comment.