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

remove go-restful from namer for rest handling #43767

Merged
merged 1 commit into from
Apr 10, 2017

Conversation

deads2k
Copy link
Contributor

@deads2k deads2k commented Mar 28, 2017

Our RESTHandler code is currently tightly coupled to go-restful, but there's no reason for this coupling. It makes integrations that want API handling (decode, sanity check, admission, verb handling), but don't need the REST installer flow impractical. I know of two layers now: metrics and TPR.

This starts the process of unwinding by switching the ScopeNamer (used for request identification and selflinks) to use the standard http library along with the RequestInfo we place in the context for authorization and any other interested layer.

@kubernetes/sig-api-machinery-misc @smarterclayton @ncdc @sttts

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Mar 28, 2017
@k8s-github-robot k8s-github-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. release-note-label-needed labels Mar 28, 2017
@k8s-reviewable
Copy link

This change is Reviewable

@deads2k
Copy link
Contributor Author

deads2k commented Mar 28, 2017

@k8s-bot bazel test this

@deads2k
Copy link
Contributor Author

deads2k commented Mar 28, 2017

@k8s-bot non-cri e2e test this

@@ -746,7 +757,7 @@ func TestNotFound(t *testing.T) {
"groupless root DELETE with extra segment": {"DELETE", "/" + grouplessPrefix + "/" + grouplessGroupVersion.Version + "/simpleroots/bar/baz", http.StatusNotFound},
"groupless root PUT without extra segment": {"PUT", "/" + grouplessPrefix + "/" + grouplessGroupVersion.Version + "/simpleroots", http.StatusMethodNotAllowed},
"groupless root PUT with extra segment": {"PUT", "/" + grouplessPrefix + "/" + grouplessGroupVersion.Version + "/simpleroots/bar/baz", http.StatusNotFound},
"groupless root watch missing storage": {"GET", "/" + grouplessPrefix + "/" + grouplessGroupVersion.Version + "/watch/", http.StatusNotFound},
"groupless root watch missing storage": {"GET", "/" + grouplessPrefix + "/" + grouplessGroupVersion.Version + "/watch/", http.StatusInternalServerError},
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do these change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why do these change?

This used to test the cases without the "normal" handler chain. Once you add a requestInfoResolver into the chain, it fails on these URLs because they aren't well formed. The same thing would happen in our real chain.

@@ -1169,6 +1180,7 @@ func TestNonEmptyList(t *testing.T) {
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
t.Log(body)
Copy link
Contributor

Choose a reason for hiding this comment

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

debug output

Copy link
Contributor Author

Choose a reason for hiding this comment

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

debug output

Super useful when the test goes poorly.

objNamespace, objName, err := namer.ObjectName(obj)
if err != nil {
return errors.NewBadRequest(fmt.Sprintf(
"the name of the object (%s based on URL) was undeterminable %v", name, err))
Copy link
Contributor

Choose a reason for hiding this comment

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

undeterminable: %v

@deads2k
Copy link
Contributor Author

deads2k commented Apr 10, 2017

Nit updated. Other comments?

@sttts
Copy link
Contributor

sttts commented Apr 10, 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 Apr 10, 2017
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: deads2k, sttts
We suggest the following additional approver: @lavalamp

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 k8s-github-robot added the do-not-merge DEPRECATED. Indicates that a PR should not merge. Label can only be manually applied/removed. label Apr 10, 2017
@deads2k deads2k added approved Indicates a PR has been approved by an approver from all required OWNERS files. release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge DEPRECATED. Indicates that a PR should not merge. Label can only be manually applied/removed. release-note-label-needed labels Apr 10, 2017
@deads2k
Copy link
Contributor Author

deads2k commented Apr 10, 2017

vendor/build again. marking

@deads2k
Copy link
Contributor Author

deads2k commented Apr 10, 2017

@k8s-bot test this

@deads2k deads2k mentioned this pull request Apr 10, 2017
@eparis
Copy link
Contributor

eparis commented Apr 10, 2017

bot can be up to 10 minutes behind, but I'm betting this is more than 10 minutes...

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit f505202 into kubernetes:master Apr 10, 2017
k8s-github-robot pushed a commit that referenced this pull request Apr 10, 2017
Automatic merge from submit-queue (batch tested with PRs 43273, 44287, 44281)

Remove ObjectMetaFor

Builds on #43767

The second commit removes `ObjectMetaFor`.  This was debt we left around after we created the interfaces.  Fixing this makes it possible to start running `Unstructured` through generic storage.

@kubernetes/sig-api-machinery-pr-reviews @smarterclayton @lavalamp
@deads2k deads2k deleted the server-13-namer branch August 3, 2017 20:07
akhilerm pushed a commit to akhilerm/apimachinery that referenced this pull request Sep 20, 2022
Automatic merge from submit-queue (batch tested with PRs 43273, 44287, 44281)

Remove ObjectMetaFor

Builds on kubernetes/kubernetes#43767

The second commit removes `ObjectMetaFor`.  This was debt we left around after we created the interfaces.  Fixing this makes it possible to start running `Unstructured` through generic storage.

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

Kubernetes-commit: d4eaf0b6801900d2b2f80036e267a1d3d86fd3a8
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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants