From fba3821d6d2154ee317ed97400347aaf7063a42c Mon Sep 17 00:00:00 2001 From: Jack Francis Date: Fri, 20 Nov 2020 10:15:22 -0800 Subject: [PATCH] chore: only warn about master stuff during create (#4057) --- pkg/api/vlabs/validate.go | 6 ++++-- pkg/api/vlabs/validate_test.go | 9 +++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/pkg/api/vlabs/validate.go b/pkg/api/vlabs/validate.go index c2dd896400..0638f1d943 100644 --- a/pkg/api/vlabs/validate.go +++ b/pkg/api/vlabs/validate.go @@ -385,7 +385,7 @@ func (a *Properties) ValidateOrchestratorProfile(isUpdate bool) error { func (a *Properties) validateMasterProfile(isUpdate bool) error { m := a.MasterProfile - if m.Count == 1 { + if m.Count == 1 && !isUpdate { log.Warnf("Running only 1 control plane VM not recommended for production clusters, use 3 or 5 for control plane redundancy") } if m.IsVirtualMachineScaleSets() && m.VnetSubnetID != "" && m.FirstConsecutiveStaticIP != "" { @@ -399,7 +399,9 @@ func (a *Properties) validateMasterProfile(isUpdate bool) error { } if m.IsVirtualMachineScaleSets() { - log.Warnf("Clusters with VMSS masters are not yet upgradable! You will not be able to upgrade your cluster until a future version of aks-engine!") + if !isUpdate { + log.Warnf("Clusters with VMSS masters are not yet upgradable! You will not be able to upgrade your cluster until a future version of aks-engine!") + } e := validateVMSS(a.OrchestratorProfile, false, m.StorageProfile, a.HasWindows(), a.IsAzureStackCloud()) if e != nil { return e diff --git a/pkg/api/vlabs/validate_test.go b/pkg/api/vlabs/validate_test.go index aec2552371..5b690d0669 100644 --- a/pkg/api/vlabs/validate_test.go +++ b/pkg/api/vlabs/validate_test.go @@ -3391,11 +3391,20 @@ func ExampleProperties_validateMasterProfile() { }) cs := getK8sDefaultContainerService(false) cs.Properties.MasterProfile.Count = 1 + cs.Properties.MasterProfile.AvailabilityProfile = VirtualMachineScaleSets + cs.Properties.AgentPoolProfiles[0].AvailabilityProfile = VirtualMachineScaleSets if err := cs.Properties.validateMasterProfile(false); err != nil { log.Errorf("shouldn't error with 1 control plane VM, got %s", err.Error()) } + + cs = getK8sDefaultContainerService(false) + cs.Properties.MasterProfile.Count = 1 + if err := cs.Properties.validateMasterProfile(true); err != nil { + log.Errorf("shouldn't error with 1 control plane VM, got %s", err.Error()) + } // Output: // level=warning msg="Running only 1 control plane VM not recommended for production clusters, use 3 or 5 for control plane redundancy" + // level=warning msg="Clusters with VMSS masters are not yet upgradable! You will not be able to upgrade your cluster until a future version of aks-engine!" } func ExampleProperties_validateZones() {