- Created
types.go
defining the struct for CRD - Create
register.go
to register the custom resource - Don't forget to implicitly add
code-generator
. For that add this line in theimport
section ofmain.go
:_ "k8s.io/code-generator"
- Then run
./hack/update-codegen.sh
. - Oh! To solve the issue run this
chmod u+x vendor/k8s.io/code-generator/generate-groups.sh
andchmod u+x hack/update-codegen.sh
and then runupdate-codegen.sh
controller-gen rbac:roleName=controller-perms crd paths=./... output:crd:dir=./artifacts output:stdout
controller.go
file contains the controller structure and all the necessary function- Controller can be run by running
CRD-Controller
file