Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: no sleep when GetDisk is throttled #629

Merged
merged 1 commit into from
May 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions pkg/provider/azure_managedDiskController.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"path"
"strconv"
"strings"
"time"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-12-01/compute"
"github.com/Azure/go-autorest/autorest/to"
Expand All @@ -38,8 +37,6 @@ import (
"sigs.k8s.io/cloud-provider-azure/pkg/consts"
)

const expectedDiskProvisionSeconds = 3 // seconds

//ManagedDiskController : managed disk controller struct
type ManagedDiskController struct {
common *controllerCommon
Expand Down Expand Up @@ -203,8 +200,7 @@ func (c *ManagedDiskController) CreateManagedDisk(options *ManagedDiskOptions) (
diskID := fmt.Sprintf(managedDiskPath, cloud.subscriptionID, options.ResourceGroup, options.DiskName)

if options.SkipGetDiskOperation {
klog.Warningf("azureDisk - GetDisk(%s, StorageAccountType:%s) is throttled, wait 3s for disk provisioning complete", options.DiskName, options.StorageAccountType)
time.Sleep(expectedDiskProvisionSeconds * time.Second)
klog.Warningf("azureDisk - GetDisk(%s, StorageAccountType:%s) is throttled, unable to confirm provisioningState in poll process", options.DiskName, options.StorageAccountType)
} else {
err = kwait.ExponentialBackoff(defaultBackOff, func() (bool, error) {
provisionState, id, err := c.GetDisk(options.ResourceGroup, options.DiskName)
Expand All @@ -225,8 +221,7 @@ func (c *ManagedDiskController) CreateManagedDisk(options *ManagedDiskOptions) (
})

if err != nil {
klog.Warningf("azureDisk - created new MD Name:%s StorageAccountType:%s Size:%v but was unable to confirm provisioningState in poll process, wait 3s for disk provisioning complete", options.DiskName, options.StorageAccountType, options.SizeGB)
time.Sleep(expectedDiskProvisionSeconds * time.Second)
klog.Warningf("azureDisk - created new MD Name:%s StorageAccountType:%s Size:%v but was unable to confirm provisioningState in poll process", options.DiskName, options.StorageAccountType, options.SizeGB)
}
}

Expand Down