#!/usr/bin/env bash # # Turn the repo's config inputs into the ConfigMaps the Helm chart mounts. # # This is the Kubernetes sibling of infra/seed-config.sh: the upstream Common # Ground images are used verbatim and read their config from a mounted directory, # so the config has to be handed to the platform out-of-band. Compose gets it via # `docker cp` into external volumes; Kubernetes gets it as ConfigMaps created from # the files that already live in this repo. Copying those files into the chart # would fork them from the compose stack, so we don't. # # Idempotent: re-run after editing any data.yaml, then `make k8s-reseed`. # # Usage: seed-configmaps.sh [namespace] (default: big) set -euo pipefail ns="${1:-big}" here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" repo="$(cd "$here/../.." && pwd)" kubectl get namespace "$ns" >/dev/null 2>&1 || kubectl create namespace "$ns" seed() { # name local name="$1"; shift kubectl create configmap "$name" -n "$ns" "$@" \ --dry-run=client -o yaml | kubectl apply -f - >/dev/null echo " seeded configmap/$name" } seed rr-oz-config --from-file="$repo/infra/openzaak/setup_configuration/" seed rr-nrc-config --from-file="$repo/infra/opennotificaties/setup_configuration/" seed rr-kc-realms --from-file="$repo/infra/keycloak/realms/" seed rr-objecttypen-config --from-file="$repo/infra/objecttypen/setup_configuration/" seed rr-objecten-config --from-file="$repo/infra/objecten/setup_configuration/" # register.py + the RegisterRecord JSON schema (the __pycache__ dir is skipped: # kubectl only takes regular files from a --from-file directory). seed rr-registerrecord-config --from-file="$repo/infra/objecttypen-registerrecord/" # The BPMN and the DMN are two separate Flowable deployments (S-13, ADR-0016). seed rr-fl-bpmn \ --from-file="$repo/workflows/registratie.bpmn" \ --from-file="$repo/workflows/diploma-eligibility.dmn" # The two bootstrap scripts the compose local stack runs as init containers # (S-B04, ADR-0020). Stdlib-only, so a plain python image can run them. seed rr-seed-scripts \ --from-file="$repo/infra/openzaak/seed_catalogus.py" \ --from-file="$repo/infra/local/register-abonnement.py"