Any library or example to configure Kong CRDs via client-go?

Hi, the guide pages show the method to configure kong with “kubectl”.

Are there any existing libraries, or examples to configure the kong CRDs with kubernetes client-go(https://github.com/kubernetes/client-go)?

Thanks!

The source code for Ingress Controller is open-source and you use ideas from there: https://github.com/kong/kubernetes-ingress-controller/

To configure kong CRDs, per client-go example(https://github.com/kubernetes/apiextensions-apiserver/tree/master/examples/client-go), code generation is needed for kong CRDs. Do you know if anyone has already done that?

Yes. The auto-gen code is present here: https://github.com/Kong/kubernetes-ingress-controller/tree/master/internal/client

Oh, I might understand this wrong.

Is the code generation for implementing CRD controller? Do I still need this if I only want to create/update/delete Kong CRD instances (not to define CRD as kong-ingress-controller does)?

Why does kubectl work with the CRDs out-of-box without the code generation?

Basically, this is troublesome to me to choose CRD or Admin API for configuring Kong.

Admin API is simply REST, which is quite clear.
While CRD requires code-generation, or copy https://github.com/Kong/kubernetes-ingress-controller/tree/master/internal/client or something else. I can’t be sure and it’s hard to proceed. There’s no guidance. It’s not easy task for kong/k8s basic users.
But you still recommend CRD over Admin API and I’m still trying to follow that.

You can use kubectl to CRUD the CRDs. You don’t need to write your own tooling for this.

We need to CRUD them with program. Do you suggest to prepare CRD yaml files in some /tmp directory, and call shell execute “kubectl”? That doesn’t seem a formal solution.

Any idea about this?

You can do either that or you can use kubernetes client libraries to do this.

Because kubectl understands the schemas of CRDs defined in k8s.

Back to my original quesion:

All current excellent guides (https://github.com/Kong/kubernetes-ingress-controller/tree/master/docs/guides)are using kubectl. Could Kong official provide one guide that uses client-go?

No. That is out of scope of our work. Please consult the k8s community.

1 Like