@@ -36,12 +36,90 @@ $ LIBGIT2_FORCE=1 make libgit2
3636```
3737
3838** Note:** Example shown is for Arch Linux, but likewise procedure can be
39- followed using any other package manager, e.g. ` apt ` .
39+ followed using any other package manager. Some distributions may have slight
40+ variation of package names (e.g. ` apt install -y cmake openssl libssh2-1-dev ` ).
4041
4142## How to run the test suite
4243
43- You can run the unit tests by simply doing
44+ The test suite depends on [ envtest] being installed. For minimum required
45+ version refer to the variable ` ENVTEST_BIN_VERSION ` in the [ Makefile] ( ./Makefile ) .
46+
47+ You can run the unit tests by simply doing:
4448
4549``` bash
4650make test
4751```
52+
53+ [ envtest ] : https://book.kubebuilder.io/reference/envtest.html#installation
54+
55+
56+ ## How to run the controller locally
57+
58+ Install flux on your test cluster:
59+
60+ ``` sh
61+ flux install
62+ ```
63+
64+ Scale the in-cluster controller to zero:
65+
66+ ``` sh
67+ kubectl -n flux-system scale deployment/source-controller --replicas=0
68+ ```
69+
70+ Run the controller locally:
71+
72+ ``` sh
73+ make run
74+ ```
75+
76+ ## How to install the controller
77+
78+ ### Building the container image
79+
80+ Set the name of the container image to be created from the source code. This will be used
81+ when building, pushing and referring to the image on YAML files:
82+
83+ ``` sh
84+ export IMG=registry-path/source-controller
85+ export TAG=latest # optional
86+ ```
87+
88+ Build the container image, tagging it as ` $(IMG):$(TAG) ` :
89+
90+ ``` sh
91+ make docker-build
92+ ```
93+
94+ Push the image into the repository:
95+
96+ ``` sh
97+ make docker-push
98+ ```
99+
100+ Alternatively, the three steps above can be done in a single line:
101+
102+ ``` sh
103+ IMG=registry-path/source-controller TAG=latest BUILD_ARGS=--push \
104+ make docker-build
105+ ```
106+ For an extensive list of ` BUILD_ARGS ` , refer to the docker [ buildx build options] documentation.
107+
108+ ** Note:** ` make docker-build ` will build images for all supported architecture by default.
109+ Limit this to a specific architecture for faster builds:
110+
111+ ``` sh
112+ IMG=registry-path/source-controller TAG=latest BUILD_ARGS=--push BUILD_PLATFORMS=amd64 \
113+ make docker-build
114+ ```
115+
116+ [ buildx build options ] : https://docs.docker.com/engine/reference/commandline/buildx_build/#options
117+
118+
119+ ### Deploying into a cluster
120+
121+ Deploy ` source-controller ` into the cluster that is configured in the local kubeconfig file (i.e. ` ~/.kube/config ` ):
122+
123+ ``` sh
124+ make dev-deploy
125+ ```
0 commit comments