zalando / postgres-operator

Postgres operator creates and manages PostgreSQL clusters running in Kubernetes
https://postgres-operator.readthedocs.io/
MIT License
4.22k stars 968 forks source link

crd generate #1950

Open zlcnju opened 2 years ago

zlcnju commented 2 years ago

Hello, i am new to the postgres-operator and i am cofused how to generate the pg crd in this project. Is there some scripts or just use the controller-gen?

FxKu commented 2 years ago

You mean code generation?

The operator can generate and register the CRD on its own. If you need it for your go env make sure you've installed all dependencies. Run make deps and then try code generation ./hack/update-codegen.sh.

zlcnju commented 2 years ago

You mean code generation?

The operator can generate and register the CRD on its own. If you need it for your go env make sure you've installed all dependencies. Run make deps and then try code generation ./hack/update-codegen.sh.

./hack/update-codegen.sh is used to generate the clientset/informers/listers. What i want to know is how to generate CRD file. I used controller-gen v0.7.0, and some error occurs. And the field spec.names.kind is Postgresql when use controller-gen to generate. I tried to find the annotations or other way to modify the kind when generate, but failed. Now I used yq to modify it after crd generate, but i think it is not elegant. So, come here for solutions.