Preview environments
A pull request gets its own Fundament deployment on digikluster at
https://<service>.pr<N>.preview.fundament.digilab.reviews. The PR comment “PR Environment”
lists the URLs and the test users.
Which pull requests get one
Section titled “Which pull requests get one”Gets a preview
- An open pull request from a branch in this repository, a few minutes after
publish-chartfinishes.
Gets no preview
- A draft. Mark it ready for review to get one.
- A pull request labelled
no-preview-env. Remove the label to get one. - A pull request from a fork. Its CI runs without write access, so it cannot publish the images and chart a preview installs, and code from outside never reaches the cluster unreviewed. To preview a fork’s change, a maintainer reviews it and pushes it to a branch in this repository.
- A closed or merged pull request. Its preview is removed within a minute.
A pull request has a preview exactly while it carries the label flux-preview, which CI adds
and removes.
What it runs
Section titled “What it runs”- The chart this PR built:
publish-chartpushesoci://ghcr.io/fundament-oss/fundament/charts-pr/fundament:0.1.0-pr<N>.<run>with every image pinned by digest. The preview follows the newest build of the PR. values.yamlandvalues-sandbox.yamlfrom that chart, plus the PR’s hostnames.- The database is reset and refilled with test data on every push.
e2e-testsandterraform-acc-testsrun against the preview once/versiononorganization.pr<N>…reports the chart version.
Adding a service
Section titled “Adding a service”- Add the image to the
buildmatrix in.github/workflows/build.ymland toimages:invalues.yaml.publish-chartfails for an image inimages:that has no build. - Add the chart templates: Deployment, Service, and
<service>-httproute.yamlif it is reachable from outside. - Set
enabled: truefor it invalues-sandbox.yamlso previews run it. - Outside this repository: the preview’s hostnames live in the platform repository
flux/core, intenants/digikluster/fundament-preview/resourceset.yaml. The new service’shttproute(enabled,parentRefs,hostnames), itsexternalUrlsentry and, if browsers call it cross-origin,corsAllowedOriginsgo there. Ask the platform team; until that change is merged the service runs in the preview without a URL. - The preview is namespace admin: Kubernetes’ built-in
adminrole, plus HTTPRoutes, GRPCRoutes, CNPG clusters and ServiceMonitors. So NetworkPolicies, roles and the usual workload kinds ship with the chart. The platform team is needed for other CRDs, cluster-scoped objects, privileged pods (the namespace enforces pod securitybaseline), and for ResourceQuota, LimitRange, Endpoints and EndpointSlices, which stay read-only.
TODO: derive every hostname, URL and route from one
domainvalue in the chart, so step 4 disappears and a new service needs no change outside this repository. Tracked in digilab.overheid.nl/miscellaneous/issues#1157.
Debugging
Section titled “Debugging”With a digikluster kubeconfig (see the team’s deployment and infra docs):
export NS=tn-fundament-preview-<N>kubectl -n $NS get helmrelease,helmchart,podskubectl -n $NS describe helmrelease fundamentkubectl -n $NS get events --sort-by=.lastTimestampkubectl -n $NS logs deploy/organization-apihelmchartnot ready:publish-charthas not pushed a chart for this PR yet.- Namespace missing: check the PR carries
flux-preview, thenkubectl -n tn-fundament-preview get resourcesetinputprovider fundament-pull-requests -o jsonpath='{.status.exportedInputs}'. - Migrations run as Job
db-migrations-<helm-revision>; OpenFGA’s store and model asopenfga-bootstrap-<helm-revision>.