From a3dca2f34c80eb3013feeb6e22469f53ce411e73 Mon Sep 17 00:00:00 2001 From: Jacob Payne Date: Wed, 18 Aug 2021 13:25:43 -0700 Subject: [PATCH] fixed addon profiles overwriting each other --- controller/aks-cluster-config-handler.go | 6 +++--- pkg/aks/create.go | 14 +++++--------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/controller/aks-cluster-config-handler.go b/controller/aks-cluster-config-handler.go index 2b1d8de6..649d6c79 100644 --- a/controller/aks-cluster-config-handler.go +++ b/controller/aks-cluster-config-handler.go @@ -50,8 +50,8 @@ const ( // node software, return code 3 ClusterStatusInProgress = "InProgress" - // ClusterStatusUpgrading The Upgrading state indicates the cluster is updating - ClusterStatusUpgrading = "Upgrading" + // ClusterStatusUpdating The Updating state indicates the cluster is updating + ClusterStatusUpdating = "Updating" // ClusterStatusCanceled The Canceled state indicates that create or update was canceled, return code 2 ClusterStatusCanceled = "Canceled" @@ -297,7 +297,7 @@ func (h *Handler) checkAndUpdate(config *aksv1.AKSClusterConfig) (*aksv1.AKSClus if clusterState == ClusterStatusFailed { return config, fmt.Errorf("update failed for cluster [%s], status: %s", config.Spec.ClusterName, clusterState) } - if clusterState == ClusterStatusInProgress || clusterState == ClusterStatusUpgrading { + if clusterState == ClusterStatusInProgress || clusterState == ClusterStatusUpdating { // If the cluster is in an active state in Rancher but is updating in AKS, then an update was initiated outside of Rancher, // such as in AKS console. In this case, this is a no-op and the reconciliation will happen after syncing. if config.Status.Phase == aksConfigActivePhase { diff --git a/pkg/aks/create.go b/pkg/aks/create.go index 82a8aad3..e9566415 100644 --- a/pkg/aks/create.go +++ b/pkg/aks/create.go @@ -110,21 +110,17 @@ func CreateOrUpdateCluster(ctx context.Context, cred *Credentials, clusterClient } } - var addonProfiles map[string]*containerservice.ManagedClusterAddonProfile + addonProfiles := make(map[string]*containerservice.ManagedClusterAddonProfile, 0) if hasHTTPApplicationRoutingSupport(spec) { - addonProfiles = map[string]*containerservice.ManagedClusterAddonProfile{ - "httpApplicationRouting": { - Enabled: spec.HTTPApplicationRouting, - }, + addonProfiles["httpApplicationRouting"] = &containerservice.ManagedClusterAddonProfile{ + Enabled: spec.HTTPApplicationRouting, } } if to.Bool(spec.Monitoring) { - addonProfiles = map[string]*containerservice.ManagedClusterAddonProfile{ - "omsAgent": { - Enabled: spec.Monitoring, - }, + addonProfiles["omsAgent"] = &containerservice.ManagedClusterAddonProfile{ + Enabled: spec.Monitoring, } operationInsightsWorkspaceClient, err := NewOperationInsightsWorkspaceClient(cred)