Skip to content

Commit

Permalink
Merge pull request #45 from paynejacob/fix/issue-34244
Browse files Browse the repository at this point in the history
fixed addon profiles overwriting each other
  • Loading branch information
paynejacob authored Aug 19, 2021
2 parents 6266047 + a3dca2f commit d10be56
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
6 changes: 3 additions & 3 deletions controller/aks-cluster-config-handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down
14 changes: 5 additions & 9 deletions pkg/aks/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d10be56

Please sign in to comment.