This project uses Kubebuilder to implement a Kubernetes operator that manages access to databases for different applications.
First make sure you have Kubebuilder installed on your machine. Follow the instructions on the Kubebuilder website to set it up.
If you're running Windows use WSL.
First install the operator with the following command:
make installEvery tagged release publishes an install.yaml asset that references the prebuilt image on GHCR.
kubectl apply -f https://github.com/<org>/<repo>/releases/download/<tag>/install.yamlIf you wish to install the operator via its yaml you can find it in config/crd/bases/access.k8s.delta10.nl_postgresaccesses.yaml
Then run it:
make runBy default, PostgresAccess.spec.connection.existingSecret is resolved in the same namespace as the PostgresAccess resource.
To allow cross-namespace references, create exactly one Controller resource and set:
spec.settings.existingSecretNamespace=true
If there are zero Controller resources, the safe default is false.
If there are multiple Controller resources, cross-namespace lookups fail with MultipleControllersFound.
When using the docker compose you can use a simple sample config with:
kubectl apply -f config/samples/access_v1_postgresaccess.yamlOfcourse you can also use act to run the whole pipeline locally in Docker but preformance isn't great.
make testfor e2e tests, you can use: Make sure you have kind installed and running, then you can run the e2e tests with:
make test-e2eThough beware it'll consume quite a bit of memory, within WSL2 it consumed 9gb during the test run.
if you don't have a database running locally you can use docker compose to start a postgres database:
docker compose up -dInstall golangci-lint first, then you can run the linter with:
golangci-lint runformatting issues can be fixed with:
golangci-lint fmt