Skip to content

refactor(chart)!: finish the Helm conventions - #270

Merged
uniqueg merged 3 commits into
devfrom
refactor/228-helm-conventions
Nov 9, 2026
Merged

uniqueg merged 3 commits into
devfrom
refactor/228-helm-conventions

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Summary

Finishes #228 (its sub-issues #247 and #248 are merged): the remaining parts of the chart that didn't follow Helm's conventions, or the org's other charts (foca-common, cloud-registry).

Breaking (for the 0.3.0 chart release, which is breaking already; the old keys fail the installation with their replacements, and the upgrade notes list them):

  • Values renamed:

    Old (released charts) New
    ingress.rules ingress.enabled (as in foca-common and helm create)
    ingress.ingressClassName ingress.className (as in foca-common and helm create)
    transfer.active transfer.enabled
    ftp.hostip ftp.hostIp (camelCase)
    auth.env_basegroup (and auth.envBasegroup from chore(chart): follow Helm conventions #249, on dev only) auth.envBaseGroup
    tesk.securityContext.enabled tesk.podSecurityContext and tesk.securityContext, maps with the same defaults (as in helm create); null removes a field or a context, e.g. podSecurityContext.runAsUser: null on OpenShift
  • values.schema.json closes the chart's own maps (additionalProperties: false), so typos fail instead of being ignored. Maps with Kubernetes' fields stay open (resources, security contexts, probes, annotations), as does global. The removed keys are declared ($defs/removed), so that the templates can still name their replacements. The enabled switches are booleans, as in foca-common.

  • tesk.checkRemovedValues supports nested maps (for tesk.securityContext.enabled).

  • An empty ingress.className now leaves ingressClassName out of the Ingress (it rendered as null before).

  • The TLS secret template is tls-secret.yaml-TEMPLATE (was tls_secret_name.yml-TEMPLATE, whose secret name tls_secret wasn't a valid name).

Docs: configuration reference, deployment guide (Ingress, OpenShift with the security context, shared file system, auth), MicroK8s and local FTP guides, and the upgrade notes (table of renamed values, example, schema, TLS template).

Checked against #228 and current dev: snake_case keys, image/resources blocks, release-derived names, _helpers.tpl with standard labels, Chart.yaml metadata (description, appVersion, home, sources, maintainers, icon), storage docs and indentation were done by #249/#263; appVersion and the chart version are left to the release-prep PR.

Closes #228

Verification

  • REQUIRE_HELM=1 pytest tests/test_chart.py with Helm v3.22.1 (CI's pin): 377 passed. New/changed tests were written first and failed before the change: removed keys (incl. nested tesk.securityContext.enabled), security context defaults/merge/null, schema rejects unknown keys, schema declares every removed key, chart file names.
  • helm lint charts/tesk --strict: passed; helm template tesk charts/tesk: renders.
  • pre-commit run --all-files: passed.
  • coverage run -m pytest --ignore=tests/test_chart.py: 53 passed, 100% coverage.
  • mkdocs build --strict: passed.
  • Not run locally: the Chart install job (kind cluster). CI: all checks passed (incl. Chart install, Chart, Lint, Test, Docs, CodeQL, Read the Docs; CI passed).

Review (adversarial + quality, 2 rounds): fixed the closed root schema rejecting tesk.enabled from parent charts (condition: tesk.enabled; new test_dependency), the Route also rendering for a missing ingress.enabled, numeric ingress.className, docs on which maps are open, plus small doc/test fixes. Round 2: no findings. After the fixes: 380 chart tests passed; lint, pre-commit and the docs build passed again.

Sourcery: fixed an ingress class that YAML reads as 0/false being skipped, and a test that didn't check the merged container defaults (de44c77); answered "no deprecation period" (see Declined). CI passed again after the fixes.

Declined review findings

  • Sourcery: deprecate the old keys for one release instead of failing (medium): declined. feat(chart)!: derive resource names from release #263 already ended the deprecation, as this release must be installed again anyway; failing with the replacement named avoids silently ignored keys (e.g., the authorisation group).

  • Close the security-context and probe maps too (medium): declined. They take Kubernetes' fields, which foca-common also leaves open; listing every field would lag behind Kubernetes. The schema $comment and docs say so; tesk.securityContext.enabled is caught by the templates.

  • Drop the dev-only auth.envBasegroup row from the upgrade table (medium): declined. Deployments from dev exist, and an ignored key would silently fall back to the default authorisation group; the test keeps the table and the check in sync.

  • Add kubeVersion, imagePullSecrets, nodeSelector/tolerations/affinity, podAnnotations etc. from helm create (note): not in refactor: follow the Helm conventions in the chart #228, and new features rather than conventions; separate issues if wanted.

  • Mention the accepted global/enabled keys in the configuration docs (low, optional): skipped; they are for parent charts, and the schema describes them.

Open questions

None.

🤖 Generated with Claude Code

uniqueg and others added 2 commits November 8, 2026 19:45
Rename the values that #249 and #263 left out of Helm's conventions:
ingress.rules -> ingress.enabled, ingress.ingressClassName ->
ingress.className, transfer.active -> transfer.enabled, ftp.hostip ->
ftp.hostIp and auth.envBasegroup -> auth.envBaseGroup. Replace the
switch tesk.securityContext.enabled by the maps tesk.podSecurityContext
and tesk.securityContext, with the same defaults, as in helm create.
The old keys fail the chart with their replacements; the check now
supports nested maps.

Close the chart's own maps in values.schema.json
(additionalProperties: false), so that typos fail; maps with
Kubernetes' fields stay open, and the removed keys are declared so
that the templates can name their replacements.

Rename the TLS secret template to tls-secret.yaml-TEMPLATE, with a
valid secret name. Update the docs and the upgrade notes.

BREAKING CHANGE: the renamed values fail the installation; see the
upgrade notes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Accept tesk.enabled, which parent charts set with condition:
tesk.enabled, in the closed schema; create the OpenShift Route only
for ingress.enabled: false, as before for ingress.rules; accept any
scalar as ingress.className and quote it. Name the open maps and the
strict switches in the schema and the docs, mention the omitted
ingressClassName in the upgrade notes, and split the security context
test.

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

sourcery-ai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer's Guide

API

Review the values schema’s closed chart-owned maps, extensible Kubernetes maps, removed-key declarations, and parent-chart tesk.enabled support as the contract for accepted values.

  • charts/tesk/values.schema.json L273-332, L432-452, L539-567 (+14 small edits)

Review the renamed values and split pod/container security-context defaults that supply the schema’s public values contract.

  • charts/tesk/values.yaml L5-9, L122-136 (+5 small edits)

Uses of the API

Review template consumers of the renamed auth and transfer values and the merged container and pod security contexts.

  • charts/tesk/templates/common/tesk-deployment.yaml L110-206 (4 small edits)

Review the FTP endpoint and service conditions using the renamed ftp.hostIp value.

  • charts/tesk/templates/ftp/ftp-endpoint.yaml L1, L12
  • charts/tesk/templates/ftp/ftp-service.yaml L1

Review Ingress enablement and class rendering, including set values that YAML reads as zero or false.

  • charts/tesk/templates/ingress/ingress-rules.yaml L1, L17-20

Review the OpenShift Route condition so it is created only when Ingress is explicitly disabled.

  • charts/tesk/templates/openshift/oc-route.yaml L1

Implementation

Review the removed-values table and nested-map lookup that report replacement values for deprecated keys.

  • charts/tesk/templates/_helpers.tpl L129-137, L164-169, L184-188 (+1 small edits)

Documentation

Review the configuration reference for the renamed values, schema behavior, and security-context defaults.

  • docs/configuration.md L9-24 (+9 small edits)

Review deployment guidance for the renamed Ingress and transfer switches and the OpenShift pod security-context override.

  • docs/deployment.md L168-178 (+6 small edits)

Review the local FTP guide’s ftp.hostIp instructions.

  • docs/local_ftp.md L3, L81-85

Review the MicroK8s example’s renamed Ingress values.

  • docs/microk8s.md L91-92

Review upgrade instructions and the rename table, including schema behavior and TLS template migration.

  • docs/upgrading.md L54-58, L181-185, L199-227 (+4 small edits)

Tests

Review chart tests covering removed-key hints, security-context defaults and merging, schema validation, dependency conditions, naming, and renamed-value rendering.

  • tests/test_chart.py L329-371, L1998-2017, L2023-2106 (+13 small edits)

Other changes

Files not grouped.

  • charts/tesk/tls_secret_name.yml-TEMPLATE L13

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 Nov 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (034b80e) to head (de44c77).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #270   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines          229       229           
=========================================
  Hits           229       229           

☔ 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 November 8, 2026 19:19

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've found 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="charts/tesk/templates/ingress/ingress-rules.yaml" line_range="17-19" />
<code_context>
   {{- end }}
 spec:
-  ingressClassName: {{ .Values.ingress.ingressClassName }}
+  {{- with .Values.ingress.className }}
+  ingressClassName: {{ toString . | quote }}
+  {{- end }}
   {{- if $tlsSecretName }}
   tls:
</code_context>
<issue_to_address>
**Configured ingress class is skipped**

When `ingress.className` is set to `0` or `false`, the `with` block treats the value as empty and skips `ingressClassName`, so the Ingress silently uses the cluster's default class.

Replace the `with` block with a presence check that renders `ingress.className` through `toString` even when its value is `0` or `false`.
</issue_to_address>

### Comment 2
<location path="tests/test_chart.py" line_range="360" />
<code_context>
+        "runAsNonRoot": True,
+        "seccompProfile": {"type": "RuntimeDefault"},
+    }
+    assert container(manifests)["securityContext"]["readOnlyRootFilesystem"] is True
+
+
</code_context>
<issue_to_address>
**Container defaults can disappear**

When the chart replaces the container security context instead of merging the supplied value with defaults, if the chart replaces rather than merges container security-context values, `test_security_context_values` checks only `readOnlyRootFilesystem` at line 360 and still passes even though the default `allowPrivilegeEscalation` and dropped capabilities are gone. The test misses the lost security defaults.

Assert that the overridden container context also retains the default fields.
</issue_to_address>

Linked issues

#228 refactor: follow the Helm conventions in the chart · 2 of 2 met

# Requirement Status Notes
1 Follow Helm conventions for values, images and resources, resource names and labels, schema, formatting, storage documentation, and chart metadata. ✅ Met The chart uses camelCase values and enabled switches, image and resources blocks, release-derived names and standard labels, a values schema, and the corrected chart metadata and storage documentation.
2 Rename old values, report removed keys where feasible, and document migration for every renamed value. ✅ Met Removed values fail with replacement hints, and the upgrade table covers the old and new names, including the values renamed in this change.

Sourcery assessment

Approval pending. 2 findings to address first.

Blocking findings: charts/tesk/templates/ingress/ingress-rules.yaml:19, tests/test_chart.py:360


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

Comment thread tests/test_chart.py Resolved
Set ingressClassName for any class that is set, also one that YAML
reads as 0 or false, instead of skipping it; check the defaults of the
container's security context when values are merged into it.

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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Linked issues

#228 refactor: follow the Helm conventions in the chart · 4 of 6 met · 1 to check by hand

# Requirement Status Notes
1 Follow Helm conventions for values, including camelCase names, image and resources blocks, and enabled switches. ✅ Met The chart values and templates use the conventions, including the renamed keys in this PR.
2 Use release-derived resource names, standard labels, and helper templates. ✅ Met The templates use the fullname and label helpers.
3 Add values validation, correct the storage documentation, and provide the requested Chart.yaml metadata. ✅ Met The schema closes chart-owned maps while leaving Kubernetes-field maps open; the storage documentation and chart metadata are present.
4 Deprecate old keys for one release where feasible. 🟡 Partly met The old keys are identified with replacements, but setting one fails installation immediately rather than allowing a deprecation period.
5 Cover every renamed value in the upgrade notes. ✅ Met The upgrade table includes the original snake_case names and the additional renamed values in this PR.
6 Ship the breaking value changes in their own release with upgrade notes. 👀 Check by hand (manual process) Verify that release preparation ships these breaking changes as the separate release described in the issue.

Comment thread charts/tesk/templates/_helpers.tpl Resolved
@uniqueg
uniqueg merged commit b72a14f into dev Nov 9, 2026
33 of 35 checks passed
@uniqueg
uniqueg deleted the refactor/228-helm-conventions branch November 9, 2026 02:58
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.

refactor: follow the Helm conventions in the chart

1 participant