You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A guide to making it easier to develop `weave-gitops-enterprise`. If you came here expecting but not finding an answer please make an issue to help improve these docs!
4
4
5
+
## Tooling
6
+
You will need the following tools installed on your local workstation:
- Kind 0.12.0 for creating a local Kubernetes cluster
17
+
18
+
`brew install kind`
19
+
- Flux 0.29.5 for setting up Flux on a cluster
20
+
21
+
`brew install fluxcd/tap/flux`
22
+
- Buf 1.4.0 for generating code from protobuf definitions
23
+
24
+
`brew install bufbuild/buf/buf`
25
+
- clusterctl 1.1.3 for installing CAPI components on the cluster
26
+
27
+
`brew install clusterctl`
28
+
29
+
## The big picture
30
+
Weave GitOps Enterprise (WGE) currently consists of the following components:
31
+
- clusters-service
32
+
The API of WGE. This is the component that backend engineers will be changing most often. Uses the [grpc-gateway](https://github.com/grpc-ecosystem/grpc-gateway) to convert our gRPC service definitions to HTTP endpoints.
33
+
- ui-server
34
+
The UI of WGE. This is the component that frontend engineers will be changing most often. Built in React and uses yarn as the package manager.
Allows for custom Jobs to be executed on newly provisioned CAPI clusters. Most often, this will be used to install CNI which CAPI does not install. Without this controller, newly provisioned clusters would not be ready to be used by end users. Because it also references the CAPI CRD, it requires CAPI tooling to be installed first.
Defines the CRD for declaring leaf clusters. A leaf cluster is a cluster that the management cluster can query via a kubeconfig. This controller ensures that kubeconfig secrets have been supplied for leaf clusters. Because it also references the CAPI CRD, it requires CAPI tooling to be installed first.
39
+
- event-writer **Soon to be deprecated**
40
+
41
+
Subscribes to a NATS queue and listens for messages sent by the wkp-agent. These messages carry cluster information about leaf clusters which is then written to a file-based SQLite db.
42
+
- wkp-agent **Soon to be deprecated**
43
+
44
+
Agent installed by end users to management cluster and leaf clusters with the purpose of reporting back cluster information to management cluster.
45
+
46
+
As part of the chart, other dependencies also get installed:
47
+
- NATS **Soon to be deprecated**
48
+
49
+
Agents running on the management cluster or on leaf clusters send events to a NATS queue. event-writer receives these events from the queue and does its thing.
50
+
5
51
## One-time setup
6
52
You need a github Personal Access Token to build the service. This
7
53
token needs at least the `repo` and `read:packages`
@@ -21,18 +67,129 @@ Finally, make sure you can access https://github.com/weaveworks/weave-gitops-ent
21
67
22
68
## Building the project
23
69
24
-
25
-
To build all binaries and containers use the following command:
70
+
To build all containers use the following command:
26
71
27
72
```bash
28
73
# Builds everything - make sure you exported GITHUB_TOKEN as shown in
29
74
# the one-time setup
30
75
make GITHUB_BUILD_TOKEN=${GITHUB_TOKEN}
76
+
```
77
+
78
+
79
+
## Common dev workflows
80
+
The following sections suggest some common dev workflows.
81
+
82
+
### How to do local dev on the API
83
+
84
+
Most of the code for the API is under `./cmd/clusters-service`. There's a Makefile in that directory with some helpful targets so when working on the API make sure to run these from that location instead of root. The following commands assume execution from `./cmd/clusters-service`.
85
+
86
+
To install gRPC tooling run:
87
+
```sh
88
+
make install
89
+
```
90
+
91
+
The API endpoints are defined as gRPC definitions in `./cmd/clusters-service/api/capi_server.proto`. Therefore if you need to add or update an endpoint you need to first define it in there. For example the following endpoint is used to return the version of WGE.
31
92
32
-
# Builds just the binaries
33
-
make binaries
93
+
```proto
94
+
// GetEnterpriseVersion returns the WeGO Enterprise version
The --insecure flag is needed because the service will generate self-signed untrusted certificates by default.
116
+
117
+
To run all unit tests before pushing run:
118
+
```sh
119
+
make unit-tests
34
120
```
35
121
122
+
To run all tests, including integration tests run:
123
+
```sh
124
+
make test
125
+
```
126
+
127
+
### How to do local dev on the controllers
128
+
When working on controllers it's often easier to run them locally against kind clusters to avoid causing issues on shared clusters (i.e. demo-01) that may be used by other engineers. To install the CRDs on your local kind cluster run:
129
+
130
+
```sh
131
+
make install
132
+
```
133
+
134
+
To run the controller locally run:
135
+
```sh
136
+
make run
137
+
```
138
+
139
+
To run all tests before pushing run:
140
+
```sh
141
+
make test
142
+
```
143
+
144
+
### How to install everything from your working branch on a cluster
145
+
When you push your changes to a remote branch (even before creating a PR for it), CI will kick off a build that runs a quick suite of tests and then builds your containers and creates a new Helm chart tagged with the most recent commit. This Helm chart includes all the changes from your branch and can be used to deploy WGE as a whole to a cluster.
146
+
147
+
1. Find the version of the Helm chart you need to deploy:
148
+
```sh
149
+
# Add the Helm repo locally (needs to happen only once)
- **tilt files** for faster feedback loops when interactively developing kubernetes services.
@@ -144,20 +301,20 @@ yarn start
144
301
145
302
Open up http://localhost:3000. Changes to code will be hot-reloaded.
146
303
147
-
### UI against a local clusters-service
304
+
### How to do local dev on the UI
148
305
149
-
When you need to develop the UI against new features that haven't made to the test cluster yet you can run your own clusters-service locally and point the UI dev server at it with:
306
+
The easiest way to dev on the UI is to use an existing cluster. [demo-01](https://demo-01.wge.dev.weave.works/) is kept automatically up to date with every change that lands on main. To use it run the following command:
The username/password used to login are stored in [1Password](https://start.1password.com/open/i?a=ALD7KP6DEJGYREYHXRNYI3F7KY&v=xdzphlycic6bzwggrot2y73jaa&i=jz6ytgxay7ktq5vg6w2wlu3m2i&h=weaveworks.1password.com).
156
313
157
-
If you need to use a remote server, set the `CAPI_SERVER_HOST` env var to the server's address before running `yarn start`:
314
+
If you need to develop the UI against new features that haven't made to the test cluster yet, you can run your own clusters-service locally and point the UI dev server at it with:
0 commit comments