Development

February 4, 2025 ยท View on GitHub

Getting started locally is pretty easy. You can execute:

make e2e-build

This installs all required operators an installs the operator within a KinD Cluster. The required binaries are also downloaded.

If you wish to test against a specific Kubernetes version, you can pass that via variable:

KIND_K8S_VERSION="v1.31.0" make e2e-build

When you want to quickly develop, you can scale down the operator within the cluster:

kubectl scale deploy sops-operator --replicas=0 -n sops-operator

And then execute the binary:

go run cmd/main.go -zap-log-level=10

You might need to first export the Kubeconfig for the cluster (If you are using multiple clusters at the same time):

bin/kind get kubeconfig --name sops-operator  > /tmp/sops-operator
export KUBECONFIG="/tmp/sops-operator"

Testing

When you are done with the development run the following commands.

For Liniting

make golint

For Unit-Testing

make test

For Unit-Testing (Use clean KinD Cluster):

make e2e-exec

Helm Chart

When making changes to the Helm-Chart, Update the documentation by running:

make helm-docs

Linting and Testing the chart:

make helm-lint
make helm-test

Performance

Use PProf for profiling:

curl -s "http://127.0.0.1:8082/debug/pprof/profile" > ./cpu-profile.out

go tool pprof -http=:8080 ./cpu-profile.out