-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Disable v1beta3 in REST API #4992
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
Conversation
|
[test] |
|
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin/5922/) |
92a4cc5 to
9d11e61
Compare
|
jenkins issue re[test] |
9d11e61 to
ab4f481
Compare
|
@liggitt or @deads2k, if either of you could pull my branch and reproduce this ( Even though it appears the correct version (v1) was negotiated (verified through some debugging... I think), the v1beta3 data isn't getting converted on the way out (according to the server log, at least.) |
|
The wrong codec is being used here https://github.com/openshift/origin/blob/master/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/resource/helper.go#L120 and here https://github.com/openshift/origin/blob/master/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/cmd/create.go#L109 . You need to be encoding using the codec of the RESTClient. I'm not sure where else you'll hit this. |
338ca69 to
fb45a31
Compare
|
We've found that the origin client factory is using a private client cache which doesn't negotiate versions with the server (upstream clients use https://github.com/openshift/origin/blob/master/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubectl/cmd/util/clientcache.go). This causes things like the client using the version specified in resource JSON for encoding. |
|
@smarterclayton @deads2k what's the way out, here? Porting the negotiation logic downstream? |
Is it not re-useable as is if we called into it? |
fb45a31 to
20a9933
Compare
|
I pushed my WIP branch to get feedback on what more we can do here in the immediately future. Things I've done:
It's not entirely clear to me what the correct behavior is supposed to be here. Should the negotiated version from the server be used for all encoding/decoding? If not, when should the client be based on the mapping vs. the server? I'm learning every part of this as I go and there seem to be many rabbit holes at every step. |
|
v1beta3 should not show up in the list of potential service targets. That may mean that the code that initializes the rest mapper that is passed to all the CLI commands needs to exclude v1beta3 |
Decoding should try every codec available, so decoding is based on every api-version the client has available. Encoding for transport to the server has to match the level negotiated with the server. Encoding request the by the user for client-side output should match the user's request, so again, any codec available. |
|
The codec selected by the client restmapper should be based primarily on On Oct 13, 2015, at 7:50 AM, David Eads notifications@github.com wrote: It's not entirely clear to me what the correct behavior is supposed to be Decoding should try every codec available, so decoding is based on every — |
20a9933 to
38aae1a
Compare
|
I updated the client factory so that the restmapper gets its output version from a clientConfig obtained from the clientCache (which now negotiates). The fact that we still have to expose |
|
Tests pass, but my confidence level is extremely low, especially re: #4992 (comment). @smarterclayton @deads2k |
|
I haven't implemented any sort of redirect for /osapi. I need some guidance. |
a1de5d1 to
2cc2397
Compare
|
I'm not splitting the upstream stuff into a separate commit until all the work is vetted. |
|
You don't need GetCodec - you need the RESTMapper to target based on a On Tue, Oct 13, 2015 at 1:21 PM, Dan Mace notifications@github.com wrote:
|
Hm, looks like you're right. Setting up the mapper in the factory to use the new negotiated client from the cache seems to have corrected the codec assigned to the mapper, rendering the GetCodec stuff redundant. That's good... |
677e6a7 to
5377390
Compare
|
@smarterclayton @liggitt @deads2k From IRC:
In the interest of time, I think you guys should hash out the requirement so I can implement. |
|
the only two uses I know of for pinging /osapi were 1) version negotiation for (very?) old clients, and 2) login connectivity check from old clients. both of those should be satisfied by returning an empty list if v1beta3 is disabled, rather than a 404 |
|
I modified {"versions": []} |
|
I think all feedback's addressed except for one possible test for |
|
Just remembered, need to exclude dead versions in the version/kind map generated for the UI at I could live with a follow up issue for that, worst case the UI would try to submit a resource and get a 404 error |
pkg/cmd/util/clientcmd/factory.go
Outdated
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.
We need a test in place to make sure this continues to check against origin prefix. Unit test against an httptest server that verifies only /oapi is requested. Upstream version negotiation resets the prefix in several places. Want to make sure we catch it if a prefix reset creeps into this path
|
lgtm, with follow up issues for:
Fine with me to squash |
2a03ad2 to
68ff261
Compare
|
@liggitt squashed, and filtered dead versions here: https://github.com/ironcladlou/origin/blob/remove-v1beta3/pkg/cmd/server/origin/asset.go#L170 I didn't see an existing test for that, PTAL. |
pkg/cmd/server/origin/asset.go
Outdated
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.
need to filter version per-kind... our dead levels and k8s' might not be identical
deadOriginVersions := sets.NewString(configapi.DeadOpenShiftAPILevels...)
deadKubernetesVersions := sets.NewString(configapi.DeadKubernetesAPILevels...)
...
if latest.OriginKind(kind, version) {
if !deadOriginVersions.Has(version) {
originResources.Insert(resource)
}
} else {
if !deadKubernetesVersions.Has(version) {
k8sResources.Insert(resource)
}
}
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.
also remove MasterLegacyPrefix from WebConsoleConfig and this line from the config template:
"v1beta3": "{{ .MasterLegacyPrefix | js}}",
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.
Reimplemented, thanks
6a0e777 to
2d1909c
Compare
|
actually, hold on a sec... I'm not seeing negotiation happen against /oapi This is what happens when I use kube resources: When I use origin resources: |
|
Added debugging output here and got very weird results, although it does seem to verify that we're negotiating correctly: I'm not sure why only the response of the negotiation for origin resources is getting logged... also not 100% clear I understand how there are two passes through the negotiation in both cases. Clearly some more debugging is required there to fully understand. |
pkg/cmd/util/clientcmd/factory.go
Outdated
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.
if this is only used for version negotiation, name it that, and put a TODO in the struct to remove it once we figure out negotiation
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.
Changed and commented on the clientCache struct itself.
147a461 to
3fc9775
Compare
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.
I'm a dope, should be t.Fatalf... verify-govet failed the build
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.
D'oh.. fixed
|
also fixed UI URL generation spec tests in https://github.com/openshift/origin/pull/5173/files#diff-689b2ab3d7877627d6bc9d184285eefe |
a09a468 to
78487fa
Compare
78487fa to
5bb8222
Compare
|
lgtm, [merge] |
|
continuous-integration/openshift-jenkins/merge Waiting: You are in the build queue at position: 2 |
|
Evaluated for origin merge up to 5bb8222 |
|
Evaluated for origin test up to 5bb8222 |
|
Cherry-picked into and superceded by #5143 |
Disable v1beta3 in the REST API.
For https://trello.com/c/ocfTkFTM