diff --git a/go.mod b/go.mod index c7afe7197f..cd78583d67 100644 --- a/go.mod +++ b/go.mod @@ -51,7 +51,7 @@ require ( k8s.io/klog/v2 v2.130.1 k8s.io/kubelet v0.30.8 k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 - sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.4.7 + sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.4.9 sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.3.3 sigs.k8s.io/yaml v1.4.0 ) diff --git a/go.sum b/go.sum index ed46e92766..c1118bbe0a 100644 --- a/go.sum +++ b/go.sum @@ -457,8 +457,8 @@ k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6J k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.29.0 h1:/U5vjBbQn3RChhv7P11uhYvCSm5G2GaIi5AIGBS6r4c= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.29.0/go.mod h1:z7+wmGM2dfIiLRfrC6jb5kV2Mq/sK1ZP303cxzkV5Y4= -sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.4.7 h1:zfCOEG5k+qjiOuZ9nE6sWZQJY72a0K89yqOJW6KNKG4= -sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.4.7/go.mod h1:Q4h31XGg2sNnaJiYTC8xkq2XyUhDIL1MmPwWBB5hm7w= +sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.4.9 h1:Crt7bK0CWVWYP75Xe/j81ys/KhBjV7ZP/PxiZmiUp7M= +sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.4.9/go.mod h1:Q4h31XGg2sNnaJiYTC8xkq2XyUhDIL1MmPwWBB5hm7w= sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.3.3 h1:92r8bEaZE3HHSs+6HslPKqKADpKVF62j6fsWp+Bi7rA= sigs.k8s.io/cloud-provider-azure/pkg/azclient/configloader v0.3.3/go.mod h1:BdXjlKIo92I3OEwYx+N8XdMYStdNrzN7L7I6EcSfJto= sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 h1:/Rv+M11QRah1itp8VhT6HoVx1Ray9eB4DBr+K+/sCJ8= diff --git a/vendor/modules.txt b/vendor/modules.txt index b2c617239a..cf6fa7f670 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1512,7 +1512,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.4.7 +# sigs.k8s.io/cloud-provider-azure/pkg/azclient v0.4.9 ## explicit; go 1.23.1 sigs.k8s.io/cloud-provider-azure/pkg/azclient sigs.k8s.io/cloud-provider-azure/pkg/azclient/accountclient 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 5e66aed796..e610ff5354 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"` + // DisableAzureStackCloud disables AzureStackCloud support. It should be used + // when setting AzureAuthConfig.Cloud with "AZURESTACKCLOUD" to customize ARM endpoints + // while the cluster is not running on AzureStack. + DisableAzureStackCloud bool `json:"disableAzureStackCloud,omitempty" yaml:"disableAzureStackCloud,omitempty"` } func (config *ARMClientConfig) GetTenantID() string { 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 f8586ea53b..a7f508e924 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 @@ -354,7 +354,7 @@ func (factory *ClientFactoryImpl) createAccountClient(subscription string) (acco } options.Cloud = factory.cloudConfig - if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) { + if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) && !factory.armConfig.DisableAzureStackCloud { options.ClientOptions.APIVersion = accountclient.AzureStackCloudAPIVersion } @@ -401,7 +401,7 @@ func (factory *ClientFactoryImpl) createAvailabilitySetClient(subscription strin } options.Cloud = factory.cloudConfig - if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) { + if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) && !factory.armConfig.DisableAzureStackCloud { options.ClientOptions.APIVersion = availabilitysetclient.AzureStackCloudAPIVersion } @@ -457,7 +457,7 @@ func (factory *ClientFactoryImpl) createBlobContainerClient(subscription string) } options.Cloud = factory.cloudConfig - if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) { + if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) && !factory.armConfig.DisableAzureStackCloud { options.ClientOptions.APIVersion = blobcontainerclient.AzureStackCloudAPIVersion } @@ -498,7 +498,7 @@ func (factory *ClientFactoryImpl) createBlobServicePropertiesClient(subscription } options.Cloud = factory.cloudConfig - if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) { + if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) && !factory.armConfig.DisableAzureStackCloud { options.ClientOptions.APIVersion = blobservicepropertiesclient.AzureStackCloudAPIVersion } @@ -565,7 +565,7 @@ func (factory *ClientFactoryImpl) createDiskClient(subscription string) (diskcli } options.Cloud = factory.cloudConfig - if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) { + if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) && !factory.armConfig.DisableAzureStackCloud { options.ClientOptions.APIVersion = diskclient.AzureStackCloudAPIVersion } @@ -706,7 +706,7 @@ func (factory *ClientFactoryImpl) createInterfaceClient(subscription string) (in } options.Cloud = factory.cloudConfig - if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) { + if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) && !factory.armConfig.DisableAzureStackCloud { options.ClientOptions.APIVersion = interfaceclient.AzureStackCloudAPIVersion } @@ -762,7 +762,7 @@ func (factory *ClientFactoryImpl) createLoadBalancerClient(subscription string) } options.Cloud = factory.cloudConfig - if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) { + if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) && !factory.armConfig.DisableAzureStackCloud { options.ClientOptions.APIVersion = loadbalancerclient.AzureStackCloudAPIVersion } @@ -864,7 +864,7 @@ func (factory *ClientFactoryImpl) createPrivateLinkServiceClient(subscription st } options.Cloud = factory.cloudConfig - if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) { + if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) && !factory.armConfig.DisableAzureStackCloud { options.ClientOptions.APIVersion = privatelinkserviceclient.AzureStackCloudAPIVersion } @@ -894,7 +894,7 @@ func (factory *ClientFactoryImpl) createPrivateZoneClient(subscription string) ( } options.Cloud = factory.cloudConfig - if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) { + if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) && !factory.armConfig.DisableAzureStackCloud { options.ClientOptions.APIVersion = privatezoneclient.AzureStackCloudAPIVersion } @@ -944,7 +944,7 @@ func (factory *ClientFactoryImpl) createPublicIPAddressClient(subscription strin } options.Cloud = factory.cloudConfig - if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) { + if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) && !factory.armConfig.DisableAzureStackCloud { options.ClientOptions.APIVersion = publicipaddressclient.AzureStackCloudAPIVersion } @@ -1054,7 +1054,7 @@ func (factory *ClientFactoryImpl) createRouteTableClient(subscription string) (r } options.Cloud = factory.cloudConfig - if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) { + if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) && !factory.armConfig.DisableAzureStackCloud { options.ClientOptions.APIVersion = routetableclient.AzureStackCloudAPIVersion } @@ -1104,7 +1104,7 @@ func (factory *ClientFactoryImpl) createSecurityGroupClient(subscription string) } options.Cloud = factory.cloudConfig - if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) { + if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) && !factory.armConfig.DisableAzureStackCloud { options.ClientOptions.APIVersion = securitygroupclient.AzureStackCloudAPIVersion } @@ -1134,7 +1134,7 @@ func (factory *ClientFactoryImpl) createSnapshotClient(subscription string) (sna } options.Cloud = factory.cloudConfig - if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) { + if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) && !factory.armConfig.DisableAzureStackCloud { options.ClientOptions.APIVersion = snapshotclient.AzureStackCloudAPIVersion } @@ -1201,7 +1201,7 @@ func (factory *ClientFactoryImpl) createSubnetClient(subscription string) (subne } options.Cloud = factory.cloudConfig - if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) { + if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) && !factory.armConfig.DisableAzureStackCloud { options.ClientOptions.APIVersion = subnetclient.AzureStackCloudAPIVersion } @@ -1251,7 +1251,7 @@ func (factory *ClientFactoryImpl) createVirtualMachineClient(subscription string } options.Cloud = factory.cloudConfig - if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) { + if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) && !factory.armConfig.DisableAzureStackCloud { options.ClientOptions.APIVersion = virtualmachineclient.AzureStackCloudAPIVersion } @@ -1281,7 +1281,7 @@ func (factory *ClientFactoryImpl) createVirtualMachineScaleSetClient(subscriptio } options.Cloud = factory.cloudConfig - if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) { + if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) && !factory.armConfig.DisableAzureStackCloud { options.ClientOptions.APIVersion = virtualmachinescalesetclient.AzureStackCloudAPIVersion } @@ -1311,7 +1311,7 @@ func (factory *ClientFactoryImpl) createVirtualMachineScaleSetVMClient(subscript } options.Cloud = factory.cloudConfig - if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) { + if factory.armConfig != nil && strings.EqualFold(factory.armConfig.Cloud, utils.AzureStackCloudName) && !factory.armConfig.DisableAzureStackCloud { options.ClientOptions.APIVersion = virtualmachinescalesetvmclient.AzureStackCloudAPIVersion } diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/custom.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/custom.go index 8ce6bb2667..b001802f98 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/custom.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/custom.go @@ -69,3 +69,19 @@ func (client *Client) List(ctx context.Context, resourceGroupName string, accoun } return result, nil } + +const GetOperationName = "FileSharesClient.Get" + +// Get gets the FileShare +func (client *Client) Get(ctx context.Context, resourceGroupName string, accountName string, fileshareName string, option *armstorage.FileSharesClientGetOptions) (result *armstorage.FileShare, err error) { + metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "FileShare", "get") + defer func() { metricsCtx.Observe(ctx, err) }() + ctx, endSpan := runtime.StartSpan(ctx, GetOperationName, client.tracer, nil) + defer endSpan(err) + resp, err := client.FileSharesClient.Get(ctx, resourceGroupName, accountName, fileshareName, option) + if err != nil { + return nil, err + } + //handle statuscode + return &resp.FileShare, nil +} diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/interface.go index adb559cdbf..b9404aff1d 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/interface.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/interface.go @@ -21,13 +21,11 @@ import ( "context" armstorage "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" - - "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" ) -// +azure:client:verbs=get,resource=Account,subResource=FileShare,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage,packageAlias=armstorage,clientName=FileSharesClient,expand=true,crossSubFactory=true +// +azure:client:resource=Account,subResource=FileShare,packageName=github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage,packageAlias=armstorage,clientName=FileSharesClient,expand=true,crossSubFactory=true type Interface interface { - utils.SubResourceGetWithExpandFunc[armstorage.FileShare] + Get(ctx context.Context, resourceGroupName string, accountName string, resourceName string, option *armstorage.FileSharesClientGetOptions) (result *armstorage.FileShare, rerr error) List(ctx context.Context, resourceGroupName string, accountName string, option *armstorage.FileSharesClientListOptions) (result []*armstorage.FileShareItem, err error) Create(ctx context.Context, resourceGroupName string, resourceName string, parentResourceName string, resource armstorage.FileShare, expand *string) (*armstorage.FileShare, error) Update(ctx context.Context, resourceGroupName string, resourceName string, parentResourceName string, resource armstorage.FileShare) (*armstorage.FileShare, error) diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/mock_fileshareclient/interface.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/mock_fileshareclient/interface.go index 0f800c0402..9edb24eb80 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/mock_fileshareclient/interface.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/mock_fileshareclient/interface.go @@ -138,18 +138,18 @@ func (c *MockInterfaceDeleteCall) DoAndReturn(f func(context.Context, string, st } // Get mocks base method. -func (m *MockInterface) Get(ctx context.Context, resourceGroupName, parentResourceName, resourceName string, expand *string) (*armstorage.FileShare, error) { +func (m *MockInterface) Get(ctx context.Context, resourceGroupName, accountName, resourceName string, option *armstorage.FileSharesClientGetOptions) (*armstorage.FileShare, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Get", ctx, resourceGroupName, parentResourceName, resourceName, expand) + ret := m.ctrl.Call(m, "Get", ctx, resourceGroupName, accountName, resourceName, option) ret0, _ := ret[0].(*armstorage.FileShare) ret1, _ := ret[1].(error) return ret0, ret1 } // Get indicates an expected call of Get. -func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, parentResourceName, resourceName, expand any) *MockInterfaceGetCall { +func (mr *MockInterfaceMockRecorder) Get(ctx, resourceGroupName, accountName, resourceName, option any) *MockInterfaceGetCall { mr.mock.ctrl.T.Helper() - call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, parentResourceName, resourceName, expand) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockInterface)(nil).Get), ctx, resourceGroupName, accountName, resourceName, option) return &MockInterfaceGetCall{Call: call} } @@ -165,13 +165,13 @@ func (c *MockInterfaceGetCall) Return(result *armstorage.FileShare, rerr error) } // Do rewrite *gomock.Call.Do -func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string, string, *string) (*armstorage.FileShare, error)) *MockInterfaceGetCall { +func (c *MockInterfaceGetCall) Do(f func(context.Context, string, string, string, *armstorage.FileSharesClientGetOptions) (*armstorage.FileShare, error)) *MockInterfaceGetCall { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string, string, *string) (*armstorage.FileShare, error)) *MockInterfaceGetCall { +func (c *MockInterfaceGetCall) DoAndReturn(f func(context.Context, string, string, string, *armstorage.FileSharesClientGetOptions) (*armstorage.FileShare, error)) *MockInterfaceGetCall { c.Call = c.Call.DoAndReturn(f) return c } diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/zz_generated_client.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/zz_generated_client.go index cea9850c61..926c08ce79 100644 --- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/zz_generated_client.go +++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/azclient/fileshareclient/zz_generated_client.go @@ -18,15 +18,11 @@ package fileshareclient import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/tracing" armstorage "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" - "sigs.k8s.io/cloud-provider-azure/pkg/azclient/metrics" "sigs.k8s.io/cloud-provider-azure/pkg/azclient/utils" ) @@ -52,23 +48,3 @@ func New(subscriptionID string, credential azcore.TokenCredential, options *arm. tracer: tr, }, nil } - -const GetOperationName = "FileSharesClient.Get" - -// Get gets the FileShare -func (client *Client) Get(ctx context.Context, resourceGroupName string, accountName string, fileshareName string, expand *string) (result *armstorage.FileShare, err error) { - var ops *armstorage.FileSharesClientGetOptions - if expand != nil { - ops = &armstorage.FileSharesClientGetOptions{Expand: expand} - } - metricsCtx := metrics.BeginARMRequest(client.subscriptionID, resourceGroupName, "FileShare", "get") - defer func() { metricsCtx.Observe(ctx, err) }() - ctx, endSpan := runtime.StartSpan(ctx, GetOperationName, client.tracer, nil) - defer endSpan(err) - resp, err := client.FileSharesClient.Get(ctx, resourceGroupName, accountName, fileshareName, ops) - if err != nil { - return nil, err - } - //handle statuscode - return &resp.FileShare, nil -}