Skip to content

Development Guide

Technology stack required for development

Build

make

Run locally

You need an active session open to a kubernetes cluster.

Optionally, run kind with local-env-setup.

make local-env-setup

Then, run the operator locally

make run

Deploy the operator in a deployment object

make local-setup

Deploy the operator using OLM

You can deploy the operator using OLM just running a few commands. No need to build any image. Kuadrant engineering team provides latest and released version tagged images. They are available in the Quay.io/Kuadrant image repository.

Create kind cluster

make kind-create-cluster

Deploy OLM system

make install-olm

Deploy the operator using OLM. The make deploy-catalog target accepts the following variables:

Makefile Variable Description Default value
CATALOG_IMG Catalog image URL quay.io/kuadrant/limitador-operator-catalog:latest
make deploy-catalog [CATALOG_IMG=quay.io/kuadrant/limitador-operator-catalog:latest]

Build custom OLM catalog

If you want to deploy (using OLM) a custom limitador operator, you need to build your own catalog.

Build operator bundle image

The make bundle target accepts the following variables:

Makefile Variable Description Default value Notes
IMG Operator image URL quay.io/kuadrant/limitador-operator:latest
VERSION Bundle version 0.0.0
RELATED_IMAGE_LIMITADOR Limitador bundle URL quay.io/kuadrant/limitador:latest LIMITADOR_VERSION var could be use to build this URL providing the tag
CHANNELS Bundle channels used in the bundle, comma separated alpha
DEFAULT_CHANNEL The default channel used in the bundle alpha
  • Build the bundle manifests
make bundle [IMG=quay.io/kuadrant/limitador-operator:latest] \
            [VERSION=0.0.0] \
            [RELATED_IMAGE_LIMITADOR=quay.io/kuadrant/limitador:latest] \
            [CHANNELS=alpha] \
            [DEFAULT_CHANNEL=alpha]
  • Build the bundle image from the manifests
Makefile Variable Description Default value
BUNDLE_IMG Operator bundle image URL quay.io/kuadrant/limitador-operator-bundle:latest
make bundle-build [BUNDLE_IMG=quay.io/kuadrant/limitador-operator-bundle:latest]
  • Push the bundle image to a registry
Makefile Variable Description Default value
BUNDLE_IMG Operator bundle image URL quay.io/kuadrant/limitador-operator-bundle:latest
make bundle-push [BUNDLE_IMG=quay.io/kuadrant/limitador-operator-bundle:latest]

Build custom catalog

The catalog format will be File-based Catalog.

Make sure all the required bundles are pushed to the registry. It is required by the opm tool.

The make catalog target accepts the following variables:

Makefile Variable Description Default value
BUNDLE_IMG Operator bundle image URL quay.io/kuadrant/limitador-operator-bundle:latest
DEFAULT_CHANNEL Catalog default channel alpha
make catalog [BUNDLE_IMG=quay.io/kuadrant/limitador-operator-bundle:latest] [DEFAULT_CHANNEL=alpha]
  • Build the catalog image from the manifests
Makefile Variable Description Default value
CATALOG_IMG Operator catalog image URL quay.io/kuadrant/limitador-operator-catalog:latest
make catalog-build [CATALOG_IMG=quay.io/kuadrant/limitador-operator-catalog:latest]
  • Push the catalog image to a registry
make catalog-push [CATALOG_IMG=quay.io/kuadrant/limitador-operator-bundle:latest]

You can try out your custom catalog image following the steps of the Deploy the operator using OLM section.

Cleaning up

make local-cleanup

Run tests

Unittests

make test-unit

Optionally, add TEST_NAME makefile variable to run specific test

make test-unit TEST_NAME=TestConstants

or even subtest

make test-unit TEST_NAME=TestLimitIndexEquals/empty_indexes_are_equal

Integration tests

You need an active session open to a kubernetes cluster.

Optionally, run local cluster with kind

make local-env-setup

Run integration tests

make test-integration

All tests

You need an active session open to a kubernetes cluster.

Optionally, run local cluster with kind

make local-env-setup

Run all tests

make test

Lint tests

make run-lint

(Un)Install Limitador CRD

You need an active session open to a kubernetes cluster.

Remove CRDs

make uninstall