Repository navigation
chore(chart): follow Helm conventions - #249
Conversation
Test the camelCase values, image and resources blocks, labels, notes, schema and Chart.yaml metadata of #247, and that the deprecated keys and the earlier defaults (tests/data) still render the objects of the chart before the renaming, also as with helm upgrade --reuse-values. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Rename the values to camelCase, with image blocks for the API, taskmaster and filer and a resources block for the API. The old keys still work, take precedence (they are only set by users, and helm upgrade --reuse-values keeps the old defaults) and are listed as deprecated in NOTES.txt. Add the standard labels to the objects' metadata (not to selectors), a permissive values.schema.json and the metadata of Chart.yaml (appVersion: the default tag of tesk-api), and fix the indentation and comments of values and templates. Existing values files render the same objects, apart from the labels. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Update the configuration reference and the deployment guide to the camelCase values, and add upgrade notes with the old and new keys. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Address the review: read the renamed values with one resolver driven by tesk.renamedValues; parse old resource values as YAML as the earlier templates did (an empty limit is dropped, not rendered as ''); default the API's repository for a partial image map with --reuse-values; widen the schema to accept any scalar and a string for maps; mention --reuse-values in the notes. Compare with a copy of the earlier chart (tests/data/legacy-chart) for many values instead of one snapshot. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Document that old keys win even when empty, what the schema checks, the pull policy values, the --reuse-values exceptions, and that appVersion is the tesk-api version, not the release version. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A null old key with --reuse-values, or a null block of new keys, made the resolver assign nil as a command, which failed the rendering. Walk missing maps to null instead, fail on old resource values that aren't valid YAML (as the earlier templates did), and mark those values in tesk.renamedValues instead of matching their prefix. Check that the test lists of renamed keys agree, and document how to remove the deprecated names' tests. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideAPIDefine the new chart values interface and validate its structure while preserving support for deprecated keys.
ImplementationCentralize legacy-value resolution and deprecation reporting, then apply the new values and standard labels when rendering chart resources.
ConfigurationUpdate chart release metadata and pre-commit exclusions for the retained legacy-chart test fixture.
DocumentationUpdate user and developer documentation for the renamed values, migration behavior, chart metadata, and regression-test maintenance.
TestsAdd rendered-chart tests for the new interface, compatibility and precedence, labels, schema, notes, metadata, and reuse-values upgrades, using a preserved copy of the earlier chart as the comparison baseline.
Other changesFiles not grouped.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #249 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 1 1
Lines 229 229
=========================================
Hits 229 229 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Hey - I've found 3 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="charts/tesk/templates/common/tesk-deployment.yaml" line_range="22" />
<code_context>
+{{- $resources := deepCopy (dig "resources" dict $tesk) -}}
+{{- range $old, $path := dict "limitsCpu" (list "limits" "cpu") "limitsMemory" (list "limits" "memory") "requestsCpu" (list "requests" "cpu") "requestsMemory" (list "requests" "memory") -}}
+{{- if hasKey $tesk $old -}}
+{{- if not (kindIs "map" (index $resources (index $path 0))) -}}
+{{- $_ := set $resources (index $path 0) dict -}}
+{{- end -}}
</code_context>
<issue_to_address>
**Null resources block rendering**
When `tesk.resources` is null and a deprecated resource key is set, including an old default retained by `--reuse-values`, `deepCopy` preserves null in `$resources`, so the `index` call at `av` fails before the deprecated key can override it, and Helm cannot render or upgrade the release.
Initialize `$resources` to an empty map when it is null before indexing it.
Also at `charts/tesk/templates/common/tesk-deployment.yaml:23-24`.
</issue_to_address>
### Comment 2
<location path="charts/tesk/templates/common/tesk-deployment.yaml" line_range="15" />
<code_context>
+{{- $pullPolicy := "" -}}
+{{- if kindIs "map" $tesk.image -}}
+{{- $repository := $tesk.image.repository | default "docker.io/elixircloud/tesk-api" -}}
+{{- $image = printf "%s:%s" $repository (toString ($tesk.image.tag | default .Chart.AppVersion)) -}}
+{{- $pullPolicy = $tesk.image.pullPolicy -}}
+{{- end -}}
</code_context>
<issue_to_address>
**Configured image tag zero is ignored**
When `tesk.image.tag` is set to numeric `0`, sprig’s `default` treats `0` as empty, so the image expression uses `.Chart.AppVersion` instead of the configured tag and deploys a different API image.
Select the configured tag based on whether it is present, rather than using `default` to test its value.
</issue_to_address>
### Comment 3
<location path="charts/tesk/templates/_helpers.tpl" line_range="19" />
<code_context>
+*/}}
+{{- define "tesk.podLabels" -}}
+app.kubernetes.io/name: {{ .Chart.Name }}
+app.kubernetes.io/instance: {{ .Release.Name }}
+{{- end -}}
+
</code_context>
<issue_to_address>
**Numeric release names fail installation**
When the release name looks like a YAML scalar, such as `123`, the `app.kubernetes.io/instance` value is emitted without quotes, so a release name such as `123` is parsed as a number rather than a string. Kubernetes rejects objects whose label values are not strings, so installation fails.
Quote the interpolated release name in the label value.
</issue_to_address>Linked issues
#247 chore(chart): follow Helm conventions without breaking installs · 10 of 10 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Rename values to camelCase and keep deprecated names working, with NOTES.txt listing deprecated keys in use | ✅ Met | The resolver handles the renamed keys, and deprecatedValues also detects the legacy string form of tesk.image; tests cover deprecated-name rendering and notes. |
| 2 | Use image blocks for the API, taskmaster and filer, and a resources block for the API, with fallbacks to old keys | ✅ Met | The API image and resource handling account for legacy values, while the resolver maps the renamed taskmaster and filer settings; tests cover these paths. |
| 3 | Add Chart.yaml metadata: description, home, sources, maintainers, icon, keywords and appVersion | ✅ Met | Chart.yaml includes the requested metadata and sets appVersion to the default API image tag. |
| 4 | Add standard labels to object metadata, never to selectors | ✅ Met | The templates add standard labels to rendered objects and pod labels; tests verify the Deployment and Service selectors remain unchanged. |
| 5 | Add a permissive values.schema.json that checks types and allows old keys | ✅ Met | The schema checks map/scalar structure and pull policy, permits legacy keys and unknown properties, and accepts scalars of any type. |
| 6 | Fix indentation and comments in values.yaml and the templates | ✅ Met | The values and templates include the described formatting and comment changes. |
| 7 | Update the configuration reference, deployment guide and upgrade notes with the new names and old-to-new mapping | ✅ Met | The docs use the new names and the upgrade notes include the mapping, an example and the requested caveats. |
| 8 | Existing values files render the same objects as before, apart from added labels | ✅ Met | Tests compare renderings against the legacy chart for defaults, legacy defaults and numerous legacy-value cases; the PR description also provides rendered diffs. |
| 9 | Cover the new keys and fallbacks in chart tests | ✅ Met | Tests exercise renamed values, legacy compatibility and precedence, image and resource blocks, labels, notes and schema behavior. |
| 10 | Map every old key to its new key in the upgrade notes | ✅ Met | The upgrade table covers the renamed keys, including the old string form of tesk.image. |
Sourcery assessment
Approval pending. 3 findings to address first.
Blocking findings: charts/tesk/templates/common/tesk-deployment.yaml:22, charts/tesk/templates/common/tesk-deployment.yaml:15, charts/tesk/templates/_helpers.tpl:19
Use a tesk.image.tag of 0 instead of replacing it with appVersion (default treats 0 as empty), and quote the release name in the app.kubernetes.io/instance label, so that a numeric release name is a string (from the Sourcery review). Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Linked issues
#247 chore(chart): follow Helm conventions without breaking installs · 7 of 8 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Use camelCase values, image blocks, and a resources block | ✅ Met | The chart values, templates, configuration reference, and deployment guide use the new names and structures. |
| 2 | Keep the old keys working and warn about deprecated keys in use | ✅ Met | The shared resolver supports the old names with precedence over the new names, and the notes list deprecated keys and their replacements. |
| 3 | Add the requested Chart.yaml metadata | ✅ Met | Chart.yaml adds the description, home, sources, maintainers, icon, keywords, and appVersion. |
| 4 | Add standard labels to object metadata, not selectors | ✅ Met | The templates add standard labels to their objects and add name and instance labels to API pods while retaining the existing selectors. |
| 5 | Add a permissive schema that checks types and allows old keys | 🟡 Partly met | The schema allows deprecated keys and is broadly permissive, but it also restricts pullPolicy to an enum rather than checking types only. |
| 6 | Fix indentation and comments in values.yaml and templates | ✅ Met | The changed values and templates include the requested formatting and comment updates. |
| 7 | Document the configuration, deployment, and old-to-new value mapping | ✅ Met | The configuration and deployment docs use the new names, and the upgrade notes include the mapping, example, and migration caveats. |
| 8 | Preserve rendered objects apart from labels and test the new keys and fallbacks | ✅ Met | Chart tests compare representative legacy values and defaults against the copied earlier chart, and test renamed values, precedence, and reuse-values behavior. |
Summary
The chart follows Helm's conventions as far as it can without breaking existing installs (the non-breaking half of #228; the breaking half, release-derived names and selector labels, is #248, on hold):
hostName,tesk.tesApiBasePath,auth.serviceInfoPublic,ingress.tlsSecretName, …),imageblocks (repository,tag,pullPolicy) for the API, taskmaster and filer, and aresourcesblock for the API.helm upgrade --reuse-valueskeeps the old defaults, with old keys only). All templates read the renamed values through one resolver,tesk.resolveValues, driven by the listtesk.renamedValuesin_helpers.tpl.NOTES.txtlists the deprecated keys in use, with their new names, and mentions--reuse-values.app.kubernetes.io/*,helm.sh/chart) on every object's metadata; the API's pods getnameandinstance. Selectors are unchanged (app: tesk-api).Chart.yamlmetadata: description (typo fixed),appVersion: "1.1.0"(the tesk-api version, the default image tag),home,icon,sources,keywords,maintainers(as in foca-common).values.schema.json: it checks maps vs scalars and the pull policy, and accepts scalars of any type, unknown keys and the old keys.values.yamland the templates (e.g.,storage: nonedocumented correctly, CRLF inaws-secret.yaml).--reuse-values, labels, schema);docs/development.mddescribes the new chart tests.Closes #247
Same objects as before
Every values file that worked with the chart on
devrenders the same objects, apart from the added labels. The chart tests check this against a verbatim copy of the chart before this change (tests/data/legacy-chart/, from 27a6945) for the defaults, the old defaults, every old key, and empty, null and string values (test_legacy_chart), and with the old defaults as chart defaults, ashelm upgrade --reuse-valuesuses them (test_reuse_values). The one difference: with--reuse-valuesand an old resource key set to null, the old chart renderedcpu: null, and this one leavescpuout, which Kubernetes reads the same way.helm templatediffs (objects parsed, sorted by kind and name, dumped with sorted keys; old chart =tests/data/legacy-chart):Default values: only labels added
A values file with the old keys: only labels added
Values:
Diff:
For both, the objects without the standard labels are equal to the old chart's.
Verification
helm lint charts/tesk --strict(Helm 3.22.1): passes.REQUIRE_HELM=1 pytest: 234 passed (181 chart tests, 53 others).coverage run -m pytest --ignore=tests/test_chart.py: 100% coverage.ruff check,ruff format --check,mypy: pass.mkdocs build --strict: passes.Review
Full review (Helm chart): adversarial-reviewer and quality-reviewer, 2 rounds.
Round 1 fixes:
cpu: '', which Kubernetes rejects: old resource values are parsed as YAML now, as the old templates did.--reuse-values --set tesk.image.tag=…failed: the repository has a default now.ingress.annotations: ""): widened.--reuse-values.Round 2 fixes:
--reuse-valueswithtesk.limitsCpu=null, ortesk.resources=null) failed the rendering ("nil is not a command"): fixed, with regression tests.docs/development.md.Sourcery (4 threads): fixed a tag of
0being replaced byappVersion, and quoted the release name inapp.kubernetes.io/instance(numeric release names), with tests; replied to the third (a nulltesk.resourcesblock with an old key), which doesn't occur, as Helm deletes null keys while coalescing (covered bytest_resources_null).Declined review findings
tesk.image.pullPolicyto its valid values. Kept: it is a new key, so the check can't break values that worked before, and Kubernetes rejects other policies anyway.iconpoints to thedevbranch: same as foca's chart (foca-common); the logo isn't expected to move.test_notes_reuse_valuesplacement at the end of the test file: cosmetic.Open questions
None.
🤖 Generated with Claude Code