Skip to content

Commit

Permalink
fix: change disk client API version for Azure Stack
Browse files Browse the repository at this point in the history
  • Loading branch information
songjiaxun committed Nov 24, 2020
1 parent ad2bf99 commit ae1e452
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"context"
"fmt"
"net/http"
"strings"
"time"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
Expand Down Expand Up @@ -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 DisksClient (read ops) using rate limit config: QPS=%g, bucket=%d",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ import (
const (
// APIVersion is the API version for compute.
APIVersion = "2019-11-01"
// AzureStackCloudAPIVersion is the API version for Azure Stack
AzureStackCloudAPIVersion = "2019-07-01"
// AzureStackCloudName is the cloud name of Azure Stack
AzureStackCloudName = "AZURESTACKCLOUD"
)

// Interface is the client interface for Disks.
Expand Down

0 comments on commit ae1e452

Please sign in to comment.