This project follows the Kubernetes [Operator pattern](https://kubernetes.io/docs/concepts/extend-kubernetes/operator/).
It uses [Controllers](https://kubernetes.io/docs/concepts/architecture/controller/), which provide a reconcile function responsible for synchronizing resources until the desired state is reached on the cluster.
You’ll need a Kubernetes cluster to run against. You can use [KIND](https://sigs.k8s.io/kind) to get a local cluster for testing, or run against a remote cluster. See the [Korrel8r Documentation](https://korrel8r.github.io/korrel8r/) for more about setting up your cluster.
Note: Your controller will automatically use the current context in your kubeconfig file (i.e. whatever cluster kubectl cluster-info
shows).
Start the operator using one of the methods below, then use this script to verify it is working:
hack/smoketest.sh
The script creates a Korrel8r
instance and verifies that it responds to REST API calls.
If your operator is working correctly it should print some messages ending with "Success."
You can customize your own korrel8r resource, and use a browser or REST tools to query it.
You can run the controller on your own development machine, outside the cluster. This is ideal for debugging.
-
Install the CRDs into the cluster:
make install
-
Run the controller (this will run in the foreground, so switch to a new terminal if you want to leave it running):
make run
NOTE: You can also run this in one step by running: make install run
-
Build and push your image to the location specified by
IMAGE
, which should be a base image name with no tag:
make image-build image-push IMAGE=<some-image>
-
Deploy the controller to the cluster with the image specified by
IMAGE
:
make deploy IMG=<some-image>
-
Build and push your image to the location specified by
IMAGE
, which should be a base image name with no tag. This will create images$(IMAGE):$ (VERSION) and$(IMAGE)-bundle:$ (VERSION)
make push-all IMAGE=<some-image>
-
Run the bundle image on your cluster.
make bundle-run IMAGE=<some-image>
The KORREL8R_VERBOSE
environment variable to a numeric value to enable debug logs for the operator:
-
The default - some start-up messages, and a single suceess/fail message per reconcile.
-
Also list the objects modified during reconciliation.
-
Also print a diff of each object modified during reconciliation.
If you are editing the API definitions, generate the manifests such as CRs or CRDs using:
make manifests
NOTE: Run make --help
for more information on all potential make
targets
More information can be found via the [Kubebuilder Documentation](https://book.kubebuilder.io/introduction.html)