A basic k8s operator for PodSet CRD, built with Go and Operator SDK
Check-out my OLM notes if you want to learn how to publish/release your operator using Operator Lifecycle Manager (OLM) project
- https://learn.openshift.com/operatorframework/go-operator-podset/
- https://sdk.operatorframework.io/docs/building-operators/golang/quickstart/
-
To initialize a new project:
operator-sdk init --domain=example.com --repo=github.com/redhat/podset-operator
Note:
github.com/redhat/podset-operator
is the Go project module name (seego.mod
file) -
To create API and controller:
operator-sdk create api --group=app --version=v1alpha1 --kind=PodSet --resource --controller
-
After modifying the
*_types.go
file, run:make generate
-
To generate CRD:
make manifests
-
To run the operator controller locally (assumming
kubeconfig
was configured):WATCH_NAMESPACE=myproject make run