-
Notifications
You must be signed in to change notification settings - Fork 40.1k
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 CreateVolume func: use search mode instead #54687
fix CreateVolume func: use search mode instead #54687
Conversation
if err != nil { | ||
return "", "", 0, fmt.Errorf("no key found for storage account %s even after creating a new storage account", storageAccount) | ||
// TODO: create a storage account and container |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be fixed now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I would like to fix it in a new PR.
/approve |
@@ -79,52 +79,55 @@ func newBlobDiskController(common *controllerCommon) (*BlobDiskController, error | |||
return &c, nil | |||
} | |||
|
|||
// CreateVolume creates a VHD blob in a given storage account, will create the given storage account if it does not exist in current resource group |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cannot comment on line 64, but it is a mess there. use a var block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
} | ||
for _, account := range accounts { | ||
glog.V(4).Infof("account %s type %s location %s", account.Name, account.StorageType, account.Location) | ||
if (storageAccountType == "" || account.StorageType == storageAccountType) && (location == "" || account.Location == location) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missed len(storageAccount) > 0. This happens when a storage account is specified and we want to use it.
see https://github.com/kubernetes/kubernetes/blob/release-1.6.3/pkg/cloudprovider/providers/azure/azure_storage.go#L208
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rootfs I know, but it's quite tricky, what if user specified storageAccount
does not equal to storageAccountType
and location
? Add len(storageAccount) > 0
means we don't care about the mismatch of storageAccountType
, location
; while if there is no len(storageAccount) > 0
means we would also do the match.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
return "", "", 0, err | ||
} | ||
container := blobClient.GetContainerReference(vhdContainerName) | ||
_, err = container.CreateIfNotExists(&azstorage.CreateContainerOptions{Access: azstorage.ContainerAccessTypePrivate}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wastes an api call. In most cases containers do exist. Create it only if you get an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thx, fixed
f78ebbd
to
2008ef3
Compare
/test pull-kubernetes-unit |
/approve |
ping @brendandburns |
/approve no-issue |
@gmarek PTAL |
2008ef3
to
760cc6f
Compare
@rootfs there is a rebase, could you take a look, thx |
@enisoc thoughts on this making it into 1.9? |
@jdumars Preventing runaway account usage sounds like a qualifying bugfix to me. I'll leave it to you to upgrade to |
Added back to 1.9 milestone. @jdumars Could you help to approve the milestone? |
[MILESTONENOTIFIER] Milestone Pull Request Current @andyzhangx @feiskyer @gmarek @krousey @rootfs @saad-ali @sttts Note: This pull request is marked as Example update:
Pull Request Labels
|
/approve |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: andyzhangx, feiskyer, jdumars, rootfs, saad-ali Associated issue: 52396 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
/test all [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here. |
What this PR does / why we need it:
This is a little fall back for CreateVolume func: use search mode for Dedicated kind as @rootfs suggested.
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #52396Special notes for your reviewer:
I reference the implmentation of v1.6 in the same CreateVolume func
https://github.com/kubernetes/kubernetes/blob/release-1.6/pkg/cloudprovider/providers/azure/azure_storage.go#L213-L247
Release note:
/sig azure
@rootfs @feiskyer @karataliu