Files
ngrok-operator/docs/developer-guide/README.md
T
Jonathan Stacks 51e627c624 chore(devenv): Move more tools into our nix devenv (#726)
* chore(deps): Use controller-gen from nixpkgs

This also updates the version of controller-gen we are using to v0.19.0 and removes it from needing to be bootstrapped

Signed-off-by: Jonathan Stacks <jonstacks@users.noreply.github.com>

* chore(deps): Use helm & unittest plugin from nixpkgs

Signed-off-by: Jonathan Stacks <jonstacks@users.noreply.github.com>

* chore(deps): Move setup-envtest into nix

Signed-off-by: Jonathan Stacks <jonstacks@users.noreply.github.com>

* chore(actions): Update actions & checkout version

---------

Signed-off-by: Jonathan Stacks <jonstacks@users.noreply.github.com>
2025-12-11 17:36:14 +00:00

5.7 KiB

Developer Guide

While this project is new and we don't have full contribution guidelines yet, we are open to any PRs and or issues raised. Feel free to reach out to us on slack as well!

In the weeds architecture

Have a look at the architecture guide on the internal workings of the ingress controller here

Local Development

Codespaces

The ngrok-operator project includes a devcontainer configuration for GitHub Codespaces. The goal is to make contributing as easy as possible and to codify our development environment. If you open the repository in a codespace, all of the necessary tools will be pre-installed and available.

Set up Codespaces Secrets

The following environment variable secrets are required to develop and test the ngrok-operator in Codespaces:

  • NGROK_API_KEY
  • NGROK_AUTHTOKEN

You can create a ngrok API key in the ngrok Dashboard here. You can find your ngrok auth token here.

Follow this guide to add these secrets to your GitHub Account and allow them to be used with this repo.

When you are done, your Codespaces Settings should look something like this:

Codespaces Settings

Make sure that the ngrok-operator repository, or your fork of it, is selected in the Visible Repositories list.

Start a Codespace

Once you've set up your Codespaces secrets, you can create a new Codespace for the repository by clicking the following button:

Open in GitHub Codespaces

This should open a new Codespace with all the necessary tools installed and print a welcome message in the terminal explaining how to get started.

Issues

If you run into any issues with the Codespace setup, please open an issue in the repository using the devenv template so we can address it.

Non-Codespaces

Prerequisites

If you are using nix with direnv, or running with nix develop, you can skip installing these tools manually as this is the same setup we use in our codespaces devcontainer.

If you prefer declarative environments, the repository includes a .envrc that works with nix-direnv; run direnv allow after installing it and the tooling above will be provided automatically.

Create a local kind cluster

By default we create a cluster named ngrok-operator and our CI and Makefiles are configured to load images into this specific cluster.

make kind-create

This installs kind (if necessary) and provisions the cluster. Use make kind-delete to tear it down and make kind-logs to collect diagnostic bundles.

NOTE: kind create cluster requires Docker to be running. If you prefer a different Kubernetes distribution (e.g. minikube), ensure your kubectl context points at it and that locally-built images are visible to the cluster before deploying.

Setup

export NGROK_API_KEY=<YOUR Secret API KEY>
export NGROK_AUTHTOKEN=<YOUR Secret Auth Token>
# kubectl can connect to your cluster and images built locally are available to the cluster
kubectl create namespace ngrok-operator
kubectl config set-context --current --namespace=ngrok-operator

make deploy

Note: make deploy* loads the freshly built controller image into your kind cluster and sets a redeployTimestamp pod annotation each run, so Docker must be running locally and the controller pods always pick up the new image.

Using the E2E Fixtures

Several examples are provided in the e2e-fixtures folder. To use an example, make a copy of the included EXAMPLE*config.yaml in the same directory, like this:

  • cp e2e-fixtures/hello-world-ingress/EXAMPLE-config.yaml e2e-fixtures/hello-world-ingress/config.yaml
  • cp e2e-fixtures/ingress-class/EXAMPLE-config-different.yaml e2e-fixtures/ingress-class/config-different.yaml

Then, you need to update the value field in that new file.

You can then apply the given example via kubectl apply -k e2e-fixtures/<example in question>, i.e. kubectl apply -k e2e-fixtures/hello-world-ingress.

E2E Tests

If you run the script ./scripts/e2e.sh it will run the e2e tests against your current kubectl context. These tests tear down any existing ingress controller and examples, re-installs them, and then runs the tests. It creates a set of different ingresses and verifies that they all behave as expected

Releasing

Please see the release guide for more information on how to release a new version of the ingress controller.