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

Ignore error when discovering server supported groupVersions and resources #16082

Merged

Conversation

caesarxuchao
Copy link
Member

First two commits are #15973.

Let the Discovery Client ignore error when discovering server supported groupVersions

fixes @bgrant0607's comment #15796 (comment).

This one needs to be cherry-picked.

supersede #16066

cc @liggitt @jlowdermilk

@caesarxuchao caesarxuchao added sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. cherrypick-candidate labels Oct 22, 2015
@k8s-github-robot k8s-github-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 22, 2015
@k8s-github-robot
Copy link

Labelling this PR as size/L

@k8s-bot
Copy link

k8s-bot commented Oct 22, 2015

GCE e2e test build/test passed for commit a998fc0f04af3d311a56d5cb1c3a41fdc2c8e193.

@liggitt
Copy link
Member

liggitt commented Oct 22, 2015

cc @deads2k for negotiation awareness

"k8s.io/kubernetes/pkg/runtime"
)

type JSONCodec struct{}
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we want this... why can't we use an existing codec for this? Any of them should be able to handle unversioned objects, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

If we use the Scheme codec, I think it would probably fail here and here.

Even if the Scheme can handle the unversioned objects, I feel it's less robust to use such a complex codec when we only need a simple one. What do you think?

Copy link
Member

Choose a reason for hiding this comment

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

I don't have a strong opinion. If we find ourselves adding anything more complicated than straight json calls here, we should consider not using this.

Copy link
Member

Choose a reason for hiding this comment

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

But consider changing the name to jsonCodec, and making a func NewCodec() jsonCodec {...} so people can make one? Or a public variable var Codec = jsonCodec{}.

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.

@k8s-bot
Copy link

k8s-bot commented Oct 22, 2015

GCE e2e build/test failed for commit 273484d8eee631b5d991c2504e8bb3458cd63441.

return nil, fmt.Errorf("unexpected error: %v", err)
err = d.Get().AbsPath("/apis").Do().Into(apiGroupList)
if err != nil {
if !errors.IsNotFound(err) {
Copy link
Member

Choose a reason for hiding this comment

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

A secured 1.0 server could easily return a forbidden error here

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not familiar with the secured server. Could you point me to the related code? Thanks.

Copy link
Member

Choose a reason for hiding this comment

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

A server that limits users' access to URLs outside their namespace or specifically whitelisted exceptions (for 1.0, that would likely include /api, but definitely wouldn't include /apis. This is close to possible with the abac authorizer (#13097 is open to make it work completely), but real installations would be likely to deny requests outside the expected URL paths. TL;DR: either a NotFound or Forbidden error could easily be received for /apis from a 1.0 installation.

Copy link
Member

Choose a reason for hiding this comment

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

@deads2k I would actually be very tolerant of errors when requesting /apis if we got a usable response from /api, if we ever expect this to work against a 1.0 server

Copy link
Member Author

Choose a reason for hiding this comment

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

Now it ignores 403 error as well.

@lavalamp
Copy link
Member

Only minor comments, thanks.

@caesarxuchao caesarxuchao changed the title Ignore error when discovering server supported groupVersions Ignore error when discovering server supported groupVersions and resources Oct 23, 2015
@k8s-bot
Copy link

k8s-bot commented Oct 23, 2015

GCE e2e build/test failed for commit 36e55f6a19cd0456a6c82c5bb84e86b94bbeef8a.

@caesarxuchao
Copy link
Member Author

e2e failure:

Cluster failed to initialize within 300 seconds.

@caesarxuchao
Copy link
Member Author

@k8s-bot test this please.

1 similar comment
@caesarxuchao
Copy link
Member Author

@k8s-bot test this please.

@caesarxuchao
Copy link
Member Author

@liggitt @deads2k could you help review the entire change (including the first 2 commits which are #15973)? We need to cherry-pick this into 1.1 release and lavalamp is not available today. Thanks.

@caesarxuchao
Copy link
Member Author

@k8s-bot test this please

@caesarxuchao
Copy link
Member Author

@k8s-bot test this

@j3ffml
Copy link
Contributor

j3ffml commented Oct 23, 2015

@caesarxuchao the bot is currently dead, we're trying to revive it #16161.

@bgrant0607
Copy link
Member

#16364 has been LGTMed. Thanks.

@lavalamp
Copy link
Member

Looks good, will put on the label when #16364 merges.

@lavalamp
Copy link
Member

@caesarxuchao can you make an issue for this, so we can track it for 1.1? Thanks

@lavalamp
Copy link
Member

Oh wait, you're occupied today-- I'll make one.

Ignore 403 and 404 error when discovering server-supported group/version
@caesarxuchao caesarxuchao force-pushed the discover-1.0-server-new branch from 92ccb9b to 69932ae Compare October 29, 2015 16:55
@caesarxuchao
Copy link
Member Author

@lavalamp rebased and squashed. I'll make a cherry-pick now.

@k8s-bot
Copy link

k8s-bot commented Oct 29, 2015

GCE e2e test build/test passed for commit 69932ae.

@caesarxuchao
Copy link
Member Author

Adding the lgtm label per #16082 (comment). @lavalamp please remove it if you want to.

@caesarxuchao caesarxuchao added lgtm "Looks good to me", indicates that a PR is ready to be merged. cherrypick-candidate and removed cherrypick-candidate labels Oct 29, 2015
@lavalamp
Copy link
Member

That's fine, thanks!

@lavalamp
Copy link
Member

@k8s-bot unit test this

@k8s-github-robot
Copy link

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

k8s-github-robot referenced this pull request Oct 30, 2015
…#16082-upstream-release-1.1

Auto commit by PR queue bot
@k8s-bot
Copy link

k8s-bot commented Oct 30, 2015

GCE e2e test build/test passed for commit 69932ae.

@k8s-github-robot
Copy link

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

@k8s-bot
Copy link

k8s-bot commented Oct 30, 2015

GCE e2e test build/test passed for commit 69932ae.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

k8s-github-robot pushed a commit that referenced this pull request Oct 30, 2015
@k8s-github-robot k8s-github-robot merged commit a86d878 into kubernetes:master Oct 30, 2015
shyamjvs referenced this pull request in shyamjvs/kubernetes Dec 1, 2016
…y-pick-of-#16082-upstream-release-1.1

Auto commit by PR queue bot
shouhong referenced this pull request in shouhong/kubernetes Feb 14, 2017
…y-pick-of-#16082-upstream-release-1.1

Auto commit by PR queue bot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. 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.