Skip to content

Contributor Guide

Contributions are welcome and appreciated.

How it works

This project aims to follow the Kubernetes Operator pattern

It uses Controllers, which provides a reconcile function responsible for synchronizing resources until the desired state is reached on the cluster.

Development Environment

You’ll need a Kubernetes cluster to run against. You can find instructions on how to setup your dev cluster in the Dev Cluster Setup section. Note: Your controller will automatically use the current context in your kubeconfig file (i.e. whatever cluster kubectl cluster-info shows).

We recommend using VSCode with the Remote - Containers extension. This will allow you to use our devcontainer, which has all the tools needed to develop and test the LTB Operator already installed.

Getting Started

  1. Clone the repository
  2. Open the repository in VSCode
  3. Click the popup or use the command palette to reopen the repository in a container (Dev Containers: Reopen in Container)

Now you are ready to start developing!

Running the LTB Operator locally

You can run the LTB Operator locally on your machine. This is useful for quick testing and debugging. However, you will need to be aware that the LTB Operator will use the kubeconfig file on your machine, so you will need to make sure that the context is set to the cluster you want to run against. Therefore, it also does not use the RBAC rules it would usually be deployed with.

  1. Install the CRDs into the cluster:
make install
  1. Run your 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

Uninstall CRDs

To delete the CRDs from the cluster:

make uninstall

Running the LTB Operator on the cluster

You can also run the LTB Operator on the cluster. This is useful for testing it in a more realistic environment. However, you will first need to login to some container registry that the cluster can access, so that you can push the LTB Operator image to that registry. This will allow you to test the LTB Operator's RBAC rules.

Make sure to replace <some-registry> with the location of your container registry and <tag> with the tag you want to use.

  1. Install Instances of Custom Resources:
kubectl apply -f config/samples/
  1. Build and push your image to the location specified by IMG:
make docker-build docker-push IMG=<some-registry>/ltb-operator:<tag>
  1. Deploy the controller to the cluster with the image specified by IMG:
make deploy IMG=<some-registry>/ltb-operator:<tag>
Undeploy controller

Undeploy the controller from the cluster:

make undeploy

Modifying the API definitions

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

You can find more information on how to develop the operator in the Operator-SDK Documentation and the Kubebuilder Documentation


Last update: June 30, 2023