-
Notifications
You must be signed in to change notification settings - Fork 9
Helm output #5807
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Helm output #5807
Conversation
Add a CI workflow that generates and validates helm template output, similar to the existing DB schema dump workflow. The workflow: - Triggers on changes to kubernetes/loculus/** files - Generates helm template output for three configurations: * Default values.yaml * E2E/dev values (values.yaml + values_e2e_and_dev.yaml) * Preview server values (values.yaml + values_preview_server.yaml) - Outputs rendered manifests to kubernetes/loculus/docs/rendered/ - Detects changes and requires 'update_helm_output' label on PR - Auto-commits changes when label is present This helps reviewers understand how helm chart changes affect the final rendered Kubernetes manifests.
… diffs Add sed commands to remove timestamp values from helm template output, replacing them with empty strings. This ensures the generated output files are deterministic and don't change on every run due to timestamps. The sed command replaces any value matching the pattern: timestamp: "2025-11-24 09:54:08.569904811 +0000 UTC m=+0.838587464" With: timestamp: "" This makes it easier to review meaningful changes in PRs without timestamp noise.
Instead of generating monolithic helm-output.yaml files, now split the output into separate files based on the "# Source:" markers that helm template generates. Changes: - Add .github/scripts/split-helm-output.sh script to parse and split helm template output by source template - Update workflow to generate output into subdirectories: * kubernetes/loculus/docs/rendered/default/ * kubernetes/loculus/docs/rendered/e2e-dev/ * kubernetes/loculus/docs/rendered/preview-server/ - Each template (e.g., loculus-backend.yaml, secrets.yaml) gets its own file containing all resources from that template - Update README.md to document the new directory structure Benefits: - Easier to review changes to specific components - More focused and readable diffs - Quickly see which templates are affected by changes - Better organization for documentation The split script: - Parses "# Source: loculus/templates/foo.yaml" comments - Extracts the template name and creates corresponding output file - Handles subdirectories in templates - Preserves the Source comments for reference - Groups multiple resources from the same template together
Refactor the helm template output workflow to use GitHub Actions matrix strategy, making it more maintainable and DRY. Changes: - Split workflow into two jobs: 1. `generate-helm-output`: Uses matrix to generate 3 configs in parallel 2. `commit-changes`: Downloads artifacts and commits all changes together - Matrix configuration includes: * default: values.yaml only * e2e-dev: values.yaml + values_e2e_and_dev.yaml * preview-server: values.yaml + values_preview_server.yaml - Each matrix job generates output, uploads as artifact - Commit job downloads all artifacts, reorganizes them, and commits Benefits: - Eliminates code duplication (DRY principle) - Easier to add new configurations - Parallel execution of helm template generation - Cleaner, more maintainable workflow structure
Fix artifact reorganization to prevent double-nested directories like: kubernetes/loculus/docs/rendered/e2e-dev/helm-output-e2e-dev/ Changes: - Download artifacts to /tmp/helm-artifacts/ instead of directly to the rendered directory - Clear existing rendered output directories before reorganizing - Explicitly move artifact contents to the correct final locations This ensures the final structure is: kubernetes/loculus/docs/rendered/ ├── default/ │ ├── ingest-config.yaml │ └── ... ├── e2e-dev/ └── preview-server/ Instead of the buggy double-nested structure.
Fix non-deterministic ordering of organisms in helm template output by sorting organism keys alphabetically. Changes: - Add new helper template `loculus.sortedOrganismKeys` that returns organism keys sorted alphabetically for deterministic iteration - Update lapis-ingress.yaml to use sorted organism keys when building the traefik middleware annotation list This ensures that the middleware annotation: traefik.ingress.kubernetes.io/router.middlewares always lists organisms in the same order (alphabetically), making the rendered helm output deterministic across CI runs. Previously, the order was non-deterministic due to Go map iteration order, causing unnecessary diffs in the CI-generated documentation even when nothing had actually changed. Fixes non-deterministic organism ordering issue in helm template output.
Fix helm template error: "Cannot find first on type map" by using direct inline sorting instead of a helper that serializes/deserializes. Changes: - Revert the sortedOrganismKeys helper that was causing type issues - Use inline `keys ... | sortAlpha` directly in lapis-ingress.yaml - This ensures $organismKeys is a proper list that works with first() The issue was that template helpers can only return strings, and the JSON serialization/deserialization was causing type confusion for the `first` function, even though iteration worked fine. This simpler approach directly creates a sorted list of keys without serialization, which works correctly with all Go template functions including first, range, etc.
Add a Python script to format embedded JSON content in YAML files with proper indentation for better readability. The CI workflow now runs this script after splitting helm template output, making config files like backend_config.json much easier to review in PRs. Changes: - Add .github/scripts/format-json-in-yaml.py to format JSON in YAML files - Update helm-template-output.yml to run the formatter after splitting - Update existing rendered output with nicely formatted JSON
…N output Update helm templates to use toPrettyJson instead of toJson for ConfigMap files that contain JSON configuration. This produces nicely formatted JSON with proper indentation, making config files much easier to review in PRs. Templates updated: - loculus-backend-config.yaml (backend_config.json) - loculus-website-config.yaml (website_config.json) - lapis-silo-database-config.yaml (reference_genomes.json) Removed the Python post-processing script as the formatting is now done directly by Helm.
Code Review for Helm Template Output GenerationOverviewThis PR introduces automated generation and documentation of Helm template outputs across different configurations. The implementation follows a similar pattern to the existing ✅ Strengths
🔍 Issues & Concerns1. Missing Preview Server Output (High Priority)The workflow matrix includes Expected: Files in all three directories (default, e2e-dev, preview-server) Questions:
2. Shell Script Security & Best Practices (
|
resolves #
Screenshot
PR Checklist
🚀 Preview: Add
previewlabel to enable