The project is designed to implement a K8s Operator with as few tools as possible and understand the K8s Operator core logic.
- Write CRD and register CR with kube-apiserver: crd.yaml
- Write resource definitions through code:
- Generate clients:
$ make build-resource
You may need to prepare the code generation tool by doing the following:
$ go get k8s.io/code-generator/cmd/defaulter-gen
$ go get k8s.io/code-generator/cmd/client-gen
$ go get k8s.io/code-generator/cmd/lister-gen
$ go get k8s.io/code-generator/cmd/informer-gen
$ go get k8s.io/code-generator/cmd/deepcopy-gen
- Write controller and add event handlers to informer.
# Register CR.
$ kubectl apply -f yaml/crd.yaml
# Build Operator.
$ make build-operator
# Run operator outside of Cluster.
$ ./release/operator -kubeconfig ~/.kube/config