Answer a question

I want to use serving api which is the part of the knative serving repo to create serving application. Since i'm writing a custom controller, i need to make use of Go client. I'm finding it difficult to generate boiler plate code using the code-generator. I'm following the below mentioned blog on how to do it.

  1. https://insujang.github.io/2020-02-13/programming-kubernetes-crd/#write-template-code
  2. https://blog.openshift.com/kubernetes-deep-dive-code-generation-customresources/

But i couldn't achieve it. Any help is appreciated.

Answers

Yes, code generation for controllers is not the most easy thing. And it has changed over the years.

To start writing a controller with code generation, I would recommend to use Kubebuilder and follow the Kubebuilder guide. And perhaps do custom things when that is understood.

The Kubebuilder guide includes chapters on how to generate CRD code using controller-gen.

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐