Skip to content

feat(chart)!: derive resource names from release - #263

Merged
uniqueg merged 6 commits into
devfrom
feat/chart-release-names
Nov 7, 2026
Merged

uniqueg merged 6 commits into
devfrom
feat/chart-release-names

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Summary

The breaking half of #228. The chart's object names now come from the release, as in helm create. That lets several releases share a namespace.

  • Names: tesk.fullname (with nameOverride and fullnameOverride, cut to 50 characters so that every name fits in 63) is the prefix. The objects are <prefix>-api (Deployment and Service), <prefix>-taskmaster (ServiceAccount, Role and RoleBinding), <prefix>-service-info, <prefix>-oauth-client, <prefix>-ftp, <prefix> (Ingress or Route) and <prefix>-gold (OpenStack StorageClass). With the release tesk, the API's Deployment and Service keep the name tesk-api.
  • Names passed to components: tesk-api still gets the taskmasters' service account (TESK_API_TASKMASTER_SERVICE_ACCOUNT_NAME), the FTP secret (TESK_API_TASKMASTER_FTP_SECRET_NAME) and the .netrc secret from its environment. The Deployment's serviceAccountName, the RoleBinding and the references to the ConfigMap, the OAuth secret and the Service follow the new names, and the tests check each of these references.
  • Fixed names: aws-secret stays, because the filer (tesk-core filer_class.add_s3_mount) mounts it by a hard-coded name. The ftp Service and Endpoints stay too, because tasks address the server as ftp://ftp/. The docs say that only one release per namespace can use storage: s3 or ftp.hostip.
  • FTP secret: ftp.classicFtpSecret now defaults to null, which means <prefix>-ftp. A name you set keeps that name (e.g., ftp-secret to keep the old one), and empty or false still means no secret.
  • Name validation: if the prefix is not a valid Service name, rendering fails with a hint to set fullnameOverride. Helm accepts release names such as 123 or tesk.prod, which would produce such a prefix, and so would a nameOverride with capital letters. Without the check, the API server would reject the Service.
  • Selectors: the Deployment and the Service select on app.kubernetes.io/name and app.kubernetes.io/instance. The app: tesk-api label is removed.
  • Removed keys: the deprecated snake_case keys and tesk.image as a string are no longer read. If any of them is set, also to null or empty, rendering fails and the error lists each one with its replacement (not its value), so a renamed key can't be silently ignored. The schema still accepts them so that this message is what users see. tests/data/legacy-chart/, its pre-commit excludes and the legacy, --reuse-values and renamed-key tests are removed.
  • Unchanged values: ftp.hosts, tesk.filerHttpTimeout, tesk.keepFailedPvcs and tesk.swaggerUi.enabled work as before. auth.clientSecret is still deprecated and still produces a warning in the notes. Their tests are unchanged and pass.
  • Docs:
    • docs/upgrading.md has a new top section, "Resource names from the release name". It gives the old and new object names, explains why helm upgrade can't move an existing release, and lists the migration steps: rename the values, keep the sources of the secrets (with a backup command), wait until no tasks run because the taskmasters' service account is removed, then uninstall and install again. It also covers what to check afterwards: external references, the FTP secret name, the TLS secret, the OpenStack storageClass, and that releases in one namespace share tasks. The old-to-new values key table moved into this section.
    • docs/configuration.md has a new section, "Names of the objects".
    • The deployment, architecture and development docs, values.yaml, the schema and the chart README are updated.

Chart version: this PR doesn't bump version in Chart.yaml. In this repo, the release-prep PR sets it together with CITATION.cff (docs/development.md, "Releases"), and the release workflow checks that the tag matches it. The next release is 0.3.0 (versions continue above the v0.2 tag). Pre-1.0, a breaking change raises the minor version, and 0.3.0 already does that compared with the released 0.1.1.

Closes #248

Verification

  • helm lint charts/tesk --strict (Helm 3.22.1): passes.
  • REQUIRE_HELM=1 pytest: 302 passed (249 chart tests). New tests:
    • test_names_from_release, test_fullname (release names, overrides, truncation, labels), test_two_releases (no common names except the fixed ones; different selectors) and test_names_passed_on (every reference between objects and every name passed to tesk-api).
    • test_invalid_prefix, test_name_override_label, test_name_override_invalid and test_labels_numeric_release (a numeric nameOverride and release name).
    • test_ftp_secret_name (also false, and null from a values file), test_removed_keys (each removed key, also null or empty, without leaking values) and test_removed_keys_all.
    • test_removed_keys_lists (the chart, the tests and the docs table list the same keys) and test_removed_keys_link (the link in the error points to an existing section).
    • test_labels (selectors).
  • ruff check, ruff format --check (0.17.3) and mypy: pass. mkdocs build --strict: passes.
  • helm template with the defaults, compared with dev: only names, labels and selectors differ.
  • Not run locally: pre-commit's hook repos couldn't be fetched in the sandbox (CI's Lint job runs them), and the chart install on kind, which CI runs. The install action's service/tesk-api and deployment/tesk-api still match for the release tesk.
  • CI: all checks pass (PR title, Lint, Test, Chart, Chart install on kind, Docs, CodeQL, Codecov, Read the Docs preview).

Review

Full review (Helm chart): adversarial-reviewer and quality-reviewer, 2 rounds.

  • Round 1 (3 medium, several low; all fixed):

    • The migration guide now covers recovery after a failed helm upgrade: roll back, or delete the objects with the old names.
    • The removed-keys list is tested for consistency across the chart, the tests and the docs, and the error's link is tested.
    • A comment explains why the check of removed keys sits in the Deployment template.
    • ftp.classicFtpSecret: false creates no secret, as before.
    • The app.kubernetes.io/name label is quoted.
    • Invalid prefixes fail with a hint.
    • The guide explains that removing the release deletes the default StorageClass gold.
    • Wording fixes, release-specific commands, re-wrapped paragraphs, the Route in the names test, and a test of null from a values file.
  • Round 2 (low only; fixed):

    • All trailing dashes are trimmed from a cut prefix.
    • The error message names nameOverride.
    • Every line of the removed-keys error is checked.
    • Argo CD, which keeps no Helm release, is separated from tools that run helm upgrade in the guide.
  • Sourcery (5 threads):

    • Fixed, with tests: an invalid nameOverride label value now fails with a hint, and all trailing dashes are trimmed from the label.
    • Answered and documented in docs/configuration.md: releases sharing a namespace need their own hostName or ingress.path and a prefix of their own; prefix collisions such as prod vs prod-tesk fail safely in Helm, as with helm create.
    • Answered: releases in one namespace share tasks. This is a tesk-api limitation, already documented with a warning.

Declined review findings

  • Link the error to the H4 "Values renamed to camelCase" instead of the H3 section: kept the H3. A user who hits the error is migrating a release, and the H3 starts with the migration steps. The key table is in the same section, a few paragraphs further down.
  • The consistency test parses the helper block and the docs table by their layout: kept as is. A reformat makes the test fail visibly, never pass wrongly.
  • The wording "use nothing (auth.clientSecret ... leave it unset)" for auth.client_secret: kept. It is clear and pinned by a test.
  • A fullnameOverride of 0 or false is ignored: kept, as in helm create.

Open questions

None.

🤖 Generated with Claude Code

uniqueg and others added 5 commits November 7, 2026 21:11
Name the chart's objects after the release, as `helm create` does
(`tesk.fullname`, with `nameOverride` and `fullnameOverride`), so that
several releases can share a namespace: `<prefix>-api`,
`<prefix>-taskmaster`, `<prefix>-service-info`, `<prefix>-oauth-client`,
`<prefix>-ftp` (unless `ftp.classicFtpSecret` names it), `<prefix>` for
the Ingress and Route, and `<prefix>-gold` for the OpenStack storage
class. The service account name reaches tesk-api as before, through
`TESK_API_TASKMASTER_SERVICE_ACCOUNT_NAME`. `aws-secret` and `ftp` keep
their fixed names, as the filer and tasks read them by name.

The Deployment and Service select the API's pods by
`app.kubernetes.io/name` and `app.kubernetes.io/instance`; `app:
tesk-api` is gone.

Drop the deprecated snake_case keys and `tesk.image` as a string, and
the copy of the earlier chart that tested them: setting any of them now
fails with a list of their replacements, so that they aren't ignored
unnoticed.

BREAKING CHANGE: the objects are renamed and the selectors change, so a
release of an earlier chart can't be upgraded in place: install it
again (see docs/upgrading.md). The snake_case values keys and
`tesk.image` as a string fail the installation; the FTP secret is
`<prefix>-ftp` unless `ftp.classicFtpSecret` is set.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Describe the names of the chart's objects and their limits (fixed
`aws-secret` and `ftp`, tasks shared between releases in a namespace)
in the configuration reference, and how to move a release of an
earlier chart (rename the values, keep the secrets' sources, wait for
running tasks, reinstall) in the upgrade notes, with the old-to-new
names of objects and values keys.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Fail with a hint if the prefix of the names isn't a valid Service name
(release names such as `123` or `tesk.prod`, which Helm accepts), quote
the label `app.kubernetes.io/name` and the FTP secret's name, and treat
`ftp.classicFtpSecret: false` as no secret, as earlier charts did.

Test that the chart, the tests and the upgrade notes list the same
removed keys, that the error's link points to an existing section, a
null `ftp.classicFtpSecret` from a values file, and the Route's name.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Explain why an in-place upgrade fails, what to do after a failed
`helm upgrade` (roll back, or delete the old objects), that removing
the release deletes the default storage class `gold`, the limits on
release names, and which commands assume the release `tesk`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Trim all trailing dashes of a cut prefix, name `nameOverride` in the
error on invalid prefixes, check every line of the removed-keys error,
and in the upgrade notes, separate Argo CD (no Helm release) from
tools that run `helm upgrade`.

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

sourcery-ai Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer's Guide

API

Remove the legacy value forms from the chart’s accepted configuration interface while retaining explicit checks that report replacements.

  • charts/tesk/values.schema.json L46-56 (+19 small edits)

Implementation

Define and validate the chart name and release-derived resource prefixes, centralize object names, and fail on removed values.

  • charts/tesk/templates/_helpers.tpl L2-82, L87-103, L145-153 (+10 small edits)

Configuration

Apply the derived names and selectors consistently across rendered resources and their references, while preserving fixed-name resources and the configurable FTP secret behavior.

  • charts/tesk/templates/common/oauth-client-secret.yaml L2 (removed lines), L5, L10-14
  • charts/tesk/templates/common/service-info-cm.yaml L4
  • charts/tesk/templates/common/taskmaster-rbac.yaml L59-62 (+3 small edits)
  • charts/tesk/templates/common/tesk-deployment.yaml L27-55, L69-77, L83-95 (+11 small edits)
  • charts/tesk/templates/common/tesk-svc.yaml L12-15 (+3 small edits)
  • charts/tesk/templates/ftp/ftp-endpoint.yaml L2
  • charts/tesk/templates/ftp/ftp-secret.yaml L1-11
  • charts/tesk/templates/ftp/ftp-service.yaml L2
  • charts/tesk/templates/ftp/netrc-secret.yaml L1-5
  • charts/tesk/templates/ingress/ingress-rules.yaml L2-7, L32
  • charts/tesk/templates/openshift/oc-route.yaml L2-6, L16
  • charts/tesk/templates/storage/aws-secret.yaml L2
  • charts/tesk/templates/storage/openstack.yaml L5

Set defaults and document chart configuration for release-derived names, overrides, and the new default FTP secret naming behavior.

  • charts/tesk/values.yaml L6-16, L23-26, L145-150 (+2 small edits)

Remove obsolete legacy-chart pre-commit exclusions now that the compatibility fixture is deleted.

  • .pre-commit-config.yaml L14-22

Documentation

Explain the breaking resource-name change, release sharing constraints, fixed names, and the migration procedure and value-key replacements.

  • charts/tesk/README.md L14-17
  • docs/architecture.md L8, L46-51
  • docs/configuration.md L8-14, L27-31, L152-204 (+2 small edits)
  • docs/deployment.md L58-66, L184-188, L225-226
  • docs/development.md L47-50
  • docs/upgrading.md L4-7, L15-195, L227-236 (+2 small edits)

Tests

Replace legacy compatibility coverage with checks for derived names, selectors, cross-resource references, invalid prefixes, FTP secret behavior, and removed-value errors.

  • tests/helm.py L122-135 (+10 small edits)
  • tests/test_chart.py L40-128, L149-156, L1210-1582 (+38 small edits)
  • tests/data/legacy-chart/Chart.yaml (deleted)
  • tests/data/legacy-chart/service-info/service-info.yaml (deleted)
  • tests/data/legacy-chart/templates/common/oauth-client-secret.yaml (deleted)
  • tests/data/legacy-chart/templates/common/service-info-cm.yaml (deleted)
  • tests/data/legacy-chart/templates/common/taskmaster-rbac.yaml (deleted)
  • tests/data/legacy-chart/templates/common/tesk-deployment.yaml (deleted)
  • tests/data/legacy-chart/templates/common/tesk-svc.yaml (deleted)
  • tests/data/legacy-chart/templates/ftp/ftp-endpoint.yaml (deleted)
  • tests/data/legacy-chart/templates/ftp/ftp-secret.yaml (deleted)
  • tests/data/legacy-chart/templates/ftp/ftp-service.yaml (deleted)
  • tests/data/legacy-chart/templates/ftp/netrc-secret.yaml (deleted)
  • tests/data/legacy-chart/templates/ingress/ingress-rules.yaml (deleted)
  • tests/data/legacy-chart/templates/openshift/oc-route.yaml (deleted)
  • tests/data/legacy-chart/templates/storage/aws-secret.yaml (deleted)
  • tests/data/legacy-chart/templates/storage/openstack.yaml (deleted)
  • tests/data/legacy-chart/values.yaml (deleted)

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

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (8da5145) to head (c81aa03).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #263   +/-   ##
=========================================
  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 7, 2026 20:37

@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 5 issues

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

## Individual Comments

### Comment 1
<location path="charts/tesk/templates/common/taskmaster-rbac.yaml" line_range="12" />
<code_context>
 kind: ServiceAccount
 metadata:
-  name: taskmaster
+  name: {{ include "tesk.taskmasterName" . }}
   labels:
     {{- include "tesk.labels" . | nindent 4 }}
</code_context>
<issue_to_address>
**Releases can cancel each other's tasks**

When separately authenticated releases share a namespace and a user can access one release's API, a user authenticated to one release can use its API to list, read, or cancel jobs created through another release in the same namespace. The API operates on namespace-wide jobs, so distinct release names and service accounts do not provide task isolation.

Enforce release or tenant ownership checks in the API for task listing, reading, and cancellation, or require isolated namespaces for releases with separate trust boundaries.
</issue_to_address>

### Comment 2
<location path="charts/tesk/templates/_helpers.tpl" line_range="24" />
<code_context>
+{{- $fullname := printf "%s-%s" .Release.Name $name -}}
+{{- if .Values.fullnameOverride -}}
+{{- $fullname = toString .Values.fullnameOverride -}}
+{{- else if contains $name .Release.Name -}}
+{{- $fullname = .Release.Name -}}
+{{- end -}}
</code_context>
<issue_to_address>
**Releases render identical object names**

When two releases map to the same prefix, such as `prod` and `prod-tesk`, or distinct release names share their first 50 characters, `tesk.fullname` maps both releases to the same prefix, so their objects have identical names and Helm refuses to install the second release as an owner conflict.

Change `tesk.fullname` to generate distinct valid prefixes for distinct release names, including names that collide under the current suffix check or truncation.

Also at `charts/tesk/templates/_helpers.tpl:27`.
</issue_to_address>

### Comment 3
<location path="charts/tesk/templates/ingress/ingress-rules.yaml" line_range="9" />
<code_context>
 apiVersion: networking.k8s.io/v1
 kind: Ingress
 metadata:
-  name: ingress-rules
+  name: {{ include "tesk.fullname" . }}
   labels:
</code_context>
<issue_to_address>
**Ingress traffic reaches only one release**

When two releases use the same ingress host and path, including the default settings, the Ingress objects have distinct names but identical host/path rules and different backends, so the ingress controller routes requests to only one release or reports a conflict.

Make the ingress host or path release-specific, or require distinct ingress settings for releases that share a cluster.

Also at `charts/tesk/templates/ingress/ingress-rules.yaml:7`.
</issue_to_address>

### Comment 4
<location path="charts/tesk/templates/_helpers.tpl" line_range="6" />
<code_context>
-app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
-app.kubernetes.io/managed-by: {{ .Release.Service }}
+{{- define "tesk.name" -}}
+{{- default .Chart.Name .Values.nameOverride | toString | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
</code_context>
<issue_to_address>
**Invalid name labels reject resources**

When `nameOverride` contains a character forbidden in a Kubernetes label value, such as `/`, while `fullnameOverride` is a valid prefix, `tesk.name` passes the invalid value into `tesk.selectorLabels` and the rendered object labels, so Kubernetes rejects the release's resources.

Validate or normalize `nameOverride` in `tesk.name` so every emitted `app.kubernetes.io/name` value is a valid Kubernetes label value.

Also at `charts/tesk/templates/_helpers.tpl:76`.
</issue_to_address>

### Comment 5
<location path="charts/tesk/templates/_helpers.tpl" line_range="6" />
<code_context>
-app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
-app.kubernetes.io/managed-by: {{ .Release.Service }}
+{{- define "tesk.name" -}}
+{{- default .Chart.Name .Values.nameOverride | toString | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
</code_context>
<issue_to_address>
**Override creates invalid selector label**

When `nameOverride` ends in two or more dashes, such as `foo--`, `tesk.name` trims only one trailing dash, so `nameOverride: foo--` produces the label value `foo-`. Kubernetes rejects that value in the Deployment selector and pod labels, preventing the release's objects from being created.

Trim all trailing dashes from the label value or reject `nameOverride` values that are invalid Kubernetes label values.
</issue_to_address>

Linked issues

#248 feat(chart)!: derive resource names from the release · 5 of 6 met · 1 to check by hand

# Requirement Status Notes
1 Derive resource names from the release, including names passed to tesk-api and taskmasters ✅ Met The templates derive the API, taskmaster RBAC, service-info, OAuth, FTP, Ingress/Route, and OpenStack StorageClass names from the fullname, and update the corresponding references and environment variables; aws-secret and ftp remain fixed.
2 Use standard selector labels on the Deployment and Service ✅ Met Both selectors use app.kubernetes.io/name and app.kubernetes.io/instance, and the app: tesk-api label is removed.
3 Document how to migrate an existing release and what happens to running tasks and name-referenced secrets ✅ Met The upgrade guide explains reinstalling, preserving or backing up secret sources, waiting for running tasks before removing their service account, and the relevant fixed-name and storage-class considerations.
4 Remove the deprecated snake_case keys in the same release ✅ Met The chart fails when removed keys are set, including to null or empty, and lists their replacements without exposing values; it also rejects tesk.image as a string.
5 Allow two releases to be installed in one namespace ✅ Met Release-derived names and selectors distinguish releases, and tests verify that two releases have no common object names apart from the fixed-name objects.
6 Obtain a maintainer decision on release timing 👀 Check by hand (manual process) A maintainer should confirm the intended release timing; the PR description says the breaking change is intended for 0.3.0, while this PR leaves Chart.yaml unchanged.

Sourcery assessment

Needs a human reviewer. 5 findings to address first, and multiple releases in one namespace can access and cancel each other’s tasks because the API and taskmaster roles remain namespace-wide; reverting cannot undo data already exposed or tasks already cancelled. Renaming the OpenStack StorageClass also removes gold, which can leave other workloads’ new PVCs pending.

Blocking findings: charts/tesk/templates/common/taskmaster-rbac.yaml:12, charts/tesk/templates/_helpers.tpl:24, charts/tesk/templates/ingress/ingress-rules.yaml:9, charts/tesk/templates/_helpers.tpl:6, charts/tesk/templates/_helpers.tpl:6


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

Comment thread charts/tesk/templates/_helpers.tpl Resolved
Comment thread charts/tesk/templates/_helpers.tpl Resolved
Comment thread charts/tesk/templates/_helpers.tpl Resolved
Trim all trailing dashes of the label `app.kubernetes.io/name` and fail
with a hint if `nameOverride` isn't a valid label value, instead of
rendering a selector that Kubernetes rejects. Document that releases
sharing a namespace need their own host (or path) and a prefix of their
own.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg
uniqueg merged commit 2ec16c0 into dev Nov 7, 2026
28 checks passed
@uniqueg
uniqueg deleted the feat/chart-release-names branch November 7, 2026 20:48
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.

feat(chart)!: derive resource names from the release

1 participant