Repository navigation
feat(chart)!: derive resource names from release - #263
Conversation
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]>
Reviewer's GuideAPIRemove the legacy value forms from the chart’s accepted configuration interface while retaining explicit checks that report replacements.
ImplementationDefine and validate the chart name and release-derived resource prefixes, centralize object names, and fail on removed values.
ConfigurationApply the derived names and selectors consistently across rendered resources and their references, while preserving fixed-name resources and the configurable FTP secret behavior.
Set defaults and document chart configuration for release-derived names, overrides, and the new default FTP secret naming behavior.
Remove obsolete legacy-chart pre-commit exclusions now that the compatibility fixture is deleted.
DocumentationExplain the breaking resource-name change, release sharing constraints, fixed names, and the migration procedure and value-key replacements.
TestsReplace legacy compatibility coverage with checks for derived names, selectors, cross-resource references, invalid prefixes, FTP secret behavior, and removed-value errors.
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 #263 +/- ##
=========================================
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 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
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]>
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.tesk.fullname(withnameOverrideandfullnameOverride, 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 releasetesk, the API's Deployment and Service keep the nametesk-api.TESK_API_TASKMASTER_SERVICE_ACCOUNT_NAME), the FTP secret (TESK_API_TASKMASTER_FTP_SECRET_NAME) and the.netrcsecret from its environment. The Deployment'sserviceAccountName, 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.aws-secretstays, because the filer (tesk-corefiler_class.add_s3_mount) mounts it by a hard-coded name. TheftpService and Endpoints stay too, because tasks address the server asftp://ftp/. The docs say that only one release per namespace can usestorage: s3orftp.hostip.ftp.classicFtpSecretnow defaults to null, which means<prefix>-ftp. A name you set keeps that name (e.g.,ftp-secretto keep the old one), and empty orfalsestill means no secret.fullnameOverride. Helm accepts release names such as123ortesk.prod, which would produce such a prefix, and so would anameOverridewith capital letters. Without the check, the API server would reject the Service.app.kubernetes.io/nameandapp.kubernetes.io/instance. Theapp: tesk-apilabel is removed.tesk.imageas 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-valuesand renamed-key tests are removed.ftp.hosts,tesk.filerHttpTimeout,tesk.keepFailedPvcsandtesk.swaggerUi.enabledwork as before.auth.clientSecretis still deprecated and still produces a warning in the notes. Their tests are unchanged and pass.docs/upgrading.mdhas a new top section, "Resource names from the release name". It gives the old and new object names, explains whyhelm upgradecan'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 OpenStackstorageClass, and that releases in one namespace share tasks. The old-to-new values key table moved into this section.docs/configuration.mdhas a new section, "Names of the objects".values.yaml, the schema and the chart README are updated.Chart version: this PR doesn't bump
versioninChart.yaml. In this repo, the release-prep PR sets it together withCITATION.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 thev0.2tag). 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) andtest_names_passed_on(every reference between objects and every name passed to tesk-api).test_invalid_prefix,test_name_override_label,test_name_override_invalidandtest_labels_numeric_release(a numericnameOverrideand release name).test_ftp_secret_name(alsofalse, and null from a values file),test_removed_keys(each removed key, also null or empty, without leaking values) andtest_removed_keys_all.test_removed_keys_lists(the chart, the tests and the docs table list the same keys) andtest_removed_keys_link(the link in the error points to an existing section).test_labels(selectors).ruff check,ruff format --check(0.17.3) andmypy: pass.mkdocs build --strict: passes.helm templatewith the defaults, compared withdev: only names, labels and selectors differ.service/tesk-apianddeployment/tesk-apistill match for the releasetesk.Review
Full review (Helm chart): adversarial-reviewer and quality-reviewer, 2 rounds.
Round 1 (3 medium, several low; all fixed):
helm upgrade: roll back, or delete the objects with the old names.ftp.classicFtpSecret: falsecreates no secret, as before.app.kubernetes.io/namelabel is quoted.gold.Round 2 (low only; fixed):
nameOverride.helm upgradein the guide.Sourcery (5 threads):
nameOverridelabel value now fails with a hint, and all trailing dashes are trimmed from the label.hostNameoringress.pathand a prefix of their own; prefix collisions such asprodvsprod-teskfail safely in Helm, as withhelm create.Declined review findings
auth.client_secret: kept. It is clear and pinned by a test.fullnameOverrideof0orfalseis ignored: kept, as inhelm create.Open questions
None.
🤖 Generated with Claude Code