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

Hide groups with new versions from old kubectl #35840

Merged
merged 1 commit into from
Nov 2, 2016

Conversation

caesarxuchao
Copy link
Member

@caesarxuchao caesarxuchao commented Oct 29, 2016

Fix #35791

What caused the bug?

In 1.5, we are going to graduate Policy and Apps to beta. Old version kubectl doesn't has the new versions built-in, its TRP dynamic discover thinks Policy/v1beta1 is a TPR, and tried to register it in kubectl's scheme. The registration failed because Policy group already exist, because kubectl had registered Policy.v1alpha1.

How does this PR fix the bug?

This PR let the API server hides Policy and Apps from old version kubectl, so TPR discovery won't see them.

Old version kubectl doesn't know about Policy/v1beta1 or Apps/v1beta1, and v1alpha1 will be removed, so old version kubectl won't work for Policy or Apps anyway, so this PR does not cause any function loss.

@kubernetes/sig-api-machinery @liggitt @smarterclayton @deads2k @janetkuo @mwielgus


This change is Reviewable

@caesarxuchao caesarxuchao added the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Oct 29, 2016
@caesarxuchao caesarxuchao added this to the v1.5 milestone Oct 29, 2016
@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note-label-needed labels Oct 29, 2016
@k8s-ci-robot
Copy link
Contributor

Jenkins GCE Node e2e failed for commit 03c281e. Full PR test history.

The magic incantation to run this job again is @k8s-bot node e2e test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@caesarxuchao
Copy link
Member Author

@k8s-bot node e2e test this

@@ -429,6 +430,43 @@ func (s *GenericAPIServer) newAPIGroupVersion(apiGroupInfo *APIGroupInfo, groupV
}, nil
}

// TODO: Remove in 1.6. Returns if kubectl is older than v1.5.0
func isOldKubectl(userAgent string) bool {
Copy link
Member

Choose a reason for hiding this comment

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

Not in genericapiserver, please. This only applies to the master, so make the surface area here as small as possible

@caesarxuchao
Copy link
Member Author

Moved to apiserver. PTAL. Thanks.

@k8s-ci-robot
Copy link
Contributor

Jenkins verification failed for commit 586a170. Full PR test history.

The magic incantation to run this job again is @k8s-bot verify test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

"time"

"k8s.io/client-go/pkg/util/sets"
"k8s.io/client-go/pkg/version"
Copy link
Member

Choose a reason for hiding this comment

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

It's unfortunate goimports finds common types in the client-go pkg first. I think we want our own sets type

Copy link
Member

Choose a reason for hiding this comment

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

Same for the version util

Copy link
Member Author

Choose a reason for hiding this comment

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

Eh..I'm using goimports locally and I guess it imports based on alphabetical order.

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.

Copy link
Member

Choose a reason for hiding this comment

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

I anticipate that creeping in a lot of places after client-go is added :-/

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. I think these kind of utility packages should be moved to their own repo, then there will be only one copy of them.

@caesarxuchao caesarxuchao added release-note-none Denotes a PR that doesn't merit a release note. and removed release-note-label-needed labels Oct 29, 2016
@janetkuo
Copy link
Member

@liggitt @smarterclayton merging this PR will unblock two 1.5 PRs for moving StatefulSet to beta (#35731) and DisruptionBudget to beta (#35567)


// TODO: Remove in 1.6. This is for backward compatibility with 1.4 kubectl.
// See https://github.com/kubernetes/kubernetes/issues/35791
var groupsWithNewVersionsIn1_5 = sets.NewString("apps", "policy")
Copy link
Member

@liggitt liggitt Oct 31, 2016

Choose a reason for hiding this comment

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

both of these groups existed in 1.4... we're completely hiding the groups from the discovery doc? won't that break old kubectl if someone tries to create anything in those groups?

Copy link
Member Author

@caesarxuchao caesarxuchao Oct 31, 2016

Choose a reason for hiding this comment

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

The alpha version of the two groups will be removed in 1.5, so 1.4 kubectl won't work for these groups with an 1.5 apiserver anyway.

@caesarxuchao
Copy link
Member Author

@smarterclayton @liggitt could you take a look? Thanks.

@liggitt
Copy link
Member

liggitt commented Nov 1, 2016

seems ok. can you queue up the revert to merge once the 1.5 branch is cut?

@caesarxuchao
Copy link
Member Author

Do you mean revert in 1.6?

@liggitt
Copy link
Member

liggitt commented Nov 1, 2016

yes, which I guess is right after the 1.5 branch is done fast-forwarding master, right?

caesarxuchao pushed a commit to caesarxuchao/kubernetes that referenced this pull request Nov 1, 2016
@caesarxuchao
Copy link
Member Author

Right. Created #36004.

@caesarxuchao
Copy link
Member Author

If there is no more comment I'll apply the label. It's blocking two 1.5 PRs.

@janetkuo
Copy link
Member

janetkuo commented Nov 2, 2016

If there is no more comment I'll apply the label. It's blocking two 1.5 PRs.

Yes, presumably those PRs block other 1.5 PRs also. Would love to see this one merged ASAP.

@smarterclayton smarterclayton added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 2, 2016
@mwielgus mwielgus added the priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. label Nov 2, 2016
@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 5774ca1 into kubernetes:master Nov 2, 2016
@lavalamp
Copy link
Member

lavalamp commented Dec 6, 2016

IMO this is a client bug. I guess changing the server is an OK temporary fix, but the client should also change to tolerate collisions like this, so that we don't ever need any more server bandaids.

@caesarxuchao
Copy link
Member Author

#36898 is the client-side fix. It's merged.

@lavalamp
Copy link
Member

lavalamp commented Dec 6, 2016

Oh, awesome!

@deads2k
Copy link
Contributor

deads2k commented Dec 6, 2016 via email

k8s-github-robot pushed a commit that referenced this pull request Dec 22, 2016
Automatic merge from submit-queue (batch tested with PRs 39114, 36004)

Revert #32751 and #35840 in 1.6

Revert backward compatibility hacks (#36004, #32751) that are no-longer needed in release 1.6

@kubernetes/sig-api-machinery @liggitt
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. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. 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/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Old kubectl crashes when v1alpha1 api is replaced with v1beta1.
10 participants