diff --git a/go.mod b/go.mod index d0bc9236c4..6975d85264 100644 --- a/go.mod +++ b/go.mod @@ -40,19 +40,19 @@ require ( golang.org/x/sync v0.10.0 golang.org/x/sys v0.28.0 golang.org/x/text v0.21.0 - k8s.io/api v0.31.3 - k8s.io/apimachinery v0.31.3 - k8s.io/apiserver v0.31.3 - k8s.io/client-go v0.31.3 - k8s.io/cloud-provider v0.31.3 - k8s.io/component-base v0.31.3 - k8s.io/component-helpers v0.31.3 - k8s.io/controller-manager v0.31.3 + k8s.io/api v0.31.4 + k8s.io/apimachinery v0.31.4 + k8s.io/apiserver v0.31.4 + k8s.io/client-go v0.31.4 + k8s.io/cloud-provider v0.31.4 + k8s.io/component-base v0.31.4 + k8s.io/component-helpers v0.31.4 + k8s.io/controller-manager v0.31.4 k8s.io/klog/v2 v2.130.1 - k8s.io/kubelet v0.31.3 + k8s.io/kubelet v0.31.4 k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 - sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.2.7 - sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.1.8 + sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.2.10 + sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.2.1 sigs.k8s.io/yaml v1.4.0 ) @@ -137,7 +137,7 @@ require ( go.opentelemetry.io/proto/otlp v1.3.1 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect - golang.org/x/crypto v0.30.0 // indirect + golang.org/x/crypto v0.31.0 // indirect golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/net v0.30.0 // indirect golang.org/x/oauth2 v0.23.0 // indirect diff --git a/go.sum b/go.sum index 6d8148dfc6..4d637aae14 100644 --- a/go.sum +++ b/go.sum @@ -321,8 +321,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= -golang.org/x/crypto v0.30.0 h1:RwoQn3GkWiMkzlX562cLB7OxWvjH1L8xutO2WoJcRoY= -golang.org/x/crypto v0.30.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= +golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= +golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8= golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -426,38 +426,38 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/api v0.31.3 h1:umzm5o8lFbdN/hIXbrK9oRpOproJO62CV1zqxXrLgk8= -k8s.io/api v0.31.3/go.mod h1:UJrkIp9pnMOI9K2nlL6vwpxRzzEX5sWgn8kGQe92kCE= -k8s.io/apimachinery v0.31.3 h1:6l0WhcYgasZ/wk9ktLq5vLaoXJJr5ts6lkaQzgeYPq4= -k8s.io/apimachinery v0.31.3/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= -k8s.io/apiserver v0.31.3 h1:+1oHTtCB+OheqFEz375D0IlzHZ5VeQKX1KGXnx+TTuY= -k8s.io/apiserver v0.31.3/go.mod h1:PrxVbebxrxQPFhJk4powDISIROkNMKHibTg9lTRQ0Qg= -k8s.io/client-go v0.31.3 h1:CAlZuM+PH2cm+86LOBemaJI/lQ5linJ6UFxKX/SoG+4= -k8s.io/client-go v0.31.3/go.mod h1:2CgjPUTpv3fE5dNygAr2NcM8nhHzXvxB8KL5gYc3kJs= -k8s.io/cloud-provider v0.31.3 h1:7C3CHQUUwnv/HWWVIaibZH06iPg663RYQ6C6Zy4FnO8= -k8s.io/cloud-provider v0.31.3/go.mod h1:c7csKppoVb9Ej6upJ28AvHy4B3BtlRMzXfgezsDdPKw= -k8s.io/component-base v0.31.3 h1:DMCXXVx546Rfvhj+3cOm2EUxhS+EyztH423j+8sOwhQ= -k8s.io/component-base v0.31.3/go.mod h1:xME6BHfUOafRgT0rGVBGl7TuSg8Z9/deT7qq6w7qjIU= -k8s.io/component-helpers v0.31.3 h1:0zGPD2PrekhFWgmz85XxlMEl7dfhlKC1tERZDe3onQc= -k8s.io/component-helpers v0.31.3/go.mod h1:HZ1HZx2TKXM7xSUV2cR9L5yDoyZPhhHQNaE3BPBLPUQ= -k8s.io/controller-manager v0.31.3 h1:TyUav69iNYwLGwA96JDhusoZoGRdh1sdrLjXmWTcPgs= -k8s.io/controller-manager v0.31.3/go.mod h1:yuhec+dbXmBz+4c32kxJxmcauB+1pjO2ttfYODWuv18= +k8s.io/api v0.31.4 h1:I2QNzitPVsPeLQvexMEsj945QumYraqv9m74isPDKhM= +k8s.io/api v0.31.4/go.mod h1:d+7vgXLvmcdT1BCo79VEgJxHHryww3V5np2OYTr6jdw= +k8s.io/apimachinery v0.31.4 h1:8xjE2C4CzhYVm9DGf60yohpNUh5AEBnPxCryPBECmlM= +k8s.io/apimachinery v0.31.4/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= +k8s.io/apiserver v0.31.4 h1:JbtnTaXVYEAYIHJil6Wd74Wif9sd8jVcBw84kwEmp7o= +k8s.io/apiserver v0.31.4/go.mod h1:JJjoTjZ9PTMLdIFq7mmcJy2B9xLN3HeAUebW6xZyIP0= +k8s.io/client-go v0.31.4 h1:t4QEXt4jgHIkKKlx06+W3+1JOwAFU/2OPiOo7H92eRQ= +k8s.io/client-go v0.31.4/go.mod h1:kvuMro4sFYIa8sulL5Gi5GFqUPvfH2O/dXuKstbaaeg= +k8s.io/cloud-provider v0.31.4 h1:Oo6m0M2rbCjP9y+1VrZv1HZM6gQnKlpoma5F4CBUj/A= +k8s.io/cloud-provider v0.31.4/go.mod h1:hESI9ZE73PSinPglQsfUWMG2+BSavvJgLm0qVqs02mU= +k8s.io/component-base v0.31.4 h1:wCquJh4ul9O8nNBSB8N/o8+gbfu3BVQkVw9jAUY/Qtw= +k8s.io/component-base v0.31.4/go.mod h1:G4dgtf5BccwiDT9DdejK0qM6zTK0jwDGEKnCmb9+u/s= +k8s.io/component-helpers v0.31.4 h1:pqokuXozyWVrVBMmx0AMcKqNWqXhR00OZvpAE5hG5NM= +k8s.io/component-helpers v0.31.4/go.mod h1:Ddq5GYRK/1uNoPNgJh9N5osPutvBweQEcIG6b8kcvgQ= +k8s.io/controller-manager v0.31.4 h1:cimcf024HJnSQsH60+vYWN7uP59gORefuSEMADxUE/o= +k8s.io/controller-manager v0.31.4/go.mod h1:yPOuxohpbBEHHNmkcbAkOJ4P99ewo6rb03mhGUxszOs= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/kms v0.32.0-alpha.0 h1:l253yOB/0UhS7iLAzAw7aqaRB4Fw6I2fJtNtag98JF0= k8s.io/kms v0.32.0-alpha.0/go.mod h1:OZKwl1fan3n3N5FFxnW5C4V3ygrah/3YXeJWS3O6+94= k8s.io/kube-openapi v0.0.0-20240730131305-7a9a4e85957e h1:OnKkExfhk4yxMqvBSPzUfhv3zQ96FWJ+UOZzLrAFyAo= k8s.io/kube-openapi v0.0.0-20240730131305-7a9a4e85957e/go.mod h1:0CVn9SVo8PeW5/JgsBZZIFmmTk5noOM8WXf2e1tCihE= -k8s.io/kubelet v0.31.3 h1:DIXRAmvVGp42mV2vpA1GCLU6oO8who0/vp3Oq6kSpbI= -k8s.io/kubelet v0.31.3/go.mod h1:KSdbEfNy5VzqUlAHlytA/fH12s+sE1u8fb/8JY9sL/8= +k8s.io/kubelet v0.31.4 h1:6TokbMv+HnFG7Oe9tVS/J0VPGdC4GnsQZXuZoo7Ixi8= +k8s.io/kubelet v0.31.4/go.mod h1:8ZM5LZyANoVxUtmayUxD/nsl+6GjREo7kSanv8AoL4U= k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A= k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3 h1:2770sDpzrjjsAtVhSeUFseziht227YAWYHLGNM8QPwY= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw= -sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.2.7 h1:dgpy4qVuTsrgtjg0ZHcXll8DUe/aYTNBY01CpqG7qQ0= -sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.2.7/go.mod h1:i/hFmBZ8SSJxneGtIfWKU3HTzqumpOU0WjJVeaWupUs= -sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.1.8 h1:fwg1J+nRRXkcA0lIJ/a4fJPg7tNggRH1pPOukthuAGw= -sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.1.8/go.mod h1:kUW9qMqi412c5+nXdYA00oSudWC9nVUCM4v1k3HtgZo= +sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.2.10 h1:ifmiMARllWujRwOOoaPZXg9KCwYIOUu26ecTA+WB/Es= +sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.2.10/go.mod h1:hQhOHrM/+jMh0k+YfV5GVKyqG5skeu4AOjqBEW3xYio= +sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.2.1 h1:oiGD0blZ6J6bVSe6uw0kSM/E1Ba7D/0G7fNtdT77wgM= +sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.2.1/go.mod h1:MxAB6L6HUzK2auGiLi1GAXYa0ZLBx2hxhveQruVfMmU= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= diff --git a/vendor/modules.txt b/vendor/modules.txt index df6bf53bb3..bbcae4027c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -579,7 +579,7 @@ go.uber.org/zap/internal/pool go.uber.org/zap/internal/stacktrace go.uber.org/zap/zapcore go.uber.org/zap/zapgrpc -# golang.org/x/crypto v0.30.0 +# golang.org/x/crypto v0.31.0 ## explicit; go 1.20 golang.org/x/crypto/cryptobyte golang.org/x/crypto/cryptobyte/asn1 @@ -792,7 +792,7 @@ gopkg.in/yaml.v2 # gopkg.in/yaml.v3 v3.0.1 ## explicit gopkg.in/yaml.v3 -# k8s.io/api v0.31.3 +# k8s.io/api v0.31.4 ## explicit; go 1.22.0 k8s.io/api/admission/v1 k8s.io/api/admission/v1beta1 @@ -852,7 +852,7 @@ k8s.io/api/storage/v1 k8s.io/api/storage/v1alpha1 k8s.io/api/storage/v1beta1 k8s.io/api/storagemigration/v1alpha1 -# k8s.io/apimachinery v0.31.3 +# k8s.io/apimachinery v0.31.4 ## explicit; go 1.22.0 k8s.io/apimachinery/pkg/api/equality k8s.io/apimachinery/pkg/api/errors @@ -916,7 +916,7 @@ k8s.io/apimachinery/pkg/version k8s.io/apimachinery/pkg/watch k8s.io/apimachinery/third_party/forked/golang/json k8s.io/apimachinery/third_party/forked/golang/reflect -# k8s.io/apiserver v0.31.3 +# k8s.io/apiserver v0.31.4 ## explicit; go 1.22.0 k8s.io/apiserver/pkg/admission k8s.io/apiserver/pkg/admission/configuration @@ -1067,7 +1067,7 @@ k8s.io/apiserver/plugin/pkg/audit/webhook k8s.io/apiserver/plugin/pkg/authenticator/token/webhook k8s.io/apiserver/plugin/pkg/authorizer/webhook k8s.io/apiserver/plugin/pkg/authorizer/webhook/metrics -# k8s.io/client-go v0.31.3 +# k8s.io/client-go v0.31.4 ## explicit; go 1.22.0 k8s.io/client-go/applyconfigurations k8s.io/client-go/applyconfigurations/admissionregistration/v1 @@ -1400,7 +1400,7 @@ k8s.io/client-go/util/keyutil k8s.io/client-go/util/retry k8s.io/client-go/util/watchlist k8s.io/client-go/util/workqueue -# k8s.io/cloud-provider v0.31.3 +# k8s.io/cloud-provider v0.31.4 ## explicit; go 1.22.0 k8s.io/cloud-provider k8s.io/cloud-provider/api @@ -1420,7 +1420,7 @@ k8s.io/cloud-provider/names k8s.io/cloud-provider/node/helpers k8s.io/cloud-provider/options k8s.io/cloud-provider/service/helpers -# k8s.io/component-base v0.31.3 +# k8s.io/component-base v0.31.4 ## explicit; go 1.22.0 k8s.io/component-base/cli/flag k8s.io/component-base/cli/globalflag @@ -1449,10 +1449,10 @@ k8s.io/component-base/term k8s.io/component-base/tracing k8s.io/component-base/tracing/api/v1 k8s.io/component-base/version -# k8s.io/component-helpers v0.31.3 +# k8s.io/component-helpers v0.31.4 ## explicit; go 1.22.0 k8s.io/component-helpers/node/util -# k8s.io/controller-manager v0.31.3 +# k8s.io/controller-manager v0.31.4 ## explicit; go 1.22.0 k8s.io/controller-manager/app k8s.io/controller-manager/config @@ -1506,7 +1506,7 @@ k8s.io/kube-openapi/pkg/validation/errors k8s.io/kube-openapi/pkg/validation/spec k8s.io/kube-openapi/pkg/validation/strfmt k8s.io/kube-openapi/pkg/validation/strfmt/bson -# k8s.io/kubelet v0.31.3 +# k8s.io/kubelet v0.31.4 ## explicit; go 1.22.0 k8s.io/kubelet/pkg/apis/credentialprovider k8s.io/kubelet/pkg/apis/credentialprovider/install @@ -1534,7 +1534,7 @@ sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/client sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/client/metrics sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/common/metrics sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client -# sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.2.7 +# sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.2.10 ## explicit; go 1.23.1 sigs.k8s.io/cloud-provider-azure/pkg/azclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient @@ -1619,7 +1619,7 @@ sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworkclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworkclient/mock_virtualnetworkclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworklinkclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/virtualnetworklinkclient/mock_virtualnetworklinkclient -# sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.1.8 +# sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.2.1 ## explicit; go 1.23.1 sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader # sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/arm_conf.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/arm_conf.go index 45f1d8d051..5b4fc14310 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/arm_conf.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/arm_conf.go @@ -45,6 +45,10 @@ type ARMClientConfig struct { CloudProviderBackoffRetries int32 `json:"cloudProviderBackoffRetries,omitempty" yaml:"cloudProviderBackoffRetries,omitempty"` // Backoff duration CloudProviderBackoffDuration int `json:"cloudProviderBackoffDuration,omitempty" yaml:"cloudProviderBackoffDuration,omitempty"` + //Storage suffix + StorageSuffix *string `json:"storageSuffix,omitempty" yaml:"storageSuffix,omitempty"` + //ACRLoginServer + ACRLoginServer *string `json:"acrLoginServer,omitempty" yaml:"containerRegistrySuffix,omitempty"` } func (config *ARMClientConfig) GetTenantID() string { @@ -65,7 +69,7 @@ func GetAzCoreClientOption(armConfig *ARMClientConfig) (*policy.ClientOptions, e azCoreClientConfig.PerCallPolicies = append(azCoreClientConfig.PerCallPolicies, useragent.NewCustomUserAgentPolicy(userAgent)) } //set cloud - cloudConfig, err := GetAzureCloudConfig(armConfig) + cloudConfig, err := GetAzureCloudConfigAndBackfillARMClientConfig(armConfig) if err != nil { return nil, err } diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/cloud.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/cloud.go index ca1c877c5a..a416f26ecd 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/cloud.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/cloud.go @@ -52,67 +52,80 @@ func AzureCloudConfigFromName(cloudName string) *cloud.Configuration { return nil } -// AzureCloudConfigFromURL returns cloud config from url +// OverrideAzureCloudConfigFromMetadataService returns cloud config from url // track2 sdk will add this one in the near future https://github.com/Azure/azure-sdk-for-go/issues/20959 -func AzureCloudConfigFromURL(endpoint string) (*cloud.Configuration, error) { - managementEndpoint := fmt.Sprintf("%s%s", strings.TrimSuffix(endpoint, "/"), "/metadata/endpoints?api-version=2019-05-01") +func OverrideAzureCloudConfigFromMetadataService(armconfig *ARMClientConfig, config *cloud.Configuration) error { + if armconfig == nil || armconfig.ResourceManagerEndpoint == "" { + return nil + } + + managementEndpoint := fmt.Sprintf("%s%s", strings.TrimSuffix(armconfig.ResourceManagerEndpoint, "/"), "/metadata/endpoints?api-version=2019-05-01") res, err := http.Get(managementEndpoint) //nolint if err != nil { - return nil, err + return err } body, err := io.ReadAll(res.Body) if err != nil { - return nil, err + return err } metadata := []struct { - Authentication struct { - Audiences []string - LoginEndpoint string - } - Name, ResourceManager string + Name string `json:"name"` + ResourceManager string `json:"resourceManager,omitempty"` + Authentication struct { + Audiences []string `json:"audiences"` + LoginEndpoint string `json:"loginEndpoint,omitempty"` + } `json:"authentication"` + Suffixes struct { + AcrLoginServer *string `json:"acrLoginServer,omitempty"` + Storage *string `json:"storage,omitempty"` + } `json:"suffixes,omitempty"` }{} err = json.Unmarshal(body, &metadata) if err != nil { - return nil, err + return err } - if len(metadata) > 0 { - // We use the endpoint to build our config, but on ASH the config returned - // does not contain the endpoint, and this is not accounted for. This - // ultimately unsets it for the returned config, causing the bootstrap of - // the provider to fail. Instead, check if the endpoint is returned, and if - // It is not then set it. - if len(metadata[0].ResourceManager) == 0 { - metadata[0].ResourceManager = endpoint + for _, item := range metadata { + if armconfig.Cloud == "" || strings.EqualFold(item.Name, armconfig.Cloud) { + // We use the endpoint to build our config, but on ASH the config returned + // does not contain the endpoint, and this is not accounted for. This + // ultimately unsets it for the returned config, causing the bootstrap of + // the provider to fail. Instead, check if the endpoint is returned, and if + // It is not then set it. + if item.ResourceManager == "" { + item.ResourceManager = armconfig.ResourceManagerEndpoint + } + config.Services[cloud.ResourceManager] = cloud.ServiceConfiguration{ + Endpoint: item.ResourceManager, + Audience: item.Authentication.Audiences[0], + } + if item.Authentication.LoginEndpoint != "" { + config.ActiveDirectoryAuthorityHost = item.Authentication.LoginEndpoint + } + if item.Suffixes.Storage != nil && armconfig.StorageSuffix == nil { + armconfig.StorageSuffix = item.Suffixes.Storage + } + if item.Suffixes.AcrLoginServer != nil && armconfig.ACRLoginServer == nil { + armconfig.ACRLoginServer = item.Suffixes.AcrLoginServer + } + return nil } - return &cloud.Configuration{ - ActiveDirectoryAuthorityHost: metadata[0].Authentication.LoginEndpoint, - Services: map[cloud.ServiceName]cloud.ServiceConfiguration{ - cloud.ResourceManager: { - Endpoint: metadata[0].ResourceManager, - Audience: metadata[0].Authentication.Audiences[0], - }, - }, - }, nil - } - return nil, nil + } + return nil } -func AzureCloudConfigOverrideFromEnv(config *cloud.Configuration) (*cloud.Configuration, error) { - if config == nil { - config = &cloud.AzurePublic - } +func OverrideAzureCloudConfigFromEnv(armconfig *ARMClientConfig, config *cloud.Configuration) error { envFilePath, ok := os.LookupEnv(EnvironmentFilepathName) if !ok { - return config, nil + return nil } content, err := os.ReadFile(envFilePath) if err != nil { - return nil, err + return err } var envConfig Environment if err = json.Unmarshal(content, &envConfig); err != nil { - return nil, err + return err } if len(envConfig.ActiveDirectoryEndpoint) > 0 { config.ActiveDirectoryAuthorityHost = envConfig.ActiveDirectoryEndpoint @@ -123,61 +136,44 @@ func AzureCloudConfigOverrideFromEnv(config *cloud.Configuration) (*cloud.Config Audience: envConfig.TokenAudience, } } - return config, nil + if len(envConfig.StorageEndpointSuffix) > 0 { + armconfig.StorageSuffix = &envConfig.StorageEndpointSuffix + } + if len(envConfig.ContainerRegistryDNSSuffix) > 0 { + armconfig.ACRLoginServer = &envConfig.ContainerRegistryDNSSuffix + } + return nil } -// GetAzureCloudConfig returns the cloud configuration for the given ARMClientConfig. -func GetAzureCloudConfig(armConfig *ARMClientConfig) (*cloud.Configuration, error) { +// GetAzureCloudConfigAndBackfillArmClientConfig retrieves the Azure cloud configuration based on the provided ARM client configuration. +// If the ARM client configuration is nil, it returns the default Azure public cloud configuration. +// It attempts to override the cloud configuration using metadata service and environment variables. +// +// Parameters: +// - armConfig: A pointer to an ARMClientConfig struct containing the ARM client configuration. +// +// Returns: +// - A pointer to a cloud.Configuration struct representing the Azure cloud configuration. +// - An error if there is an issue overriding the cloud configuration from metadata service or environment variables. +func GetAzureCloudConfigAndBackfillARMClientConfig(armConfig *ARMClientConfig) (*cloud.Configuration, error) { + config := &cloud.AzurePublic if armConfig == nil { - return &cloud.AzurePublic, nil + return config, nil } - if armConfig.ResourceManagerEndpoint != "" { - return AzureCloudConfigFromURL(armConfig.ResourceManagerEndpoint) + config = AzureCloudConfigFromName(armConfig.Cloud) + if err := OverrideAzureCloudConfigFromMetadataService(armConfig, config); err != nil { + return nil, err } - - return AzureCloudConfigOverrideFromEnv(AzureCloudConfigFromName(armConfig.Cloud)) + err := OverrideAzureCloudConfigFromEnv(armConfig, config) + return config, err } // Environment represents a set of endpoints for each of Azure's Clouds. type Environment struct { - Name string `json:"name"` - ManagementPortalURL string `json:"managementPortalURL"` - PublishSettingsURL string `json:"publishSettingsURL"` - ServiceManagementEndpoint string `json:"serviceManagementEndpoint"` - ResourceManagerEndpoint string `json:"resourceManagerEndpoint"` - ActiveDirectoryEndpoint string `json:"activeDirectoryEndpoint"` - GalleryEndpoint string `json:"galleryEndpoint"` - KeyVaultEndpoint string `json:"keyVaultEndpoint"` - ManagedHSMEndpoint string `json:"managedHSMEndpoint"` - GraphEndpoint string `json:"graphEndpoint"` - ServiceBusEndpoint string `json:"serviceBusEndpoint"` - BatchManagementEndpoint string `json:"batchManagementEndpoint"` - MicrosoftGraphEndpoint string `json:"microsoftGraphEndpoint"` - StorageEndpointSuffix string `json:"storageEndpointSuffix"` - CosmosDBDNSSuffix string `json:"cosmosDBDNSSuffix"` - MariaDBDNSSuffix string `json:"mariaDBDNSSuffix"` - MySQLDatabaseDNSSuffix string `json:"mySqlDatabaseDNSSuffix"` - PostgresqlDatabaseDNSSuffix string `json:"postgresqlDatabaseDNSSuffix"` - SQLDatabaseDNSSuffix string `json:"sqlDatabaseDNSSuffix"` - TrafficManagerDNSSuffix string `json:"trafficManagerDNSSuffix"` - KeyVaultDNSSuffix string `json:"keyVaultDNSSuffix"` - ManagedHSMDNSSuffix string `json:"managedHSMDNSSuffix"` - ServiceBusEndpointSuffix string `json:"serviceBusEndpointSuffix"` - ServiceManagementVMDNSSuffix string `json:"serviceManagementVMDNSSuffix"` - ResourceManagerVMDNSSuffix string `json:"resourceManagerVMDNSSuffix"` - ContainerRegistryDNSSuffix string `json:"containerRegistryDNSSuffix"` - TokenAudience string `json:"tokenAudience"` - APIManagementHostNameSuffix string `json:"apiManagementHostNameSuffix"` - SynapseEndpointSuffix string `json:"synapseEndpointSuffix"` - DatalakeSuffix string `json:"datalakeSuffix"` - ResourceIdentifiers ResourceIdentifier `json:"resourceIdentifiers"` -} - -// ResourceIdentifier contains a set of Azure resource IDs. -type ResourceIdentifier struct { - Graph string `json:"graph"` - KeyVault string `json:"keyVault"` - Datalake string `json:"datalake"` - Batch string `json:"batch"` - OperationalInsights string `json:"operationalInsights"` + Name string `json:"name"` + ResourceManagerEndpoint string `json:"resourceManagerEndpoint"` + ActiveDirectoryEndpoint string `json:"activeDirectoryEndpoint"` + StorageEndpointSuffix string `json:"storageEndpointSuffix"` + ContainerRegistryDNSSuffix string `json:"containerRegistryDNSSuffix"` + TokenAudience string `json:"tokenAudience"` } diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/factory_gen.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/factory_gen.go index 138d3f24ca..6587183171 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/factory_gen.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/factory_gen.go @@ -67,7 +67,7 @@ import ( type ClientFactoryImpl struct { armConfig *ARMClientConfig - facotryConfig *ClientFactoryConfig + factoryConfig *ClientFactoryConfig cred azcore.TokenCredential clientOptionsMutFn []func(option *arm.ClientOptions) accountclientInterface sync.Map @@ -120,7 +120,7 @@ func NewClientFactory(config *ClientFactoryConfig, armConfig *ARMClientConfig, c factory := &ClientFactoryImpl{ armConfig: armConfig, - facotryConfig: config, + factoryConfig: config, cred: cred, clientOptionsMutFn: clientOptionsMutFn, } @@ -345,7 +345,7 @@ func NewClientFactory(config *ClientFactoryConfig, armConfig *ARMClientConfig, c func (factory *ClientFactoryImpl) createAccountClient(subscription string) (accountclient.Interface, error) { //initialize accountclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } @@ -355,7 +355,7 @@ func (factory *ClientFactoryImpl) createAccountClient(subscription string) (acco } //add ratelimit policy - ratelimitOption := factory.facotryConfig.GetRateLimitConfig("storageAccountRateLimit") + ratelimitOption := factory.factoryConfig.GetRateLimitConfig("storageAccountRateLimit") rateLimitPolicy := ratelimit.NewRateLimitPolicy(ratelimitOption) if rateLimitPolicy != nil { options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) @@ -369,12 +369,12 @@ func (factory *ClientFactoryImpl) createAccountClient(subscription string) (acco } func (factory *ClientFactoryImpl) GetAccountClient() accountclient.Interface { - clientImp, _ := factory.accountclientInterface.Load(strings.ToLower(factory.facotryConfig.SubscriptionID)) + clientImp, _ := factory.accountclientInterface.Load(strings.ToLower(factory.factoryConfig.SubscriptionID)) return clientImp.(accountclient.Interface) } func (factory *ClientFactoryImpl) GetAccountClientForSub(subscriptionID string) (accountclient.Interface, error) { if subscriptionID == "" { - subscriptionID = factory.facotryConfig.SubscriptionID + subscriptionID = factory.factoryConfig.SubscriptionID } clientImp, loaded := factory.accountclientInterface.Load(strings.ToLower(subscriptionID)) if loaded { @@ -391,7 +391,7 @@ func (factory *ClientFactoryImpl) GetAccountClientForSub(subscriptionID string) func (factory *ClientFactoryImpl) createAvailabilitySetClient(subscription string) (availabilitysetclient.Interface, error) { //initialize availabilitysetclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } @@ -401,7 +401,7 @@ func (factory *ClientFactoryImpl) createAvailabilitySetClient(subscription strin } //add ratelimit policy - ratelimitOption := factory.facotryConfig.GetRateLimitConfig("availabilitySetRateLimit") + ratelimitOption := factory.factoryConfig.GetRateLimitConfig("availabilitySetRateLimit") rateLimitPolicy := ratelimit.NewRateLimitPolicy(ratelimitOption) if rateLimitPolicy != nil { options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) @@ -420,13 +420,13 @@ func (factory *ClientFactoryImpl) GetAvailabilitySetClient() availabilitysetclie func (factory *ClientFactoryImpl) createBackendAddressPoolClient(subscription string) (backendaddresspoolclient.Interface, error) { //initialize backendaddresspoolclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } //add ratelimit policy - ratelimitOption := factory.facotryConfig.GetRateLimitConfig("loadBalancerRateLimit") + ratelimitOption := factory.factoryConfig.GetRateLimitConfig("loadBalancerRateLimit") rateLimitPolicy := ratelimit.NewRateLimitPolicy(ratelimitOption) if rateLimitPolicy != nil { options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) @@ -445,7 +445,7 @@ func (factory *ClientFactoryImpl) GetBackendAddressPoolClient() backendaddresspo func (factory *ClientFactoryImpl) createBlobContainerClient(subscription string) (blobcontainerclient.Interface, error) { //initialize blobcontainerclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } @@ -463,12 +463,12 @@ func (factory *ClientFactoryImpl) createBlobContainerClient(subscription string) } func (factory *ClientFactoryImpl) GetBlobContainerClient() blobcontainerclient.Interface { - clientImp, _ := factory.blobcontainerclientInterface.Load(strings.ToLower(factory.facotryConfig.SubscriptionID)) + clientImp, _ := factory.blobcontainerclientInterface.Load(strings.ToLower(factory.factoryConfig.SubscriptionID)) return clientImp.(blobcontainerclient.Interface) } func (factory *ClientFactoryImpl) GetBlobContainerClientForSub(subscriptionID string) (blobcontainerclient.Interface, error) { if subscriptionID == "" { - subscriptionID = factory.facotryConfig.SubscriptionID + subscriptionID = factory.factoryConfig.SubscriptionID } clientImp, loaded := factory.blobcontainerclientInterface.Load(strings.ToLower(subscriptionID)) if loaded { @@ -485,7 +485,7 @@ func (factory *ClientFactoryImpl) GetBlobContainerClientForSub(subscriptionID st func (factory *ClientFactoryImpl) createBlobServicePropertiesClient(subscription string) (blobservicepropertiesclient.Interface, error) { //initialize blobservicepropertiesclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } @@ -503,12 +503,12 @@ func (factory *ClientFactoryImpl) createBlobServicePropertiesClient(subscription } func (factory *ClientFactoryImpl) GetBlobServicePropertiesClient() blobservicepropertiesclient.Interface { - clientImp, _ := factory.blobservicepropertiesclientInterface.Load(strings.ToLower(factory.facotryConfig.SubscriptionID)) + clientImp, _ := factory.blobservicepropertiesclientInterface.Load(strings.ToLower(factory.factoryConfig.SubscriptionID)) return clientImp.(blobservicepropertiesclient.Interface) } func (factory *ClientFactoryImpl) GetBlobServicePropertiesClientForSub(subscriptionID string) (blobservicepropertiesclient.Interface, error) { if subscriptionID == "" { - subscriptionID = factory.facotryConfig.SubscriptionID + subscriptionID = factory.factoryConfig.SubscriptionID } clientImp, loaded := factory.blobservicepropertiesclientInterface.Load(strings.ToLower(subscriptionID)) if loaded { @@ -525,13 +525,13 @@ func (factory *ClientFactoryImpl) GetBlobServicePropertiesClientForSub(subscript func (factory *ClientFactoryImpl) createDeploymentClient(subscription string) (deploymentclient.Interface, error) { //initialize deploymentclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } //add ratelimit policy - ratelimitOption := factory.facotryConfig.GetRateLimitConfig("deploymentRateLimit") + ratelimitOption := factory.factoryConfig.GetRateLimitConfig("deploymentRateLimit") rateLimitPolicy := ratelimit.NewRateLimitPolicy(ratelimitOption) if rateLimitPolicy != nil { options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) @@ -550,7 +550,7 @@ func (factory *ClientFactoryImpl) GetDeploymentClient() deploymentclient.Interfa func (factory *ClientFactoryImpl) createDiskClient(subscription string) (diskclient.Interface, error) { //initialize diskclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } @@ -560,7 +560,7 @@ func (factory *ClientFactoryImpl) createDiskClient(subscription string) (diskcli } //add ratelimit policy - ratelimitOption := factory.facotryConfig.GetRateLimitConfig("diskRateLimit") + ratelimitOption := factory.factoryConfig.GetRateLimitConfig("diskRateLimit") rateLimitPolicy := ratelimit.NewRateLimitPolicy(ratelimitOption) if rateLimitPolicy != nil { options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) @@ -574,12 +574,12 @@ func (factory *ClientFactoryImpl) createDiskClient(subscription string) (diskcli } func (factory *ClientFactoryImpl) GetDiskClient() diskclient.Interface { - clientImp, _ := factory.diskclientInterface.Load(strings.ToLower(factory.facotryConfig.SubscriptionID)) + clientImp, _ := factory.diskclientInterface.Load(strings.ToLower(factory.factoryConfig.SubscriptionID)) return clientImp.(diskclient.Interface) } func (factory *ClientFactoryImpl) GetDiskClientForSub(subscriptionID string) (diskclient.Interface, error) { if subscriptionID == "" { - subscriptionID = factory.facotryConfig.SubscriptionID + subscriptionID = factory.factoryConfig.SubscriptionID } clientImp, loaded := factory.diskclientInterface.Load(strings.ToLower(subscriptionID)) if loaded { @@ -596,7 +596,7 @@ func (factory *ClientFactoryImpl) GetDiskClientForSub(subscriptionID string) (di func (factory *ClientFactoryImpl) createFileServicePropertiesClient(subscription string) (fileservicepropertiesclient.Interface, error) { //initialize fileservicepropertiesclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } @@ -610,12 +610,12 @@ func (factory *ClientFactoryImpl) createFileServicePropertiesClient(subscription } func (factory *ClientFactoryImpl) GetFileServicePropertiesClient() fileservicepropertiesclient.Interface { - clientImp, _ := factory.fileservicepropertiesclientInterface.Load(strings.ToLower(factory.facotryConfig.SubscriptionID)) + clientImp, _ := factory.fileservicepropertiesclientInterface.Load(strings.ToLower(factory.factoryConfig.SubscriptionID)) return clientImp.(fileservicepropertiesclient.Interface) } func (factory *ClientFactoryImpl) GetFileServicePropertiesClientForSub(subscriptionID string) (fileservicepropertiesclient.Interface, error) { if subscriptionID == "" { - subscriptionID = factory.facotryConfig.SubscriptionID + subscriptionID = factory.factoryConfig.SubscriptionID } clientImp, loaded := factory.fileservicepropertiesclientInterface.Load(strings.ToLower(subscriptionID)) if loaded { @@ -632,7 +632,7 @@ func (factory *ClientFactoryImpl) GetFileServicePropertiesClientForSub(subscript func (factory *ClientFactoryImpl) createFileShareClient(subscription string) (fileshareclient.Interface, error) { //initialize fileshareclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } @@ -646,12 +646,12 @@ func (factory *ClientFactoryImpl) createFileShareClient(subscription string) (fi } func (factory *ClientFactoryImpl) GetFileShareClient() fileshareclient.Interface { - clientImp, _ := factory.fileshareclientInterface.Load(strings.ToLower(factory.facotryConfig.SubscriptionID)) + clientImp, _ := factory.fileshareclientInterface.Load(strings.ToLower(factory.factoryConfig.SubscriptionID)) return clientImp.(fileshareclient.Interface) } func (factory *ClientFactoryImpl) GetFileShareClientForSub(subscriptionID string) (fileshareclient.Interface, error) { if subscriptionID == "" { - subscriptionID = factory.facotryConfig.SubscriptionID + subscriptionID = factory.factoryConfig.SubscriptionID } clientImp, loaded := factory.fileshareclientInterface.Load(strings.ToLower(subscriptionID)) if loaded { @@ -668,7 +668,7 @@ func (factory *ClientFactoryImpl) GetFileShareClientForSub(subscriptionID string func (factory *ClientFactoryImpl) createIdentityClient(subscription string) (identityclient.Interface, error) { //initialize identityclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } @@ -687,7 +687,7 @@ func (factory *ClientFactoryImpl) GetIdentityClient() identityclient.Interface { func (factory *ClientFactoryImpl) createInterfaceClient(subscription string) (interfaceclient.Interface, error) { //initialize interfaceclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } @@ -697,7 +697,7 @@ func (factory *ClientFactoryImpl) createInterfaceClient(subscription string) (in } //add ratelimit policy - ratelimitOption := factory.facotryConfig.GetRateLimitConfig("interfaceRateLimit") + ratelimitOption := factory.factoryConfig.GetRateLimitConfig("interfaceRateLimit") rateLimitPolicy := ratelimit.NewRateLimitPolicy(ratelimitOption) if rateLimitPolicy != nil { options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) @@ -716,13 +716,13 @@ func (factory *ClientFactoryImpl) GetInterfaceClient() interfaceclient.Interface func (factory *ClientFactoryImpl) createIPGroupClient(subscription string) (ipgroupclient.Interface, error) { //initialize ipgroupclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } //add ratelimit policy - ratelimitOption := factory.facotryConfig.GetRateLimitConfig("ipGroupRateLimit") + ratelimitOption := factory.factoryConfig.GetRateLimitConfig("ipGroupRateLimit") rateLimitPolicy := ratelimit.NewRateLimitPolicy(ratelimitOption) if rateLimitPolicy != nil { options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) @@ -741,7 +741,7 @@ func (factory *ClientFactoryImpl) GetIPGroupClient() ipgroupclient.Interface { func (factory *ClientFactoryImpl) createLoadBalancerClient(subscription string) (loadbalancerclient.Interface, error) { //initialize loadbalancerclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } @@ -751,7 +751,7 @@ func (factory *ClientFactoryImpl) createLoadBalancerClient(subscription string) } //add ratelimit policy - ratelimitOption := factory.facotryConfig.GetRateLimitConfig("loadBalancerRateLimit") + ratelimitOption := factory.factoryConfig.GetRateLimitConfig("loadBalancerRateLimit") rateLimitPolicy := ratelimit.NewRateLimitPolicy(ratelimitOption) if rateLimitPolicy != nil { options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) @@ -770,13 +770,13 @@ func (factory *ClientFactoryImpl) GetLoadBalancerClient() loadbalancerclient.Int func (factory *ClientFactoryImpl) createManagedClusterClient(subscription string) (managedclusterclient.Interface, error) { //initialize managedclusterclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } //add ratelimit policy - ratelimitOption := factory.facotryConfig.GetRateLimitConfig("containerServiceRateLimit") + ratelimitOption := factory.factoryConfig.GetRateLimitConfig("containerServiceRateLimit") rateLimitPolicy := ratelimit.NewRateLimitPolicy(ratelimitOption) if rateLimitPolicy != nil { options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) @@ -795,7 +795,7 @@ func (factory *ClientFactoryImpl) GetManagedClusterClient() managedclusterclient func (factory *ClientFactoryImpl) createPrivateDNSZoneGroupClient(subscription string) (privatednszonegroupclient.Interface, error) { //initialize privatednszonegroupclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } @@ -814,13 +814,13 @@ func (factory *ClientFactoryImpl) GetPrivateDNSZoneGroupClient() privatednszoneg func (factory *ClientFactoryImpl) createPrivateEndpointClient(subscription string) (privateendpointclient.Interface, error) { //initialize privateendpointclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } //add ratelimit policy - ratelimitOption := factory.facotryConfig.GetRateLimitConfig("privateEndpointRateLimit") + ratelimitOption := factory.factoryConfig.GetRateLimitConfig("privateEndpointRateLimit") rateLimitPolicy := ratelimit.NewRateLimitPolicy(ratelimitOption) if rateLimitPolicy != nil { options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) @@ -839,7 +839,7 @@ func (factory *ClientFactoryImpl) GetPrivateEndpointClient() privateendpointclie func (factory *ClientFactoryImpl) createPrivateLinkServiceClient(subscription string) (privatelinkserviceclient.Interface, error) { //initialize privatelinkserviceclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } @@ -849,7 +849,7 @@ func (factory *ClientFactoryImpl) createPrivateLinkServiceClient(subscription st } //add ratelimit policy - ratelimitOption := factory.facotryConfig.GetRateLimitConfig("privateLinkServiceRateLimit") + ratelimitOption := factory.factoryConfig.GetRateLimitConfig("privateLinkServiceRateLimit") rateLimitPolicy := ratelimit.NewRateLimitPolicy(ratelimitOption) if rateLimitPolicy != nil { options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) @@ -868,7 +868,7 @@ func (factory *ClientFactoryImpl) GetPrivateLinkServiceClient() privatelinkservi func (factory *ClientFactoryImpl) createPrivateZoneClient(subscription string) (privatezoneclient.Interface, error) { //initialize privatezoneclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } @@ -878,7 +878,7 @@ func (factory *ClientFactoryImpl) createPrivateZoneClient(subscription string) ( } //add ratelimit policy - ratelimitOption := factory.facotryConfig.GetRateLimitConfig("privateDNSRateLimit") + ratelimitOption := factory.factoryConfig.GetRateLimitConfig("privateDNSRateLimit") rateLimitPolicy := ratelimit.NewRateLimitPolicy(ratelimitOption) if rateLimitPolicy != nil { options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) @@ -897,7 +897,7 @@ func (factory *ClientFactoryImpl) GetPrivateZoneClient() privatezoneclient.Inter func (factory *ClientFactoryImpl) createProviderClient(subscription string) (providerclient.Interface, error) { //initialize providerclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } @@ -916,7 +916,7 @@ func (factory *ClientFactoryImpl) GetProviderClient() providerclient.Interface { func (factory *ClientFactoryImpl) createPublicIPAddressClient(subscription string) (publicipaddressclient.Interface, error) { //initialize publicipaddressclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } @@ -926,7 +926,7 @@ func (factory *ClientFactoryImpl) createPublicIPAddressClient(subscription strin } //add ratelimit policy - ratelimitOption := factory.facotryConfig.GetRateLimitConfig("publicIPAddressRateLimit") + ratelimitOption := factory.factoryConfig.GetRateLimitConfig("publicIPAddressRateLimit") rateLimitPolicy := ratelimit.NewRateLimitPolicy(ratelimitOption) if rateLimitPolicy != nil { options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) @@ -945,7 +945,7 @@ func (factory *ClientFactoryImpl) GetPublicIPAddressClient() publicipaddressclie func (factory *ClientFactoryImpl) createPublicIPPrefixClient(subscription string) (publicipprefixclient.Interface, error) { //initialize publicipprefixclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } @@ -964,7 +964,7 @@ func (factory *ClientFactoryImpl) GetPublicIPPrefixClient() publicipprefixclient func (factory *ClientFactoryImpl) createRegistryClient(subscription string) (registryclient.Interface, error) { //initialize registryclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } @@ -983,7 +983,7 @@ func (factory *ClientFactoryImpl) GetRegistryClient() registryclient.Interface { func (factory *ClientFactoryImpl) createResourceGroupClient(subscription string) (resourcegroupclient.Interface, error) { //initialize resourcegroupclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } @@ -1002,7 +1002,7 @@ func (factory *ClientFactoryImpl) GetResourceGroupClient() resourcegroupclient.I func (factory *ClientFactoryImpl) createRoleAssignmentClient(subscription string) (roleassignmentclient.Interface, error) { //initialize roleassignmentclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } @@ -1021,7 +1021,7 @@ func (factory *ClientFactoryImpl) GetRoleAssignmentClient() roleassignmentclient func (factory *ClientFactoryImpl) createRouteTableClient(subscription string) (routetableclient.Interface, error) { //initialize routetableclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } @@ -1031,7 +1031,7 @@ func (factory *ClientFactoryImpl) createRouteTableClient(subscription string) (r } //add ratelimit policy - ratelimitOption := factory.facotryConfig.GetRateLimitConfig("routeTableRateLimit") + ratelimitOption := factory.factoryConfig.GetRateLimitConfig("routeTableRateLimit") rateLimitPolicy := ratelimit.NewRateLimitPolicy(ratelimitOption) if rateLimitPolicy != nil { options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) @@ -1050,7 +1050,7 @@ func (factory *ClientFactoryImpl) GetRouteTableClient() routetableclient.Interfa func (factory *ClientFactoryImpl) createSecretClient(subscription string) (secretclient.Interface, error) { //initialize secretclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } @@ -1069,7 +1069,7 @@ func (factory *ClientFactoryImpl) GetSecretClient() secretclient.Interface { func (factory *ClientFactoryImpl) createSecurityGroupClient(subscription string) (securitygroupclient.Interface, error) { //initialize securitygroupclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } @@ -1079,7 +1079,7 @@ func (factory *ClientFactoryImpl) createSecurityGroupClient(subscription string) } //add ratelimit policy - ratelimitOption := factory.facotryConfig.GetRateLimitConfig("securityGroupRateLimit") + ratelimitOption := factory.factoryConfig.GetRateLimitConfig("securityGroupRateLimit") rateLimitPolicy := ratelimit.NewRateLimitPolicy(ratelimitOption) if rateLimitPolicy != nil { options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) @@ -1098,7 +1098,7 @@ func (factory *ClientFactoryImpl) GetSecurityGroupClient() securitygroupclient.I func (factory *ClientFactoryImpl) createSnapshotClient(subscription string) (snapshotclient.Interface, error) { //initialize snapshotclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } @@ -1108,7 +1108,7 @@ func (factory *ClientFactoryImpl) createSnapshotClient(subscription string) (sna } //add ratelimit policy - ratelimitOption := factory.facotryConfig.GetRateLimitConfig("snapshotRateLimit") + ratelimitOption := factory.factoryConfig.GetRateLimitConfig("snapshotRateLimit") rateLimitPolicy := ratelimit.NewRateLimitPolicy(ratelimitOption) if rateLimitPolicy != nil { options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) @@ -1122,12 +1122,12 @@ func (factory *ClientFactoryImpl) createSnapshotClient(subscription string) (sna } func (factory *ClientFactoryImpl) GetSnapshotClient() snapshotclient.Interface { - clientImp, _ := factory.snapshotclientInterface.Load(strings.ToLower(factory.facotryConfig.SubscriptionID)) + clientImp, _ := factory.snapshotclientInterface.Load(strings.ToLower(factory.factoryConfig.SubscriptionID)) return clientImp.(snapshotclient.Interface) } func (factory *ClientFactoryImpl) GetSnapshotClientForSub(subscriptionID string) (snapshotclient.Interface, error) { if subscriptionID == "" { - subscriptionID = factory.facotryConfig.SubscriptionID + subscriptionID = factory.factoryConfig.SubscriptionID } clientImp, loaded := factory.snapshotclientInterface.Load(strings.ToLower(subscriptionID)) if loaded { @@ -1144,7 +1144,7 @@ func (factory *ClientFactoryImpl) GetSnapshotClientForSub(subscriptionID string) func (factory *ClientFactoryImpl) createSSHPublicKeyResourceClient(subscription string) (sshpublickeyresourceclient.Interface, error) { //initialize sshpublickeyresourceclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } @@ -1163,7 +1163,7 @@ func (factory *ClientFactoryImpl) GetSSHPublicKeyResourceClient() sshpublickeyre func (factory *ClientFactoryImpl) createSubnetClient(subscription string) (subnetclient.Interface, error) { //initialize subnetclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } @@ -1173,7 +1173,7 @@ func (factory *ClientFactoryImpl) createSubnetClient(subscription string) (subne } //add ratelimit policy - ratelimitOption := factory.facotryConfig.GetRateLimitConfig("subnetsRateLimit") + ratelimitOption := factory.factoryConfig.GetRateLimitConfig("subnetsRateLimit") rateLimitPolicy := ratelimit.NewRateLimitPolicy(ratelimitOption) if rateLimitPolicy != nil { options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) @@ -1192,7 +1192,7 @@ func (factory *ClientFactoryImpl) GetSubnetClient() subnetclient.Interface { func (factory *ClientFactoryImpl) createVaultClient(subscription string) (vaultclient.Interface, error) { //initialize vaultclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } @@ -1211,7 +1211,7 @@ func (factory *ClientFactoryImpl) GetVaultClient() vaultclient.Interface { func (factory *ClientFactoryImpl) createVirtualMachineClient(subscription string) (virtualmachineclient.Interface, error) { //initialize virtualmachineclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } @@ -1221,7 +1221,7 @@ func (factory *ClientFactoryImpl) createVirtualMachineClient(subscription string } //add ratelimit policy - ratelimitOption := factory.facotryConfig.GetRateLimitConfig("virtualMachineRateLimit") + ratelimitOption := factory.factoryConfig.GetRateLimitConfig("virtualMachineRateLimit") rateLimitPolicy := ratelimit.NewRateLimitPolicy(ratelimitOption) if rateLimitPolicy != nil { options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) @@ -1240,7 +1240,7 @@ func (factory *ClientFactoryImpl) GetVirtualMachineClient() virtualmachineclient func (factory *ClientFactoryImpl) createVirtualMachineScaleSetClient(subscription string) (virtualmachinescalesetclient.Interface, error) { //initialize virtualmachinescalesetclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } @@ -1250,7 +1250,7 @@ func (factory *ClientFactoryImpl) createVirtualMachineScaleSetClient(subscriptio } //add ratelimit policy - ratelimitOption := factory.facotryConfig.GetRateLimitConfig("virtualMachineScaleSetRateLimit") + ratelimitOption := factory.factoryConfig.GetRateLimitConfig("virtualMachineScaleSetRateLimit") rateLimitPolicy := ratelimit.NewRateLimitPolicy(ratelimitOption) if rateLimitPolicy != nil { options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy) @@ -1269,7 +1269,7 @@ func (factory *ClientFactoryImpl) GetVirtualMachineScaleSetClient() virtualmachi func (factory *ClientFactoryImpl) createVirtualMachineScaleSetVMClient(subscription string) (virtualmachinescalesetvmclient.Interface, error) { //initialize virtualmachinescalesetvmclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } @@ -1292,7 +1292,7 @@ func (factory *ClientFactoryImpl) GetVirtualMachineScaleSetVMClient() virtualmac func (factory *ClientFactoryImpl) createVirtualNetworkClient(subscription string) (virtualnetworkclient.Interface, error) { //initialize virtualnetworkclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } @@ -1311,13 +1311,13 @@ func (factory *ClientFactoryImpl) GetVirtualNetworkClient() virtualnetworkclient func (factory *ClientFactoryImpl) createVirtualNetworkLinkClient(subscription string) (virtualnetworklinkclient.Interface, error) { //initialize virtualnetworklinkclient - options, err := GetDefaultResourceClientOption(factory.armConfig, factory.facotryConfig) + options, err := GetDefaultResourceClientOption(factory.armConfig, factory.factoryConfig) if err != nil { return nil, err } //add ratelimit policy - ratelimitOption := factory.facotryConfig.GetRateLimitConfig("virtualNetworkRateLimit") + ratelimitOption := factory.factoryConfig.GetRateLimitConfig("virtualNetworkRateLimit") rateLimitPolicy := ratelimit.NewRateLimitPolicy(ratelimitOption) if rateLimitPolicy != nil { options.ClientOptions.PerCallPolicies = append(options.ClientOptions.PerCallPolicies, rateLimitPolicy)