Skip to content

remove rootscopedkinds from groupmeta#63309

Merged
k8s-github-robot merged 1 commit intokubernetes:masterfrom
deads2k:server-13-rootscopedkind
May 1, 2018
Merged

remove rootscopedkinds from groupmeta#63309
k8s-github-robot merged 1 commit intokubernetes:masterfrom
deads2k:server-13-rootscopedkind

Conversation

@deads2k
Copy link
Copy Markdown
Contributor

@deads2k deads2k commented Apr 30, 2018

builds on #63206

Since, a RESTMapping can only be determined based on a connection to a server, the only thing that needs to know the namespaced-ness of a resource is the code doing the registration. Everything else is derived from that source of truth. This removes the other dangling references and collapses down onto the existing namespaced-ness methods in the strategies backing the stores.

@kubernetes/sig-api-machinery-pr-reviews

NONE

@k8s-ci-robot k8s-ci-robot added sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Apr 30, 2018
@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Apr 30, 2018
@deads2k deads2k force-pushed the server-13-rootscopedkind branch from 9787ce9 to cf3dc39 Compare April 30, 2018 18:31
@dims
Copy link
Copy Markdown
Member

dims commented Apr 30, 2018

/uncc @dims

@k8s-ci-robot k8s-ci-robot removed the request for review from dims April 30, 2018 18:53
@roycaihw
Copy link
Copy Markdown
Member

/cc @wenjiaswe @yliaog

@k8s-ci-robot k8s-ci-robot requested a review from yliaog April 30, 2018 20:10
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

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

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

Details

In response to this:

/cc @wenjiaswe @yliaog

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

defaulting is dangerous... we should require the storage to implement this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

defaulting is dangerous... we should require the storage to implement this.

I will point out that you'll notice very quickly. Now that I found parents, this may not be so bad. I double check.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If you do not specify it, you are assumed to be namespace scoped.

that's a dangerous default, and we shouldn't assume either way

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is going to drift and get weird quick...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this is going to drift and get weird quick...

It's for tests. Those tests should really be using a very tight version of this. They won't be affected by changes to the actual objects. This isn't used to make contact to a real server.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same comment on defaulting

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

is the subresource storage required to implement this any more?

@liggitt
Copy link
Copy Markdown
Member

liggitt commented May 1, 2018

I am strongly in favor of having this info provided in exactly one place for a resource, and the REST handler is the logical owner of this information (having it both in type registration and in the REST handler has already led to mismatches (xref #50945, #53030).

I would strengthen the requirement for the storage to provide this info rather than assuming it is namespaced

@deads2k deads2k force-pushed the server-13-rootscopedkind branch from cf3dc39 to b3b4f58 Compare May 1, 2018 15:25
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels May 1, 2018
@deads2k
Copy link
Copy Markdown
Contributor Author

deads2k commented May 1, 2018

Rebased. No defaulting. Added TODO about removing static restmapper usage.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

remove comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

update comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

update comment to "namespace scoping is defined by the parent resource"?

@liggitt
Copy link
Copy Markdown
Member

liggitt commented May 1, 2018

some doc nits, a couple unit test failures, lgtm otherwise

@deads2k deads2k force-pushed the server-13-rootscopedkind branch from b3b4f58 to a63086e Compare May 1, 2018 16:49
@liggitt
Copy link
Copy Markdown
Member

liggitt commented May 1, 2018

/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 1, 2018
@deads2k deads2k added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 1, 2018
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

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

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deads2k deads2k force-pushed the server-13-rootscopedkind branch from a63086e to 8ae6251 Compare May 1, 2018 17:08
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

New changes are detected. LGTM label has been removed.

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 1, 2018
@deads2k deads2k added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 1, 2018
Copy link
Copy Markdown
Member

@enj enj left a comment

Choose a reason for hiding this comment

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

+1 for the change overall, definitely prefer the stores handling this.

return e.UpdateStrategy.NamespaceScoped()
}

panic("programmer error: no CRUD for resource, you're crazy, override NamespaceScoped too")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Haha

// It is usually provided automatically based on your strategy.
type Scoper interface {
// NamespaceScoped returns true if the storage is namespaced
NamespaceScoped() bool
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems like this just needs to be part of type Storage interface { above? It is required in all cases from what I can tell so why not make it a compile time check?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Seems like this just needs to be part of type Storage interface { above? It is required in all cases from what I can tell so why not make it a compile time check?

No. Subresource storage doesn't have it.

@deads2k
Copy link
Copy Markdown
Contributor Author

deads2k commented May 1, 2018

/retest

1 similar comment
@liggitt
Copy link
Copy Markdown
Member

liggitt commented May 1, 2018

/retest

@k8s-github-robot
Copy link
Copy Markdown

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

@k8s-github-robot
Copy link
Copy Markdown

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 dc7f074 into kubernetes:master May 1, 2018
@deads2k deads2k deleted the server-13-rootscopedkind branch July 3, 2018 18:04
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. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. 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.

7 participants