make hack/tools/bin/kubebuilder
Add API to PROJECT https://github.com/aws/eks-anywhere/blob/main/PROJECT
run ./hack/kubebuilder.sh create api --group anywhere --version v1alpha1 --kind WhateverKind
Since we use a non standard (according to kubebuilder) repo structure, kubebuilder commands won't work. For this purpose, we have a script that temporally changes our folder structure to one that kubebuilder understands and restores the original one after executing the kubebuilder command.
Example
./hack/kubebuilder.sh create webhook --group anywhere --version v1alpha1 --defaulting --programmatic-validation --kind WhateverKind
--defaulting
creates mutation webhooks and --programmatic-validation
creates validation webhooks.
Resources:
https://book.kubebuilder.io/cronjob-tutorial/webhook-implementation.html
https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#request
The default name in webhook marker is v<kind>.kb.io
, we need to change it to <validation/mutation>.<kind>.anywhere.amazonaws.com
run make release-manifests