Skip to content

Latest commit

 

History

History
107 lines (70 loc) · 3.17 KB

controller.md

File metadata and controls

107 lines (70 loc) · 3.17 KB

Controller Developer Guide

The controller is in charge of keeping the current state of SealedSecret objects in sync with the declared desired state.

The controller exposes an API defined using the Swagger or OpenAPI v3 specification. You can download the definition from the link below:

Table of Contents generated with DocToc

Download the controller source code

git clone https://github.com/bitnami-labs/sealed-secrets.git $SEALED_SECRETS_DIR

The controller sources are located under cmd/controller/ and use packages from the pkg directory.

Setup a kubernetes cluster to run the tests

You need a kubernetes cluster to run the integration tests.

For instance:

  • Start Minikube and configure your local environment to re-use the Docker daemon inside the Minikube instance:
minikube start
eval $(minikube docker-env)

Run all controller tests with a single command

make K8S_CONTEXT=mytestk8s-context OS=linux ARCH=amd64 controller-tests

Note that:

  • K8S_CONTEXT must be set to the name of your kubectl context pointing to the expected text cluster.
  • OS & ARCH must match the Operating System and Architecture of your test cluster.

Optionally, you can customize the REGISTRY as well:

make K8S_CONTEXT=kind-mykind REGISTRY=localhost:5000 OS=linux ARCH=amd64 controller-tests

Run tests step by step

Building the controller binary

make controller

This builds the controller binary in the working directory.

Running unit tests

To run the unit tests for controller binary:

make test

Push the controller image

make K8S_CONTEXT=kind-mykind OS=linux ARCH=amd64 push-controller

This builds the controller container image and pushes it.

Remember that the REGISTRY env var is only needed when using a custom registry:

make K8S_CONTEXT=kind-mykind REGISTRY=localhost:5000 OS=linux ARCH=amd64 push-controller

Building & applying the controller manifests

make K8S_CONTEXT=kind-mykind REGISTRY=localhost:5000 apply-controller-manifests

This builds the controller K8s manifests in the working directory and deploys them.

Running integration tests

make integrationtest