Install kubebuilder

os=$(go env GOOS)
arch=$(go env GOARCH)

# download kubebuilder and extract it to tmp
curl -sL https://go.kubebuilder.io/dl/2.0.0-beta.0/${os}/${arch} | tar -xz -C /tmp/

# move to a long-term location and put it on your path
# (you'll need to set the KUBEBUILDER_ASSETS env var if you put it somewhere else)
sudo mv /tmp/kubebuilder_2.0.0-beta.0_${os}_${arch} /usr/local/kubebuilder
export PATH=$PATH:/usr/local/kubebuilder/bin

Create a Project

mkdir namespace-operator
cd namespace-operator

go mod init kangwoo.github.io/namespace-operator

kubebuilder init --domain kangwoo.github.io

Adding a new API

kubebuilder create api --group tenant --version v1 --kind NamespaceRequest --namespaced false

Adding a new Webhook

kubebuilder create webhook --group tenant --version v1 --kind NamespaceRequest --defaulting --programmatic-validation

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 항목은 *(으)로 표시합니다