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

apiextensions: fix missing storage on CRD delete without previous CR access #46501

Merged
merged 1 commit into from May 26, 2017

Conversation

sttts
Copy link
Contributor

@sttts sttts commented May 26, 2017

Create CR storage on demand when needed from CRD finalizer controller.

/cc @nikhita

@k8s-ci-robot
Copy link
Contributor

@sttts: GitHub didn't allow me to request PR reviews from the following users: nikhita.

Note that only kubernetes members can review this PR, and authors cannot review their own PRs.

In response to this:

Create CR storage on demand when needed from CRD finalizer controller.

/cc @nikhita

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 26, 2017
@k8s-github-robot k8s-github-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note-label-needed labels May 26, 2017
@sttts sttts added release-note-none Denotes a PR that doesn't merit a release note. and removed release-note-label-needed labels May 26, 2017
}

func (r *crdHandler) getServingInfoFor(crd *apiextensions.CustomResourceDefinition) *crdInfo {
storageMap := r.customStorage.Load().(crdStorageMap)
ret, ok := storageMap[crd.UID]
r.customStorageLock.RLock()
Copy link
Contributor

Choose a reason for hiding this comment

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

@liggitt specifically requested an atomic.Value is several spots with the claim that it's read performance was better than grabbing a non-contentious read lock. I don't know one way or the other, but it was an intentional choice.

handler := handlers.ListResource(storage, storage, requestScope, forceWatch, minRequestTimeout)
handler(w, req)
return
handlers.ListResource(storage, storage, requestScope, false, minRequestTimeout)(w, req)
Copy link
Contributor

Choose a reason for hiding this comment

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

inline comment these at least? , false /*forceWatch*/,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am lucky that my code editor shows the forceWatch automatically.

}
return ret.storage
func (r *crdHandler) GetCustomResourceListerCollectionDeleter(crd *apiextensions.CustomResourceDefinition) finalizer.ListerCollectionDeleter {
info := r.getServingInfoFor(crd)
Copy link
Contributor

Choose a reason for hiding this comment

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

meat lgtm

@sttts sttts force-pushed the sttts-crd-finalizer-sync branch from c03929b to 0984a1a Compare May 26, 2017 12:36
@k8s-github-robot k8s-github-robot removed the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 26, 2017
@sttts sttts force-pushed the sttts-crd-finalizer-sync branch from 0984a1a to 60c4862 Compare May 26, 2017 12:37
@k8s-github-robot k8s-github-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 26, 2017
@sttts
Copy link
Contributor Author

sttts commented May 26, 2017

Will leave the lgtm to @nikhita. If her test works fine with this, please tag it.

@deads2k
Copy link
Contributor

deads2k commented May 26, 2017

Will leave the lgtm to @nikhita. If her test works fine with this, please tag it.

will do. @nikhita bug me on slack for a merge.

@deads2k
Copy link
Contributor

deads2k commented May 26, 2017

@k8s-bot pull-kubernetes-unit test this

@deads2k
Copy link
Contributor

deads2k commented May 26, 2017

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 26, 2017
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deads2k, sttts

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

@deads2k
Copy link
Contributor

deads2k commented May 26, 2017

@k8s-bot pull-kubernetes-e2e-kops-aws test this

@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 46501, 45944, 46473)

@k8s-github-robot k8s-github-robot merged commit 97fd065 into kubernetes:master May 26, 2017
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants