mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-08 03:33:56 +00:00
fix: change storage account client API version for Azure Stack
This commit is contained in:
parent
2343b8a68b
commit
09112ed1f4
@ -73,7 +73,9 @@ import (
|
||||
|
||||
const (
|
||||
// CloudProviderName is the value used for the --cloud-provider flag
|
||||
CloudProviderName = "azure"
|
||||
CloudProviderName = "azure"
|
||||
// AzureStackCloudName is the cloud name of Azure Stack
|
||||
AzureStackCloudName = "AZURESTACKCLOUD"
|
||||
rateLimitQPSDefault = 1.0
|
||||
rateLimitBucketDefault = 5
|
||||
backoffRetriesDefault = 6
|
||||
@ -609,6 +611,7 @@ func (az *Cloud) configAzureClients(
|
||||
|
||||
func (az *Cloud) getAzureClientConfig(servicePrincipalToken *adal.ServicePrincipalToken) *azclients.ClientConfig {
|
||||
azClientConfig := &azclients.ClientConfig{
|
||||
CloudName: az.Config.Cloud,
|
||||
Location: az.Config.Location,
|
||||
SubscriptionID: az.Config.SubscriptionID,
|
||||
ResourceManagerEndpoint: az.Environment.ResourceManagerEndpoint,
|
||||
|
@ -141,7 +141,7 @@ func (as *availabilitySet) DetachDisk(diskName, diskURI string, nodeName types.N
|
||||
(disk.ManagedDisk != nil && diskURI != "" && strings.EqualFold(*disk.ManagedDisk.ID, diskURI)) {
|
||||
// found the disk
|
||||
klog.V(2).Infof("azureDisk - detach disk: name %q uri %q", diskName, diskURI)
|
||||
if strings.EqualFold(as.cloud.Environment.Name, "AZURESTACKCLOUD") {
|
||||
if strings.EqualFold(as.cloud.Environment.Name, AzureStackCloudName) {
|
||||
disks = append(disks[:i], disks[i+1:]...)
|
||||
} else {
|
||||
disks[i].ToBeDetached = to.BoolPtr(true)
|
||||
|
@ -143,7 +143,7 @@ func (ss *scaleSet) DetachDisk(diskName, diskURI string, nodeName types.NodeName
|
||||
(disk.ManagedDisk != nil && diskURI != "" && strings.EqualFold(*disk.ManagedDisk.ID, diskURI)) {
|
||||
// found the disk
|
||||
klog.V(2).Infof("azureDisk - detach disk: name %q uri %q", diskName, diskURI)
|
||||
if strings.EqualFold(ss.cloud.Environment.Name, "AZURESTACKCLOUD") {
|
||||
if strings.EqualFold(ss.cloud.Environment.Name, AzureStackCloudName) {
|
||||
disks = append(disks[:i], disks[i+1:]...)
|
||||
} else {
|
||||
disks[i].ToBeDetached = to.BoolPtr(true)
|
||||
|
@ -26,6 +26,7 @@ import (
|
||||
|
||||
// ClientConfig contains all essential information to create an Azure client.
|
||||
type ClientConfig struct {
|
||||
CloudName string
|
||||
Location string
|
||||
SubscriptionID string
|
||||
ResourceManagerEndpoint string
|
||||
|
@ -22,6 +22,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-06-01/storage"
|
||||
@ -57,7 +58,11 @@ type Client struct {
|
||||
func New(config *azclients.ClientConfig) *Client {
|
||||
baseURI := config.ResourceManagerEndpoint
|
||||
authorizer := config.Authorizer
|
||||
armClient := armclient.New(authorizer, baseURI, config.UserAgent, APIVersion, config.Location, config.Backoff)
|
||||
apiVersion := APIVersion
|
||||
if strings.EqualFold(config.CloudName, AzureStackCloudName) {
|
||||
apiVersion = AzureStackCloudAPIVersion
|
||||
}
|
||||
armClient := armclient.New(authorizer, baseURI, config.UserAgent, apiVersion, config.Location, config.Backoff)
|
||||
rateLimiterReader, rateLimiterWriter := azclients.NewRateLimiter(config.RateLimitConfig)
|
||||
|
||||
klog.V(2).Infof("Azure StorageAccountClient (read ops) using rate limit config: QPS=%g, bucket=%d",
|
||||
|
@ -28,6 +28,10 @@ import (
|
||||
const (
|
||||
// APIVersion is the API version for network.
|
||||
APIVersion = "2019-06-01"
|
||||
// AzureStackCloudAPIVersion is the API version for Azure Stack
|
||||
AzureStackCloudAPIVersion = "2018-02-01"
|
||||
// AzureStackCloudName is the cloud name of Azure Stack
|
||||
AzureStackCloudName = "AZURESTACKCLOUD"
|
||||
)
|
||||
|
||||
// Interface is the client interface for StorageAccounts.
|
||||
|
Loading…
Reference in New Issue
Block a user