Set GVK in an object while calling typed-client #2946
Closed
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.
Signed-off-by: Hiranmoy Das Chowdhury hiranmoy.das70@gmail.com
What type of PR is this?
/kind bug
What this PR does / why we need it:
While getting or creating or patching or updating object using typed-client which is a dynamic client in controller-runtime repository, gvk/TypeMeta found empty for that object because of the codec convention.
As unstructured client and metadata client and typed client is not exported. So, we can't call these from outside and we are using only one client for these. So, when we try to get unstructured object, we get the GVK. But, for structured object we missed GVK with the same client(from users perspective), this is a little confusion for newcomers like me. I had to find this by a lot of debugging. Also, there is an option to determine what the GVK is: obj.GetObjectKind().GroupVersionKind(). As there is a option I assumed this is fixed and set and we don't need to worry about this. I guess this should be set as expected.
To create owner reference or many more we won't need to pass scheme or gvk externally.
Does this PR introduce a user-facing change?
NONE
Which issue(s) this PR fixes:
kubernetes/kubernetes#80609
kubernetes/kubernetes#3030