-
Notifications
You must be signed in to change notification settings - Fork 38.6k
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
Log a warning message when failed to find kind for resource in garbage collector controller #39457
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Will the upper check see this registration? This is master, above is controller manager.
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.
it won't, I add this because there are some calls in the apiserver which did the same check as above, for example: https://github.com/kubernetes/kubernetes/blob/master/pkg/registry/extensions/thirdpartyresourcedata/codec.go#L373.
but yeah, I did two things here, and I am still doing various of validation.
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.
Is anything broken in the apiserver due to not registering the thirdpartyresources? We are either missing a test or the whole registration is not necessary. In the later case, I would rather remove the whole registration logic for tprs.
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.
@sttts along with your changes to add verbs for thirdpartyresources, the namespace controller will be aware of them, so let's reconsider the problem at #37278.
When a namespace is going to be deleted, the namespace controller will delete all the deletable resources under that namespace, and in case it is a TPR resources, the delete options will fail to be decoded by a TPR gvk, and @caesarxuchao made a change in this pull request: #37328, if you look at the code, it checks whether the gvk is a TPR group version by calling
registered.IsThirdPartyAPIGroupVersion
, and that call depends on whether we register it or not.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.
The stuff in the registered package is intended to be static, write-once on application startup, so I'm a little surprised to see this method...
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.
And answering the question, this line could only possibly affect the copy of
registered
in the apiserver binary. It has no effect on the copy ofregistered
that the garbage collector would use.If you add this here, probably there is a corresponding place where it needs to be removed.
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.
hm, it's pretty weird that that function existed but was never called in the server. Perhaps it was intended for clients constructing their own RESTMapper.
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.
Last thought: having this line here without explanation and without a test makes it hard to refactor this code into something understandable. @zhouhaibing089 it would be great if you could add a test :)
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.
@lavalamp thanks for your thoughts, i will do both: add an explanation and also a test.