From 2b1460115b1718c2bf5fe7782fbbf37274cdc9c7 Mon Sep 17 00:00:00 2001 From: Qi Ni Date: Thu, 20 Apr 2023 16:10:58 +0800 Subject: [PATCH] chore: set default loadBalancerSKU to Standard --- pkg/provider/azure.go | 4 ++++ pkg/provider/azure_test.go | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/pkg/provider/azure.go b/pkg/provider/azure.go index 774818282f..cb11559031 100644 --- a/pkg/provider/azure.go +++ b/pkg/provider/azure.go @@ -706,6 +706,10 @@ func (az *Cloud) initCaches() (err error) { } func (az *Cloud) setLBDefaults(config *Config) error { + if config.LoadBalancerSku == "" { + config.LoadBalancerSku = consts.LoadBalancerSkuStandard + } + if strings.EqualFold(config.LoadBalancerSku, consts.LoadBalancerSkuStandard) { // Do not add master nodes to standard LB by default. if config.ExcludeMasterFromStandardLB == nil { diff --git a/pkg/provider/azure_test.go b/pkg/provider/azure_test.go index 900311be15..0aefa13e1e 100644 --- a/pkg/provider/azure_test.go +++ b/pkg/provider/azure_test.go @@ -3917,3 +3917,13 @@ func TestFindSecurityRule(t *testing.T) { assert.Equal(t, testCases[i].expected, found, testCases[i].desc) } } + +func TestSetLBDefaults(t *testing.T) { + ctrl := gomock.NewController(t) + defer ctrl.Finish() + az := GetTestCloud(ctrl) + + config := &Config{} + _ = az.setLBDefaults(config) + assert.Equal(t, config.LoadBalancerSku, consts.LoadBalancerSkuStandard) +}