66
77## Installing required dependencies
88
9- The dependency [ libgit2] ( https://libgit2.org/ ) needs to be installed to be able
10- to run source-controller or its test-suite locally (not in a container).
9+ There are a number of dependencies required to be able to run the controller and its test suite locally:
10+
11+ - [ Install Go] ( https://golang.org/doc/install )
12+ - [ Install Kustomize] ( https://kubernetes-sigs.github.io/kustomize/installation/ )
13+ - [ Install Docker] ( https://docs.docker.com/engine/install/ )
14+ - (Optional) [ Install Kubebuilder] ( https://book.kubebuilder.io/quick-start.html#installation )
15+
16+ The dependency [ libgit2] ( https://libgit2.org/ ) also needs to be installed to be able
17+ to run ` source-controller ` or its test-suite locally (not in a container).
1118
1219In case this dependency is not present on your system (at the expected
1320version), the first invocation of a ` make ` target that requires the
1421dependency will attempt to compile it locally to ` hack/libgit2 ` . For this build
15- to succeed; CMake, Docker, OpenSSL 1.1 and LibSSH2 must be present on the system.
22+ to succeed ensure the following dependencies are present on your system:
23+ - [ CMake] ( https://cmake.org/download/ )
24+ - [ OpenSSL 1.1] ( https://www.openssl.org/source/ )
25+ - [ LibSSH2] ( https://www.libssh2.org/ )
26+ - [ pkg-config] ( https://freedesktop.org/wiki/Software/pkg-config/ )
1627
1728Triggering a manual build of the dependency is possible as well by running
1829` make libgit2 ` . To enforce the build, for example if your system dependencies
1930match but are not linked in a compatible way, append ` LIBGIT2_FORCE=1 ` to the
2031` make ` command.
2132
33+ Follow the instructions below to install these dependencies to your system.
34+
2235### macOS
2336
2437``` console
@@ -39,32 +52,31 @@ $ LIBGIT2_FORCE=1 make libgit2
3952followed using any other package manager. Some distributions may have slight
4053variation of package names (e.g. ` apt install -y cmake openssl libssh2-1-dev ` ).
4154
42- ## How to run the test suite
43-
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 ) .
55+ In addition to the above, the following dependencies are also used by some of the ` make ` targets:
4656
47- You can run the unit tests by simply doing:
57+ - ` controller-gen ` (v0.7.0)
58+ - ` gen-crd-api-reference-docs ` (v0.3.0)
59+ - ` setup-envtest ` (latest)
4860
49- ``` bash
50- make test
51- ```
52-
53- [ envtest ] : https://book.kubebuilder.io/reference/envtest.html#installation
61+ 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.
5462
63+ ## How to run the test suite
5564
56- ## How to run the controller locally
65+ Prerequisites:
66+ * Go >= 1.17
5767
58- Install flux on your test cluster:
68+ You can run the test suite by simply doing
5969
6070``` sh
61- flux install
71+ make test
6272```
6373
64- Scale the in-cluster controller to zero:
74+ ## How to run the controller locally
75+
76+ Install the controller's CRDs on your test cluster:
6577
6678``` sh
67- kubectl -n flux-system scale deployment/source-controller --replicas=0
79+ make install
6880```
6981
7082Run the controller locally:
@@ -115,11 +127,22 @@ IMG=registry-path/source-controller TAG=latest BUILD_ARGS=--push BUILD_PLATFORMS
115127
116128[ buildx build options ] : https://docs.docker.com/engine/reference/commandline/buildx_build/#options
117129
130+ If you get the following error when building the docker container:
131+ ```
132+ Multiple platforms feature is currently not supported for docker driver.
133+ Please switch to a different driver (eg. "docker buildx create --use")
134+ ```
135+
136+ you may need to create and switch to a new builder that supports multiple platforms:
137+
138+ ``` sh
139+ docker buildx create --use
140+ ```
118141
119142### Deploying into a cluster
120143
121144Deploy ` source-controller ` into the cluster that is configured in the local kubeconfig file (i.e. ` ~/.kube/config ` ):
122145
123146``` sh
124- make dev- deploy
147+ make deploy
125148```
0 commit comments