Skip to content

Latest commit

 

History

History
103 lines (66 loc) · 2.72 KB

DEVELOPMENT.md

File metadata and controls

103 lines (66 loc) · 2.72 KB

Development

Note: Please take a look at https://fluxcd.io/contributing/flux/ to find out about how to contribute to Flux and how to interact with the Flux Development team.

Installing required dependencies

There are a number of dependencies required to be able to run the controller and its test suite locally:

In addition to the above, the following dependencies are also used by some of the make targets:

  • controller-gen (v0.7.0)
  • gen-crd-api-reference-docs (v0.3.0)
  • setup-envtest (latest)
  • sops (v3.7.2)

If any of the above dependencies are not present on your system, the first invocation of a make target that requires them will install them.

How to run the test suite

Prerequisites:

  • Go >= 1.18

You can run the test suite by simply doing

make test

How to run the controller locally

Install the controller's CRDs on your test cluster:

make install

Note that kustomize-controller depends on source-controller to acquire its artifacts. If source-controller is not running on your test cluster, you need to tell kustomize-controller where to find it.

Port forward to source-controller artifacts server:

kubectl -n flux-system port-forward svc/source-controller 8080:80

Export the local address as SOURCE_CONTROLLER_LOCALHOST:

export SOURCE_CONTROLLER_LOCALHOST=localhost:8080

Alternatively, if your test cluster is already running source-controller and kustomize-controller, you need to scale down the in-cluster kustomize-controller:

kubectl -n flux-system scale deployment/kustomize-controller --replicas=0

Run the controller locally:

make run

How to install the controller

Building the container image

Set the name of the container image to be created from the source code. This will be used when building, pushing and referring to the image on YAML files:

export IMG=registry-path/kustomize-controller:latest

Build the container image, tagging it as $(IMG):

make docker-build

Push the image into the repository:

make docker-push

Note: make docker-build will build an image for the amd64 architecture.

Deploying into a cluster

Deploy kustomize-controller into the cluster that is configured in the local kubeconfig file (i.e. ~/.kube/config):

make deploy

Running the above will also deploy source-controller and its CRDs to the cluster.