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

Same-named Kinds with different APIVersion fail to be discovered #21

Open
jaypipes opened this issue Sep 2, 2024 · 0 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@jaypipes
Copy link
Member

jaypipes commented Sep 2, 2024

The code in gdt-kube that uses the k8s client discovery cache to look up resource kinds does not work properly when there are multiple Kinds with the same name each with a different APIVersion.

For instance, if there is a kubevirt.io/VirtualMachine and a networkcloud.VirtualMachine, attempting to create an object where the manifest specifies networkcloud/VirtualMachine will result in something like this:

assertion failed: unexpected error: the API version in the data (networkcloud/v1) does not match the expected API version (kubevirt.io/v1)
@jaypipes jaypipes added the bug Something isn't working label Sep 2, 2024
@jaypipes jaypipes self-assigned this Sep 2, 2024
jaypipes added a commit to jaypipes/gdt-kube that referenced this issue Sep 3, 2024
There were a couple problems that were the root cause of this issue.
First, I was only handling the difference between namespaced and
non-namespaced CRDs in the GET action. For CREATE, DELETE, and APPLY, I
was not properly differentiating between cluster-scoped and
namespace-scoped CRDs.

After fixing that, there was a problem with how the `gvrFromGVK` method
on the connection struct was discovering an APIResource from the
GroupVersionKind. I was only passing in the Kind instead of the
GroupVersion information as well, which resulted in the discovery cache
in the kube client failing to match the correct CRD when there were two
different CRDs with the same Kind but different GroupVersions.

Closes Issue gdt-dev#21

Signed-off-by: Jay Pipes <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant