Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

Commit

Permalink
don't change val during upgrade/scale
Browse files Browse the repository at this point in the history
  • Loading branch information
jackfrancis committed Sep 22, 2020
1 parent cab4b53 commit c0b127a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/api/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ func (cs *ContainerService) setOrchestratorDefaults(isUpgrade, isScale bool) {
}
}

if !cs.Properties.IsHostedMasterProfile() &&
if !isUpgrade && !isScale &&
!cs.Properties.IsHostedMasterProfile() &&
!cs.Properties.IsCustomCloudProfile() &&
!cs.Properties.MasterProfile.IsVirtualMachineScaleSets() &&
o.KubernetesConfig.UseManagedIdentity == nil {
Expand Down
18 changes: 18 additions & 0 deletions pkg/api/defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,24 @@ func TestDefaultUseManagedIdentity(t *testing.T) {
t.Errorf("expected UseManagedIdentity to be false by default in VMSS control plane context, instead got %t", to.Bool(mockCS.Properties.OrchestratorProfile.KubernetesConfig.UseManagedIdentity))
}

isUpgrade = true
isScale = false
mockCS = getMockBaseContainerService("1.18.8")
mockCS.Properties.OrchestratorProfile.OrchestratorType = Kubernetes
mockCS.setOrchestratorDefaults(isUpgrade, isScale)
if mockCS.Properties.OrchestratorProfile.KubernetesConfig.UseManagedIdentity != nil {
t.Errorf("expected UseManagedIdentity to be unchanged by default in upgrade context, instead got %t", to.Bool(mockCS.Properties.OrchestratorProfile.KubernetesConfig.UseManagedIdentity))
}

isUpgrade = false
isScale = true
mockCS = getMockBaseContainerService("1.18.8")
mockCS.Properties.OrchestratorProfile.OrchestratorType = Kubernetes
mockCS.setOrchestratorDefaults(isUpgrade, isScale)
if mockCS.Properties.OrchestratorProfile.KubernetesConfig.UseManagedIdentity != nil {
t.Errorf("expected UseManagedIdentity to be unchanged by default in scale context, instead got %t", to.Bool(mockCS.Properties.OrchestratorProfile.KubernetesConfig.UseManagedIdentity))
}

mockCS = getMockBaseContainerService("1.18.8")
mockCS.Properties.OrchestratorProfile.OrchestratorType = Kubernetes
mockCS.Properties.OrchestratorProfile.KubernetesConfig.UseManagedIdentity = to.BoolPtr(false)
Expand Down

0 comments on commit c0b127a

Please sign in to comment.