Skip to content

Commit c1f36fa

Browse files
authored
Merge pull request kubernetes#96829 from songjiaxun/azuredisk_api_version
fix: change disk client API version for Azure Stack
2 parents c678434 + ae1e452 commit c1f36fa

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

staging/src/k8s.io/legacy-cloud-providers/azure/clients/diskclient/azure_diskclient.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"context"
2323
"fmt"
2424
"net/http"
25+
"strings"
2526
"time"
2627

2728
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
@@ -57,7 +58,11 @@ type Client struct {
5758
func New(config *azclients.ClientConfig) *Client {
5859
baseURI := config.ResourceManagerEndpoint
5960
authorizer := config.Authorizer
60-
armClient := armclient.New(authorizer, baseURI, config.UserAgent, APIVersion, config.Location, config.Backoff)
61+
apiVersion := APIVersion
62+
if strings.EqualFold(config.CloudName, AzureStackCloudName) {
63+
apiVersion = AzureStackCloudAPIVersion
64+
}
65+
armClient := armclient.New(authorizer, baseURI, config.UserAgent, apiVersion, config.Location, config.Backoff)
6166
rateLimiterReader, rateLimiterWriter := azclients.NewRateLimiter(config.RateLimitConfig)
6267

6368
klog.V(2).Infof("Azure DisksClient (read ops) using rate limit config: QPS=%g, bucket=%d",

staging/src/k8s.io/legacy-cloud-providers/azure/clients/diskclient/interface.go

+4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ import (
2828
const (
2929
// APIVersion is the API version for compute.
3030
APIVersion = "2019-11-01"
31+
// AzureStackCloudAPIVersion is the API version for Azure Stack
32+
AzureStackCloudAPIVersion = "2019-07-01"
33+
// AzureStackCloudName is the cloud name of Azure Stack
34+
AzureStackCloudName = "AZURESTACKCLOUD"
3135
)
3236

3337
// Interface is the client interface for Disks.

0 commit comments

Comments
 (0)