-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Listing / loading a CAPI Cluster resource throws an exception #3859
Comments
I think we talked about this a little with #3785 but it didn't end up being needed to resolve that issue. Yes a change is need to prevent this kind of resolution conflict.
The logic will default to using a built-in handler if possible, so it's again resolving to wrong Cluster resource. Since it's not a HasMetadata resource we're generating invalid metadata from its class - the class has neither a Version nor a Group annotation, and the logic in Line 100 in 5d5ff8e
|
Kubernetes.resource now returns NamespaceableResource also adds sanity checks useful for fabric8io#3859 as well
Kubernetes.resource now returns NamespaceableResource also adds sanity checks useful for fabric8io#3859 as well
Kubernetes.resource now returns NamespaceableResource also adds sanity checks useful for fabric8io#3859 as well
Kubernetes.resource now returns NamespaceableResource also adds sanity checks useful for fabric8io#3859 as well
A separate pr will still be needed for the deserializer change. |
(cherry picked from commit 3c8a074) Signed-off-by: Marc Nuri <marc@marcnuri.com>
(cherry picked from commit 3c8a074) Signed-off-by: Marc Nuri <marc@marcnuri.com>
(cherry picked from commit 3c8a074) Signed-off-by: Marc Nuri <marc@marcnuri.com>
Describe the bug
The
KubernetesDeserializer
does a lookup for internally defined classes when deserializing JSON/YAML.I have a CRD where the kind is
Cluster
(definition can be found here). This gets resolved asclass io.fabric8.kubernetes.api.model.Cluster
, which is used internally to describe a cluster as part of the kubeconfig (why is this even implementingKubernetesResource
?). This class does not match my resource at all, so I expected the deserializer to return aGenericKubernetesResource
. Right now this loading behaviour results in all kind of weird exceptions later on.Code analysis
I noticed that in
io.fabric8.kubernetes.internal.KubernetesDeserializer.Mapping#getInternalTypeForName
, there is actually a check that the completeapiVersion + kind
matches the found class. This check is however only done if there are more than 1 possible classes found, which is not the case here. I would suggest to always do this check to be on the safe side. Part of the code:Fabric8 Kubernetes Client version
next (development version)
Steps to reproduce
When listing CAPI cluster resources as generic kubernetes resources, like so
The following exception is thrown:
Same goes for loading a resource of this kind:
Which throws:
Expected behavior
That I would be able to list and/or create
Cluster
resources using theGenericKubernetesResource
APIs.Runtime
Kubernetes (vanilla)
Kubernetes API Server version
1.22.3@latest
Environment
Linux
Fabric8 Kubernetes Client Logs
No response
Additional context
Current workaround is to explicitly register this resource as a GenericKubernetesResource:
The text was updated successfully, but these errors were encountered: