2024-03-13 22:28:50 +01:00
# Contributing
Thank you for considering contributing to Spegel, hopefully this document will make this process easier.
## Running tests
The following tools are required to run the tests properly.
* go
2025-04-25 16:36:17 +02:00
* [golangci-lint ](https://github.com/golangci/golangci-lint )
* [kind ](https://github.com/kubernetes-sigs/kind )
* [goreleaser ](https://github.com/goreleaser/goreleaser )
* [docker ](https://docs.docker.com/get-started/get-docker/ )
* [helm ](https://github.com/helm/helm )
* [kubectl ](https://kubernetes.io/docs/tasks/tools/#kubectl )
2024-03-13 22:28:50 +01:00
Run the linter and the unit tests to quickly validate changes.
```shell
make lint test
```
Run the e2e tests which take a bit more time.
```shell
2025-01-16 13:45:52 +01:00
make test-e2e
2024-03-13 22:28:50 +01:00
```
There are e2e tests for the different CNIs iptables, iptables-v6, and ipvs.
```shell
2025-01-16 13:45:52 +01:00
make test-e2e E2E_CNI=ipvs
2024-03-13 22:28:50 +01:00
```
## Building
Build the Docker image locally.
```shell
2025-04-25 16:36:17 +02:00
make build-image
2024-03-13 22:28:50 +01:00
```
It is possible to specify a different image name and tag.
```shell
2025-04-25 16:36:17 +02:00
make build-image IMG=example.com/spegel TAG=feature
2024-03-13 22:28:50 +01:00
```
2025-04-25 16:36:17 +02:00
### Local debugging
2024-05-02 22:47:10 +02:00
2025-04-25 16:36:17 +02:00
Run the `dev-deploy` recipe which will create a Kind cluster with the proper configuration and deploy Spegel into it. If you run this command a second time the cluster will be kept but Spegel will be updated.
2024-05-02 22:47:10 +02:00
```shell
2025-03-19 20:09:41 +01:00
make dev-deploy
2024-05-02 22:47:10 +02:00
```
2025-04-25 16:36:17 +02:00
After the command has run you can get a kubeconfig file to access the cluster and do any debugging.
```shell
kind get kubeconfig --name spegel-dev > kubeconfig
export KUBECOONFIG=$(pwd)/kubeconfig
kubectl -n spegel get pods
```
2024-05-02 22:47:10 +02:00
2025-04-25 16:36:17 +02:00
## Generate Helm documentation
2024-03-13 22:28:50 +01:00
Changes to the Helm chart values will require the documentation to be regenerated.
```shell
make helm-docs
```
## Acceptance policy
Pull requests need to fulfill the following requirements to be accepted.
* New code has tests where applicable.
* The change has been added to the [changelog ](./CHANGELOG.md ).
* Documentation has been generated if applicable.
* The unit tests pass.
* Linter does not report any errors.
* All end to end tests pass.