-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Add first version of a Fabric8 Kubernetes Client extension #2910
Conversation
683f33b
to
08fd33a
Compare
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.
I added 2 very minor comments. Code looks good otherwise.
core/deployment/src/main/java/io/quarkus/deployment/builditem/FeatureBuildItem.java
Outdated
Show resolved
Hide resolved
08fd33a
to
845bfdc
Compare
845bfdc
to
8be594c
Compare
PR is now ready. I ran the native test locally and it worked wonderfully. |
8be594c
to
e2d3e47
Compare
@geoand seems very nice! Many thanks for that. Have you tested this client using SA token/cert inside OpenShift? This is the next step of the tests that I'm about to run today in native environment to make sure that the CertUtils won't break anything because of the EC Keys thing. I guess won't. 😄 |
@ricardozanini Thanks :) Yeah, I explicitly disabled the EC thing so |
@ricardozanini I also tried using the certificate of the Kubernetes API and it worked great in native mode as well. |
@geoand many thanks for your feedback. So, I'm assuming you copied the ssl required native libs into your image? Do you mind sharing which libs have you copied? And what base image? I'm about to write a blog post about this setup also to help others having SSL working on native images. |
@ricardozanini well, I sort of cheated to be honest :). I just copied the cluster certificate locally and instructed the Kubernetes Client to use it (while also telling it to explicitly not trust unknown certificates). So essentially I didn't create a docker image and run a pod in the cluster, I just made sure the native binary works with the certificates. I think @cescoffier would know a lot more about which base image to use and which libs are needed |
@geoand I'm about to upload an image with a demo working, I'll share with you the results afterwards. |
@ricardozanini cool, looking forward to it :) |
I tried it. It compiles, but when I run the Docker image I get this error:
I used the |
@geoand here's the working docker image: Then:
Go to: Assuming your user has permission to query the default namespace. Otherwise, just replace You should see the services in JSON format. |
@fstab that is a typical issue when using the wrong docker base image. @gsmet @cescoffier @ricardozanini can you assist @fstab with the error perhaps? |
@fstab that's because you need to copy the native lib to your docker image, see: This image already have what you need to run the client. Just copy the native lib from |
so about this This is definitely annoying. I don't know how we can find an acceptable solution to this issue while all the distributions/users transition to the new lib. |
@geoand the base image from the maven archetype (fedora-minimal) Also, I'll work on something to not use the native library. See: Thanks to @ruromero for pointing this issue 😃 |
Thanks for the info @ricardozanini and @gsmet! |
Thank for your help with the
Is this supposed to work, or is Jackson deserialization not possible with native images? |
@fstab so you are using a k8s custom resource, right? Serialization and Deserialization definitely work with the standard model classes and I'll look into CR handling over the weekend (shouldn't be hard to fix I assume - but I would prefer the PR be merged anyway since it covers the most common use cases) |
@fstab could you please share what exactly your failing class looks like? I am basically interested if it extends KubernetesResource |
@geoand I uploaded a minimal operator example on https://github.com/fstab/operator-example
Thanks a lot for looking into this! |
Thanks for the reproducer! Looking into it now |
@fstab the problem in your example is that So if your Would you like to give it a shot and let me know how it goes? |
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.
I added a few comments/questions inline.
I think it's an interesting addition and a nice first step. I'm wondering though if it would be worth to go a bit further and allow to configure the client via Quarkus properties and so on. Not sure if it's a good idea or not?
I think this PR has value as is so I'm in favor of merging it and then build on it.
...loyment/src/main/java/io/quarkus/kubernetes/client/deployment/KubernetesClientProcessor.java
Show resolved
Hide resolved
...runtime/src/main/java/io/quarkus/kubernetes/client/runtime/graal/CertUtilsSubstitutions.java
Show resolved
Hide resolved
I was actually also thinking the same thing about configuring a client via properties. I think it will be great, but I also believe we should first think about which properties would be useful to expose - probably something similar to what we have done in Spring Cloud Kubernetes. |
e2d3e47
to
aa872ce
Compare
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.
Nice contribution, thanks!
You are very welcome! |
@fstab One more thing you will need to do in your example to get it work (I tried it), is to ensure that the native binary contains
to the configuration section of the |
@geoand is it a standard file or something custom? |
@gsmet it's custom to the example application in question. I was thinking that we could perhaps add all |
@geoand I can confirm that my operator example works in native mode with the changes you described above. Great job, thank you very much!!! |
Awesome to hear it @fstab! Thanks for your help! |
@fstab I was thinking, would you be up to contributing a guide for using the Kubernetes Client? |
Yes, I could do that, but it might take two weeks or so until I find the time. Will it be a new document in |
@fstab yes exactly! That would be awesome, thanks! |
@geoand regarding the guide for the Kubernetes client extension: I wrote a series of Blog posts about it:
I think it should be possible to condense these into a tutorial. I will try to find the time for this next week. |
That's awesome, thanks @fstab ! |
TODOCheck and see if we can improve the reflection situation (currently all model classes are registered for reflection)fixed in Allow registrations reflection on fields and methods but not the class #2911Add testing (we really only care about native here) most likely using the Kubernetes API mock serverFixes: #1488