-
Notifications
You must be signed in to change notification settings - Fork 2.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
Fix handling of generic resource in the kubernetes deployer #23031
Conversation
This comment has been minimized.
This comment has been minimized.
...es/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesDeployer.java
Outdated
Show resolved
Hide resolved
...es/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesDeployer.java
Outdated
Show resolved
Hide resolved
...es/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesDeployer.java
Outdated
Show resolved
Hide resolved
@iocanel any chance this could be finalized before I release 2.7.0.Final (i.e. before Tuesday evening)? |
ac1fe47
to
f8ca0cc
Compare
.withGroup(ApiVersionUtil.trimGroup(resource.getApiVersion())) | ||
.withVersion(ApiVersionUtil.trimVersion(resource.getApiVersion())) | ||
.withKind(r.getKind()) | ||
.withNamespaced(r.getNamespaced()) |
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.
So the whole point is to figure out whether the resource is namespaced and what its plural is? Would it make sense to first try the operation with some assumptions (i.e. that the resource is namespaced and what its plural is (using fabric8's Pluralize
) and only query the cluster for the information if that failed? Or we could even try twice: once namespaced, once cluster and finally query the cluster if it still doesn't work?
Not sure what's the cluster impact performance-wise of enumerating all resources…
LGTM otherwise.
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.
This logic is already present in the client:
It can be reused by using client#resources(Class<T> resourceType, Class<L> listClass)
or client#genericKubernetesResources(String apiVersion, String kind)
I'm not sure if you are aware of this.
Resolves: #19379
The pull request adds handling for generic resources in the KubernetesDeployer.
This is done by querying the api server for information based on the generic APIResource.
Then it uses the information in order to construct the generic url etc.
This is aligned with how
kubectl
handles unknown resources.