6
6
7
7
## Installing required dependencies
8
8
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).
11
18
12
19
In case this dependency is not present on your system (at the expected
13
20
version), the first invocation of a ` make ` target that requires the
14
21
dependency 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/ )
16
27
17
28
Triggering a manual build of the dependency is possible as well by running
18
29
` make libgit2 ` . To enforce the build, for example if your system dependencies
19
30
match but are not linked in a compatible way, append ` LIBGIT2_FORCE=1 ` to the
20
31
` make ` command.
21
32
33
+ Follow the instructions below to install these dependencies to your system.
34
+
22
35
### macOS
23
36
24
37
``` console
@@ -39,32 +52,31 @@ $ LIBGIT2_FORCE=1 make libgit2
39
52
followed using any other package manager. Some distributions may have slight
40
53
variation of package names (e.g. ` apt install -y cmake openssl libssh2-1-dev ` ).
41
54
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:
46
56
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)
48
60
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.
54
62
63
+ ## How to run the test suite
55
64
56
- ## How to run the controller locally
65
+ Prerequisites:
66
+ * Go >= 1.17
57
67
58
- Install flux on your test cluster:
68
+ You can run the test suite by simply doing
59
69
60
70
``` sh
61
- flux install
71
+ make test
62
72
```
63
73
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:
65
77
66
78
``` sh
67
- kubectl -n flux-system scale deployment/source-controller --replicas=0
79
+ make install
68
80
```
69
81
70
82
Run the controller locally:
@@ -115,11 +127,22 @@ IMG=registry-path/source-controller TAG=latest BUILD_ARGS=--push BUILD_PLATFORMS
115
127
116
128
[ buildx build options ] : https://docs.docker.com/engine/reference/commandline/buildx_build/#options
117
129
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
+ ```
118
141
119
142
### Deploying into a cluster
120
143
121
144
Deploy ` source-controller ` into the cluster that is configured in the local kubeconfig file (i.e. ` ~/.kube/config ` ):
122
145
123
146
``` sh
124
- make dev- deploy
147
+ make deploy
125
148
```
0 commit comments