kubernetes-client icon indicating copy to clipboard operation
kubernetes-client copied to clipboard

Add Integration tests for Admission and Conversion Controllers written using KubernetesClient

Open rohanKanojia opened this issue 4 years ago • 6 comments

As suggested by @jorsol in https://github.com/fabric8io/kubernetes-client/pull/3363#issuecomment-892806386 , We should test admission and conversion webhooks written using Fabric8 Kubernetes Client. I'm not sure if anyone has done it yet in Java. We need to check if a user is able to write an admission controller using Fabric8 Kubernetes Client. You can check Kubernetes documentation[0] on how to do this.

If we're able to write one without any problems. We need to add integration tests for the following scenarios:

  • [ ] Admission Controller with mutating admission webhook
  • [ ] Admission Controller with validating admission webhook
  • [ ] Conversion webhook(applicable to CustomResources only)

[0] https://kubernetes.io/blog/2019/03/21/a-guide-to-kubernetes-admission-controllers/

rohanKanojia avatar Aug 11 '21 05:08 rohanKanojia

Relates to: #3388, https://github.com/fabric8io/kubernetes-client/issues/3336#issuecomment-896523954

manusa avatar Aug 11 '21 05:08 manusa

It's perfectly possible to write admission controllers and conversion webhooks using Fabric8 KC, but it requires having a Webhook REST API working in the app because the Kubernetes API server makes an HTTPS POST request to the given service and URL path.

So, one option I see is to just have an example with a framework like Quarkus to "test" this, anyway it should be possible to write an integration test but I'm not sure how much work would it require to have a proper integration in the actual itests module.

jorsol avatar Aug 11 '21 09:08 jorsol

This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions!

stale[bot] avatar Nov 10 '21 12:11 stale[bot]

Hi @rohanKanojia i would like to take this up if no one is working on it.

aditya-32 avatar May 19 '23 11:05 aditya-32

I think that this should be possible now by leveraging the Kube API test module.

manusa avatar Mar 06 '24 09:03 manusa

I think that this should be possible now by leveraging the Kube API test module.

Yes, this should be possible with this.

Also you might find this useful: https://github.com/operator-framework/josdk-webhooks

csviri avatar Mar 06 '24 09:03 csviri