Repository navigation
Closed
Labels
priority: highHigh prioritytype: bugSomething isn't workingtype: deliveryRelated to packaging, deployment etc.type: securityRelated to securityworkload: daysLikely takes days to resolve
Description
Why?
The Helm chart (deployment/) fills the app's config in a way that is fragile, partly broken and over-privileged:
templates/cloud-registry-configmap-job.yamlcreates a placeholder ConfigMapapp-configand a Job that runsupdate-config-map.sh. The script rewrites the config baked into the image with yq, patches the ConfigMap through the Kubernetes API, and then deletes the app pods to restart them.- Bug: the script sets
.endpoints.service.*instead of.custom.endpoints.service.*. FOCA silently accepts the unknown top-level key, sohost_nameis never applied: the service-info URL stayshttps://0.0.0.0:8080/. Only.db.hostis applied. - Security: the Job's ServiceAccount is bound to the
adminClusterRole in the namespace (read and write access to everything there, including Secrets), only to patch one ConfigMap. - Lifecycle: app pods can start before the Job has filled the ConfigMap (crash loop until the Job deletes them).
helm upgraderesets the ConfigMap to the placeholder, and the completed Job (immutable spec) does not run again cleanly. - The ConfigMap is mounted with
subPathover/app/cloud_registry/config.yaml, so it shadows the whole file and never updates. - Only
host_namecan be set through values. Everything else (auth audience, service-info organization and environment, log level, access-control group mapping) needs a new image. - The Dockerfile installs curl, jq and yq (and switches to
USER root) only for this script.
How?
Use FOCA's config overlays (FOCA_CONFIG_OVERLAY, FOCA ≥ 0.14, so after the FOCA 0.14 upgrade, #65):
- Keep
cloud_registry/config.yamlas the complete base config that runs as-is withdocker compose up, and mark in comments which keys deployments typically override. - Replace the Job with a plain Helm template,
templates/cloud-registry-configmap.yaml, whose data keyoverlay.yamlis themergeOverwriteof:- an overlay generated from existing values:
custom.endpoints.service.url_prefix/external_host/external_portfromhost_nameand the ingress TLS setting; - a new free-form
config:value (default{}), so admins can override any key and their values win.
- an overlay generated from existing values:
- In
templates/cloud-registry-deploy.yaml, mount the ConfigMap as a directory (e.g./etc/cloud-registry/), setFOCA_CONFIG_OVERLAY=/etc/cloud-registry/overlay.yaml, and add achecksum/configpod annotation so thathelm upgraderolls the pods when the config changes. - Delete
templates/cloud-registry-configmap-job.yaml(ConfigMap placeholder, Job, ServiceAccount, RoleBinding) andupdate-config-map.sh, and drop the curl/jq/yq installation and theUSER rootstep from the Dockerfile. values.yaml: addconfig: {}with commented examples (security.auth.audience,custom.endpoints.service_infofields,loglevel,security.access_control.group_mapping). Bump the chart version.- Docs:
deployment/README.md: keep a per-deployment values file outside this repo (e.g. in the deployment's own infrastructure repo), apply changes withhelm upgrade -f values-prod.yaml, and do notkubectl editthe ConfigMap (Helm overwrites it).- Main README: fix the
deployments/typo; the host and port of the app are set inconfig.yaml, not indocker-compose.yaml; add a short "Configuration" section on base config vs overlay. - Local development: optional gitignored
compose.override.yaml+config.local.yamlwithFOCA_CONFIG_OVERLAY, the same mechanism as on Kubernetes.
- Tests:
helm lintandhelm templatewith a test values file in CI, plus a pytest that loads the base config with a sample overlay and checks thatcustom.endpoints.service.external_hostis taken from the overlay.
A shared FOCA Helm library chart is proposed in elixir-cloud-aai/foca#312. This issue can be done first and moved to the library later.
Acceptance criteria
- No Job, ServiceAccount or RoleBinding is needed to configure the app;
update-config-map.shand the extra Dockerfile tools are gone. - With
host_name: registry.example.org,GET /ga4gh/registry/v1/service-inforeportshttps://registry.example.org:443/. - Any config key can be overridden through
config:in a values file, andhelm upgradewith a changed value rolls the pods and the new value takes effect. -
docker compose upworks unchanged with the base config. - Chart is linted and rendered in CI; deployment docs updated.
Metadata
Metadata
Assignees
Labels
priority: highHigh prioritytype: bugSomething isn't workingtype: deliveryRelated to packaging, deployment etc.type: securityRelated to securityworkload: daysLikely takes days to resolve
Activity
build: fix packaging and bump dev dependencies (#84)
uniqueg commentedon Oct 20, 2026
Follow-ups from the Sourcery review of #65 (FOCA 0.14):
deployment/values.yaml, currentlyelixircloud/cloud-registry:20240716) to the first image published with FOCA 0.14 once feat!: upgrade to FOCA 0.14.0 #65 is merged.security.auth.audience, the client IDs of the apps calling the registry) and dropverify_audience: Falsein deployments, so that LS Login tokens issued to other clients are rejected.uniqueg commentedon Oct 20, 2026
Follow-up from #95: the configmap Job (
deployment/templates/cloud-registry-configmap-job.yaml) is a plainbatch/v1Job. Helm resets theapp-configConfigMap to its# Emptyplaceholder on everyhelm upgrade(three-way merge against the data patched in byupdate-config-map.sh), and cannot update the Job when the image changes (immutable pod template). #95 documents a manual procedure (delete the Job, upgrade, wait). Proposal for the Helm config rework: render the config with Helm (values → ConfigMap) instead of patching it from a Job, or at least run the Job as apost-install,post-upgradehook withbefore-hook-creationdelete policy, and roll the Deployment on config changes (checksum annotation).uniqueg commentedon Oct 20, 2026
Also from the review of #95:
update-config-map.shdoes not check the result of the ConfigMap PATCH, so the Job succeeds (and deletes the app pods) even if the config was not written. The rework should fail the Job on errors (e.g.curl --fail,set -euo pipefail) or, better, render the config with Helm.