No description
  • Go 95.9%
  • Just 2.4%
  • Dockerfile 1.7%
Find a file
2026-11-25 09:02:07 +01:00
.dockerignore fundament plugin wip 2026-11-24 16:22:18 +01:00
.gitignore fundament plugin wip 2026-11-24 16:22:18 +01:00
components.go added config for database, service, management and ui's 2026-11-25 09:02:07 +01:00
components_test.go added config for database, service, management and ui's 2026-11-25 09:02:07 +01:00
config.go added config for database, service, management and ui's 2026-11-25 09:02:07 +01:00
config_test.go added config for database, service, management and ui's 2026-11-25 09:02:07 +01:00
definition.yaml added config for database, service, management and ui's 2026-11-25 09:02:07 +01:00
definition_test.go added config for database, service, management and ui's 2026-11-25 09:02:07 +01:00
Dockerfile fundament plugin wip 2026-11-24 16:22:18 +01:00
go.mod added config for database, service, management and ui's 2026-11-25 09:02:07 +01:00
go.sum added config for database, service, management and ui's 2026-11-25 09:02:07 +01:00
helm.go added config for database, service, management and ui's 2026-11-25 09:02:07 +01:00
Justfile fundament plugin wip 2026-11-24 16:22:18 +01:00
LICENSE fundament plugin wip 2026-11-24 16:22:18 +01:00
main.go added config for database, service, management and ui's 2026-11-25 09:02:07 +01:00
mise.toml fundament plugin wip 2026-11-24 16:22:18 +01:00
plugin.go added config for database, service, management and ui's 2026-11-25 09:02:07 +01:00
plugin_test.go added config for database, service, management and ui's 2026-11-25 09:02:07 +01:00
README.md added config for database, service, management and ui's 2026-11-25 09:02:07 +01:00
secrets.go added config for database, service, management and ui's 2026-11-25 09:02:07 +01:00
secrets_test.go added config for database, service, management and ui's 2026-11-25 09:02:07 +01:00

Bezorgdienst (delivery-service plugin)

A Fundament plugin that runs the bezorgdienst of Notificatie voor Burgers. One installation installs five Helm releases from the mijn-betaaloverzicht chart repository into one namespace (NAMESPACE, default digitale-brievenbus), in this order:

Release What it is
delivery-db Postgres (CloudNativePG Cluster) and the schema migrations (post-install hook)
delivery-service data access, internal
delivery-process the logic: adresverklaringen and zendingen, internal
delivery-management-process the overview for the management screen, internal
delivery-management-ui the management screen at /delivery-management; public only with a Gateway

The releases find each other by name (http://delivery-service), so the names are fixed and they share a namespace.

Prerequisites

  • CloudNativePG: install Fundament's cloudnativepg plugin first. The plugin checks for clusters.postgresql.cnpg.io and stays Degraded until it exists.
  • Gateway API, only to publish the management screen (HOSTNAME + GATEWAY_NAME).

Keys and Secrets

The plugin creates these in the namespace, once, and never replaces a value that exists. They are not part of a Helm release, so uninstalling keeps them.

Object Contents
Secret delivery-api-keys DELIVERY_PROCESS_API_KEY, DELIVERY_MANAGEMENT_PROCESS_API_KEY (random)
Secret delivery-process-sleutel DECRYPTION_KEY: the bezorgdienst's X-Wing private key (HPKE PRIVATE KEY PEM)
ConfigMap delivery-process-publieke-sleutel jwks.json: the public key as a JWK Set, kid delivery-process

A new X-Wing key makes every adreskaart unusable, which is why it is kept. The hosters seal adresverklaringen for the public key: give jwks.json to mailbox-host-process as deliveryServiceKeys.

kubectl -n digitale-brievenbus get configmap delivery-process-publieke-sleutel -o jsonpath='{.data.jwks\.json}'

Configuration

Set on the install form (spec.config); every key is in definition.yaml's configSchema and read in config.go, and definition_test.go checks they agree.

Key Default
NAMESPACE digitale-brievenbus where everything runs
TRUSTED_HOSTERS empty JWK Set of trusted hosters (mailbox-host-process); empty trusts no one
TRUSTED_DISPATCHERS empty JWK Set of trusted verzenddiensten (dispatch-process)
DISPATCH_URL http://dispatch-process where undeliverable zendingen go back
HOSTNAME, GATEWAY_NAME, GATEWAY_NAMESPACE, GATEWAY_LISTENER -, -, namespace, https publish the management screen
STORAGE_CLASS, STORAGE_SIZE cluster default, 1Gi the database volume
KEEP_DATA true keep delivery-db on uninstall
CHART_REPOSITORY, CHART_VERSION Forgejo Helm registry, 0.2.0 where the charts come from

Lifecycle

  • Start validates the configuration (invalid: Failed), checks the prerequisites, creates the namespace and Secrets, and runs helm upgrade --install --wait for each release in order. A failure is retried every 30s with the cause in the plugin status (Degraded), rather than crash-looping.
  • Reconcile reports Running while the database cluster is Ready and the four Deployments are Available, Degraded otherwise.
  • Uninstall removes the releases in reverse order; delivery-db only with KEEP_DATA=false. The namespace and Secrets stay.

Helm runs through helm.go rather than the SDK's helper: the trust lists are JSON, which --set cannot carry, and the database's first bootstrap needs a longer --timeout than Helm's 5 minutes.

Layout

Path What it is
definition.yaml the plugin manifest: metadata, RBAC, configSchema
plugin.go lifecycle: install, health, uninstall
components.go the five releases and their values
secrets.go the service keys, the X-Wing key and its public JWK Set
config.go the FUNP_* configuration
helm.go helm upgrade --install with a values file

Develop

Tool versions are pinned in mise.toml. With mise installed, mise install gets Go, just, skaffold and kubectl at the versions this project expects. Recipes live in the Justfile; run just --list to see them all.

go mod tidy      # needs network access, or a warm module cache
just build
just test

Image builds need the docker buildx plugin (with Homebrew and Colima: brew install docker-buildx):

just docker                         # linux/amd64 image, also on an Apple Silicon Mac
PLATFORM=linux/arm64 just docker    # for an arm64 cluster

Hot reload

functl plugin dev runs the plugin in the Fundament plugin sandbox and rebuilds it when you save Go or console/ source, go.mod or go.sum. Changes to definition.yaml need a restart of functl plugin dev. Prerequisites: the sandbox cluster, docker, skaffold, kubectl, and a functl auth login session. Set up the sandbox as described in https://github.com/fundament-oss/fundament/blob/master/docs/developer/plugins/testing-plugins-locally.md.

functl plugin dev                  # deletes the dev installation on Ctrl-C
functl plugin dev --no-cleanup     # keeps it after exit
functl plugin dev-down             # removes a leftover dev installation

Config values for spec.config (the keys in definition.yaml's configSchema) come from --set KEY=VALUE (repeatable) or a --config YAML file; --set wins. functl checks them against the schema before building, including required keys.

functl plugin dev --set MY_KEY=value         # MY_KEY declared in configSchema
functl plugin dev --config dev-config.yaml   # MY_KEY: value

Publish

From this directory, following "Testing plugins locally" in the Fundament docs:

just docker v0.2.0
docker tag delivery-service-plugin:v0.2.0 localhost:5112/delivery-service:v0.2.0
docker push localhost:5112/delivery-service:v0.2.0
functl plugin publish definition.yaml --image=localhost:5112/delivery-service@sha256:<digest from push> --create

Versions are create-only: bump metadata.version to publish changed content.

Docs

https://github.com/fundament-oss/fundament/tree/master/docs/developer/plugins