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 CreateVolume func: use search mode instead #54687

Merged
merged 2 commits into from
Nov 30, 2017

Conversation

andyzhangx
Copy link
Member

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 #52396

Special 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:

fix azure storage account exhausting issue by using azure disk mount

/sig azure

@rootfs @feiskyer @karataliu

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/azure size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Oct 27, 2017
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
Copy link
Contributor

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?

Copy link
Member Author

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.

@rootfs
Copy link
Contributor

rootfs commented Oct 27, 2017

/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
Copy link
Contributor

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.

Copy link
Member Author

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) {
Copy link
Contributor

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

Copy link
Member Author

@andyzhangx andyzhangx Oct 27, 2017

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.

Copy link
Member Author

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})
Copy link
Contributor

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.

See https://github.com/kubernetes/kubernetes/blob/release-1.6.3/pkg/cloudprovider/providers/azure/azure_blob.go#L48

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx, fixed

@andyzhangx
Copy link
Member Author

/test pull-kubernetes-unit

@rootfs
Copy link
Contributor

rootfs commented Nov 13, 2017

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 13, 2017
@andyzhangx
Copy link
Member Author

@brendandburns

@andyzhangx
Copy link
Member Author

ping @brendandburns

@jdumars
Copy link
Member

jdumars commented Nov 15, 2017

/approve no-issue

@jdumars
Copy link
Member

jdumars commented Nov 15, 2017

@gmarek PTAL

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 19, 2017
@k8s-github-robot k8s-github-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Nov 19, 2017
@andyzhangx
Copy link
Member Author

@rootfs there is a rebase, could you take a look, thx

@andyzhangx
Copy link
Member Author

@feiskyer

@jdumars
Copy link
Member

jdumars commented Nov 29, 2017

@enisoc thoughts on this making it into 1.9?

@enisoc
Copy link
Member

enisoc commented Nov 29, 2017

@jdumars Preventing runaway account usage sounds like a qualifying bugfix to me. I'll leave it to you to upgrade to priority/critical-urgent on behalf of sig-azure if you think this is important for 1.9.0 and there are people with bandwidth to push this to completion.

@feiskyer feiskyer added priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. and removed milestone/removed priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels Nov 30, 2017
@feiskyer feiskyer added this to the v1.9 milestone Nov 30, 2017
@feiskyer
Copy link
Member

Added back to 1.9 milestone. @jdumars Could you help to approve the milestone?

@dims
Copy link
Member

dims commented Nov 30, 2017

/assign @sttts
/assign @saad-ali

One of you please approve?

@k8s-github-robot
Copy link

[MILESTONENOTIFIER] Milestone Pull Request Current

@andyzhangx @feiskyer @gmarek @krousey @rootfs @saad-ali @sttts

Note: This pull request is marked as priority/critical-urgent, and must be updated every 1 day during code freeze.

Example update:

ACK.  In progress
ETA: DD/MM/YYYY
Risks: Complicated fix required
Pull Request Labels
  • sig/azure: Pull Request will be escalated to these SIGs if needed.
  • priority/critical-urgent: Never automatically move pull request out of a release milestone; continually escalate to contributor and SIG through all available channels.
  • kind/bug: Fixes a bug discovered during the current release.
Help

@jdumars
Copy link
Member

jdumars commented Nov 30, 2017

/approve

@jdumars
Copy link
Member

jdumars commented Nov 30, 2017

@deads2k or @liggitt could you PTAL and approve if appropriate?

@liggitt
Copy link
Member

liggitt commented Nov 30, 2017

@deads2k or @liggitt could you PTAL and approve if appropriate?

for the test changes, I'd prefer someone familiar with storage take a look. @saad-ali ?

@saad-ali
Copy link
Member

/lgtm
/approve

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 30, 2017
@k8s-github-robot
Copy link

[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 /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here.

@k8s-github-robot k8s-github-robot merged commit 3904cc7 into kubernetes:master Nov 30, 2017
k8s-github-robot pushed a commit that referenced this pull request Dec 20, 2017
…4687-upstream-release-1.8

Automatic merge from submit-queue.

Automated cherry pick of #54687

Cherry pick of #54687 on release-1.8.

#54687: fix CreateVolume: search mode for Dedicated kind
k8s-github-robot pushed a commit that referenced this pull request Mar 2, 2018
…4687-upstream-release-1.7

Automatic merge from submit-queue.

Automated cherry pick of #54687: fix CreateVolume: search mode for Dedicated kind

Cherry pick of #54687 on release-1.7.

#54687: fix CreateVolume: search mode for Dedicated kind
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

azuredisk CreateVolume should search storage account if no account specified