2021-03-01 07:31:02 +00:00
## Getting Started
You must have a working [Go environment ](https://golang.org/doc/install ) and
then clone the repo:
```shell
git clone https://github.com/external-secrets/external-secrets.git
cd external-secrets
```
2022-04-19 18:56:57 +00:00
_Note: many of the `make` commands use [yq ](https://github.com/mikefarah/yq ), version 4.2X.X or higher._
2023-03-16 00:05:03 +00:00
Our helm chart is tested using `helm-unittest` . You will need it to run tests locally if you modify the helm chart. Install it with the following command:
```
$ helm plugin install https://github.com/helm-unittest/helm-unittest
```
2021-03-01 07:31:02 +00:00
## Building & Testing
The project uses the `make` build system. It'll run code generators, tests and
static code analysis.
Building the operator binary and docker image:
```shell
make build
2023-08-28 09:45:27 +00:00
make docker.build IMAGE_NAME=external-secrets IMAGE_TAG=latest
2021-03-01 07:31:02 +00:00
```
2023-08-15 08:05:37 +00:00
Run tests and lint the code:
2021-03-01 07:31:02 +00:00
```shell
make test
2022-06-01 23:38:41 +00:00
make lint # OR
2022-09-06 17:46:36 +00:00
docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.49.0 golangci-lint run
2021-03-01 07:31:02 +00:00
```
Build the documentation:
```shell
make docs
```
2023-12-21 21:58:31 +00:00
## Using Tilt
[Tilt ](https://tilt.dev ) can be used to develop external-secrets. Tilt will hot-reload changes to the code and replace
the running binary in the container using a process manager of its own.
To run tilt, download the utility for your operating system and run `make tilt-up` . This will do two things:
- downloads tilt for the current OS and ARCH under `bin/tilt`
- make manifest files of your current changes and place them under `./bin/deploy/manifests/external-secrets.yaml`
- run tilt with `tilt run`
Hit `space` and you can observe all the pods starting up and track their output in the tilt UI.
2021-03-01 07:31:02 +00:00
## Installing
2021-09-01 10:33:07 +00:00
To install the External Secret Operator into a Kubernetes Cluster run:
2021-03-01 07:31:02 +00:00
```shell
2021-09-01 10:33:07 +00:00
helm repo add external-secrets https://charts.external-secrets.io
helm repo update
helm install external-secrets external-secrets/external-secrets
2021-03-01 07:31:02 +00:00
```
2021-09-01 10:33:07 +00:00
You can alternatively run the controller on your host system for development purposes:
2021-03-01 07:31:02 +00:00
```shell
2021-09-01 10:33:07 +00:00
make crds.install
2021-03-01 07:31:02 +00:00
make run
```
To remove the CRDs run:
```shell
2021-05-14 01:53:40 +00:00
make crds.uninstall
2021-03-01 07:31:02 +00:00
```
2022-11-01 18:09:36 +00:00
If you need to test some other k8s integrations and need the operator to be deployed to the actual cluster while developing, you can use the following workflow:
2021-09-01 10:33:07 +00:00
2023-06-21 09:17:00 +00:00
```shell
# Start a local K8S cluster with KinD
2021-09-01 10:33:07 +00:00
kind create cluster --name external-secrets
2023-06-21 09:17:00 +00:00
export TAG=$(make docker.tag)
export IMAGE=$(make docker.imagename)
2021-09-01 10:33:07 +00:00
2023-06-21 09:17:00 +00:00
# Build docker image
make docker.build
2021-09-01 10:33:07 +00:00
2023-06-21 09:17:00 +00:00
# Load docker image into local kind cluster
2023-08-28 09:46:38 +00:00
kind load docker-image $IMAGE:$TAG --name external-secrets
2022-01-25 11:21:09 +00:00
2023-06-21 09:17:00 +00:00
# (Optional) Pull the image from GitHub Repo to copy into kind
2023-08-15 08:05:37 +00:00
# docker pull ghcr.io/external-secrets/external-secrets:v0.8.2
# kind load docker-image ghcr.io/external-secrets/external-secrets:v0.8.2 -n external-secrets
# export TAG=v0.8.2
2022-01-25 11:21:09 +00:00
2023-06-21 09:17:00 +00:00
# Update helm charts and install to KinD cluster
2021-09-01 10:33:07 +00:00
make helm.generate
2023-06-21 09:17:00 +00:00
helm upgrade --install external-secrets ./deploy/charts/external-secrets/ \
--set image.repository=$IMAGE --set image.tag=$TAG \
--set webhook.image.repository=$IMAGE --set webhook.image.tag=$TAG \
--set certController.image.repository=$IMAGE --set certController.image.tag=$TAG
# Command to delete the cluster when done
# kind delete cluster -n external-secrets
2021-09-01 10:33:07 +00:00
```
2021-03-01 07:31:02 +00:00
!!! note "Contributing Flow"
2022-09-01 07:53:22 +00:00
The HOW TO guide for contributing is at the [Contributing Process ](process.md ) page.
2021-03-01 07:31:02 +00:00
## Documentation
2022-02-01 19:02:13 +00:00
We use [mkdocs material ](https://squidfunk.github.io/mkdocs-material/ ) and [mike ](https://github.com/jimporter/mike ) to generate this
2021-03-01 07:31:02 +00:00
documentation. See `/docs` for the source code and `/hack/api-docs` for the build process.
When writing documentation it is advised to run the mkdocs server with livereload:
```shell
2022-04-18 19:15:39 +00:00
make docs.serve
2021-03-01 07:31:02 +00:00
```
Run the following command to run a complete build. The rendered assets are available under `/site` .
```shell
make docs
2022-04-18 19:15:39 +00:00
make docs.serve
2021-03-01 07:31:02 +00:00
```
2021-05-14 01:53:40 +00:00
Open `http://localhost:8000` in your browser.
2022-02-01 19:02:13 +00:00
Since mike uses a branch to create/update documentation, any docs operation will create a diff on your local `gh-pages` branch.
2022-04-19 18:56:57 +00:00
When finished writing/reviewing the docs, clean up your local docs branch changes with `git branch -D gh-pages`