Skip to content

feat(helm)!: configure app via config overlays - #98

Merged
uniqueg merged 3 commits into
devfrom
feat/helm-config
Oct 20, 2026
Merged

uniqueg merged 3 commits into
devfrom
feat/helm-config

Conversation

@uniqueg

@uniqueg uniqueg commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Summary

Configures the app through Helm values and a FOCA config overlay instead of a Job that patches a ConfigMap (#67).

  • Config overlay: templates/cloud-registry-configmap.yaml renders <appName>-config with overlay.yaml. It is the merge of:
    • the public URL generated from host_name (https://<host_name>:443, as the old Job intended);
    • the new free-form config value, which takes precedence.
      The Deployment mounts it at /etc/cloud-registry/, sets FOCA_CONFIG_OVERLAY, and rolls on config changes (checksum/config annotation).
  • Removed: the config Job, its placeholder ConfigMap app-config, its ServiceAccount, and its RoleBinding to the namespace admin ClusterRole. Also removed: update-config-map.sh, the apiServer value, and curl, jq and yq plus the extra root steps in the image.
  • Fixes the public URL: the Job set .endpoints.service instead of .custom.endpoints.service, so host_name never took effect.
  • Image: installs the package non-editably (the base config now comes from the installed package).
  • Values:
    • host_name is required;
    • values.schema.json checks the types of host_name and config;
    • values.yaml has commented config examples (audience, logging, service info);
    • chart version is 3.0.0;
    • the default image is elixircloud/cloud-registry:20261020, the first published images with FOCA 0.14 (push of dev verified).
  • Docs:
    • deployment/README.md: configuration, installation and upgrades, a per-deployment values file outside the repo, no kubectl edit, no secrets in config, and that the chart needs a FOCA ≥ 0.14 image;
    • README: a new "Configuration" section (base config and overlays, a local Compose override), the deployment/ typo fixed, and a corrected note on host and port.
  • Tests:
    • tests/test_config.py: overlay merging (recursive, lists replaced, several overlays, missing file);
    • chart tests with helm template: the generated URL, precedence of config, the host_name requirement, the schema, and the Deployment mount and env matching the ConfigMap.
    • New CI job "Check Helm chart" runs helm lint --strict and the chart tests.

Closes #67

Breaking changes

  • Chart 3.0.0:
    • no longer creates app-config, the config Job, its ServiceAccount or RoleBinding (Helm removes them on upgrade);
    • drops apiServer;
    • requires host_name.
      Config changes made to app-config must move to config in the values file.
  • Image: the app's source is no longer in /app; the app is installed as a package.

Deviations from the issue

  • Public URL scheme: always HTTPS on port 443, as the old Job did, rather than derived from the ingress TLS setting. TLS is often terminated outside the chart (e.g., the OpenShift Route or a proxy), and the acceptance criterion expects https://registry.example.org:443/. It can be overridden via config.custom.endpoints.service.
  • Not included here:

Verification

  • pytest (with Helm 3.18.6 on PATH): 93 passed.
  • ruff check, ruff format --check, mypy cloud_registry tests: clean.
  • helm lint --strict -f deployment/ci/test-values.yaml: passes.
  • Built wheel contains all modules, config.yaml and the specs.
  • gitleaks dir .: no leaks.
  • Two rounds of adversarial and quality review. Fixed findings: host_name required, FOCA ≥ 0.14 note, keys the chart expects unchanged, the values schema, and overlay checks as pytest instead of inline CI script.
  • CI: all checks pass; the "Check Helm chart" job ran the 9 chart and overlay tests with Helm 3.22 (none skipped).

Open questions

None.

🤖 Generated with Claude Code

Summary by Sourcery

Move application configuration from a post-installation patching Job to Helm-managed FOCA overlays and update the chart, image, documentation, and validation for the new deployment model.

New Features:

  • Configure application deployments through Helm values and FOCA config overlays, including generated public URLs and user-defined overrides.

Bug Fixes:

  • Ensure the configured public host is applied to the app's effective service URL.

Enhancements:

  • Replace the runtime ConfigMap-patching Job with a mounted, checksum-tracked configuration overlay.
  • Install the application as a non-editable package with its base configuration included in the image.
  • Require and validate Helm configuration values and document the new installation and upgrade workflow.

Build:

  • Update the Helm chart to version 3.0.0 and refresh the default application image.

CI:

  • Add CI validation for strict Helm linting and chart/config overlay tests.

Deployment:

  • Remove the configuration patching Job and its associated Kubernetes permissions and resources.

Documentation:

  • Document configuration overlays for Helm and Docker Compose, deployment-specific values files, and migration guidance from chart version 2.

Tests:

  • Add coverage for recursive overlay merging, precedence, required values, schema validation, and Deployment-to-ConfigMap wiring.

Chores:

  • Remove obsolete configuration update scripts and the unused Kubernetes API server value.

uniqueg and others added 3 commits October 20, 2026 08:26
Replace the config Job, which rewrote the image's config with yq and
patched a ConfigMap with namespace admin rights, with a ConfigMap
rendered by Helm. It holds a FOCA config overlay (`FOCA_CONFIG_OVERLAY`)
generated from `host_name` (HTTPS on port 443, as before) and merged
with the new free-form `config` value, which takes precedence. The
Deployment mounts it as a directory and rolls on config changes.

This also fixes the public URL: the Job set `.endpoints.service`
instead of `.custom.endpoints.service`, so `host_name` was never used.

Remove `update-config-map.sh` and its tools from the image, and install
the app non-editably. Document configuration via overlays for Helm and
Docker Compose. CI lints and renders the chart and validates the
rendered overlay against the app's config models.

Closes #67

BREAKING CHANGE: the chart (version 3.0.0) no longer creates the
`app-config` ConfigMap, the config Job, its ServiceAccount and
RoleBinding, and drops the `apiServer` value; config changes made to
`app-config` must be moved to `config` in the values file. The image no
longer contains the app's source in `/app`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Test the config overlay rendered by `helm template` with pytest (when
helm is installed, as on GitHub-hosted runners) instead of an inline
script in CI: generated values, precedence of `config`, and recursive
merging of overlays. Require `host_name`, validate the types of
`host_name` and `config` with a values schema, and document that the
chart needs an image with FOCA 0.14 or later, which keys it expects
unchanged, and that `config` must not contain secrets.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Test the values schema, precedence of later overlays, and that the
Deployment mounts the overlay ConfigMap where `FOCA_CONFIG_OVERLAY`
points; share the config parsing helper. Install all CI requirements in
one step and fail the chart tests if helm is missing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Helm chart 3.0.0 now configures the application through a values-driven FOCA overlay mounted by the Deployment, eliminating the privileged patching Job and obsolete RBAC/config resources. The image packages the application and base config directly, while schemas, documentation, rendered-chart tests, and CI validation establish and enforce the new configuration and upgrade contract.

Sequence diagram for config-driven deployment rollout

sequenceDiagram
    actor Operator
    participant Helm
    participant Kubernetes
    participant App

    Operator->>Helm: helm upgrade
    Helm->>Kubernetes: Apply <appName>-config ConfigMap
    Helm->>Kubernetes: Apply Deployment with checksum/config
    Kubernetes->>App: Mount /etc/cloud-registry/overlay.yaml
    Kubernetes->>App: Set FOCA_CONFIG_OVERLAY
    App->>App: Merge base config with overlay
    Kubernetes->>App: Roll pods when checksum changes
Loading

Flow diagram for generated and user-provided configuration

flowchart TD
    Host[host_name] --> Generated[Generated custom.endpoints.service\nHTTPS port 443]
    Config[config values] --> Overlay[overlay.yaml]
    Generated --> Overlay
    Overlay --> Precedence[mergeOverwrite\nconfig takes precedence]
    Precedence --> ConfigMap[Rendered ConfigMap]
    ConfigMap --> FOCA[FOCA startup overlay]
Loading

File-Level Changes

Change Details Files
Replaced the runtime ConfigMap-patching Job with a Helm-rendered FOCA configuration overlay and wired the Deployment to consume it.
  • Generate the public service URL from required host_name, with user-supplied config taking precedence.
  • Mount the overlay ConfigMap, set FOCA_CONFIG_OVERLAY, and trigger pod rollouts using a config checksum.
  • Remove the patching Job, placeholder ConfigMap, RBAC resources, and obsolete apiServer value and script.
deployment/templates/cloud-registry-configmap.yaml
deployment/templates/cloud-registry-deploy.yaml
deployment/templates/cloud-registry-configmap-job.yaml
deployment/values.yaml
deployment/values.schema.json
update-config-map.sh
Changed the container image to run the application as an installed package with its base configuration included in the package.
  • Remove curl, jq, yq, editable source layout, and /app-based configuration mounting.
  • Install the application non-editably so the packaged base config is available at runtime.
Dockerfile
Introduced the Helm 3.0.0 configuration contract and documented installation, upgrades, overlay behavior, and migration from chart 2.
  • Require and type-check host_name and config, update the default image, and provide overlay examples.
  • Document precedence, recursive merging, secret-handling restrictions, FOCA version requirements, and removed resources during upgrade.
  • Add a local Compose overlay example and correct deployment and URL documentation.
deployment/Chart.yaml
deployment/values.yaml
deployment/values.schema.json
deployment/README.md
README.md
Added automated coverage for FOCA overlay semantics and rendered Helm resources, and made chart validation a CI prerequisite for image publishing.
  • Test recursive merges, list replacement, multiple overlays, missing files, URL generation, precedence, schema validation, and Deployment wiring.
  • Run strict Helm lint and chart tests in a dedicated CI job before publishing images.
tests/test_config.py
.github/workflows/checks.yaml
deployment/ci/test-values.yaml

Assessment against linked issues

Issue Objective Addressed Explanation
#67 Replace the privileged Job-based configuration process with a Helm-rendered FOCA overlay that applies the generated public service URL and allows arbitrary configuration overrides, with pod rollouts when configuration changes. ✅
#67 Remove the obsolete configuration Job, RBAC resources, update script, and extra Dockerfile tools while packaging the app so its base configuration works without the old mount-based rewrite. ✅
#67 Update chart values and documentation for overlay-based configuration, and add automated tests and CI checks for the chart and overlay behavior. ✅

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@codecov

codecov Bot commented Oct 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (98d05c6) to head (4c5d338).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev       #98   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            7         7           
  Lines          224       224           
=========================================
  Hits           224       224           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@uniqueg
uniqueg marked this pull request as ready for review October 20, 2026 06:30

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Needs a human reviewer. Upgrading from chart version 2 removes the old app-config ConfigMap, so any hand-edited settings not transferred into the new config values are lost and the app may run with different settings, including authentication settings. The loss is limited to configuration and can be restored if the old values are available, but reverting the chart alone will not recover hand-edited contents.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@uniqueg
uniqueg merged commit 2681f44 into dev Oct 20, 2026
11 checks passed
@uniqueg
uniqueg deleted the feat/helm-config branch October 20, 2026 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Helm chart: configure app via values and FOCA overlays

1 participant