Repository navigation
feat(chart): support restricted namespaces - #331
Conversation
Work in progress for #330: values for the security contexts and resources of taskmaster, filer and executor pods (tesk-api 2.1.0, taskmaster 0.12.0), the executors' default CPU, schema, notes warnings, and a restricted case of the install-chart action. Tests, docs and the ci.yml matrix are still missing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideAPIReview the chart values schema as the public contract for the new task pod security contexts, resources, and executor CPU setting.
ImplementationCheck how the chart serializes task resources and security contexts into tesk-api environment variables and preserves executor ConfigMap compatibility.
Check the chart's warnings for settings ignored by older tesk-api or taskmaster versions.
ConfigurationReview the new defaults and value descriptions, especially the executor pod/container context split and the default CPU behavior.
Check that the install action prepares restricted namespaces and applies the restricted values consistently during install and upgrades.
Check that CI exercises both default and restricted chart installs while keeping the release workflow's default case unchanged.
DocumentationReview the configuration reference and deployment guidance for the new values, restricted namespaces, resource behavior, and executor context migration.
Check the upgrade guidance for the breaking executor context change and the new task pod settings.
Review the development documentation describing the default and restricted CI install cases.
TestsReview the restricted namespace quota and values fixtures used by CI and chart rendering tests.
Check coverage for executor context compatibility, task pod settings and resources, validation, warnings, and synchronization of restricted values with the documentation.
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 #331 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 2 2
Lines 422 422
=========================================
Hits 422 422 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Tests for the task pods' security contexts and resources, the executors' pod and container contexts (fsGroup moved), the default CPU, the notes for tesk-api before 2.1.0 and the restricted smoke values; a chart-install matrix (default, restricted) in CI; docs for the new values, restricted namespaces and quotas, and the upgrade. Refs #330 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Check that the deployment guide's restricted values are the smoke test's and that the tesk-api pin goes with appVersion 2.1.0; name the chart version after 0.4.0 in the fsGroup hint; name tesk-core#164 for the filer defaults; note that releases install the default case only. Refs #330 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Fail on a zero tesk.executor.defaultCpu, which tesk-api 2.1.0 refuses at startup; let a null fsGroup in tesk.executor.securityContext pass (e.g., to drop the old one with --reuse-values); warn of older tesk-api only for settings that ask for something. Refs #330 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Linked issuesChecked at commit b538de2 #330 feat(chart): support restricted namespaces and quotas · 5 of 6 met
|
There was a problem hiding this comment.
Hey - I've found 6 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="charts/tesk/templates/_helpers.tpl" line_range="262" />
<code_context>
+{{- else if kindIs "invalid" $quantity -}}
+{{- fail (printf "%s.%s.%s has no value: give a quantity, or leave it out" $key $field $name) -}}
+{{- else -}}
+{{- $_ := set $strings $name (toString $quantity) -}}
+{{- end -}}
+{{- end -}}
</code_context>
<issue_to_address>
**Boolean quantities break task pods**
When a resource request or limit is set to a boolean, `tesk.resourcesJson` converts it to `true`, so tesk-api or the taskmaster rejects the Kubernetes quantity and the affected task pods fail to start.
Reject boolean resource quantities during chart rendering instead of stringifying them.
</issue_to_address>
### Comment 2
<location path="charts/tesk/templates/_helpers.tpl" line_range="256" />
<code_context>
+{{- range $name, $quantity := $quantities -}}
+{{- if and (kindIs "float64" $quantity) (eq (floor $quantity) $quantity) -}}
+{{- if not (and (lt $quantity 9007199254740992.0) (gt $quantity -9007199254740992.0)) -}}
+{{- fail (printf "%s.%s.%s is a number too large to be exact: quote it in the values file or use --set-string" $key $field $name) -}}
+{{- end -}}
+{{- $_ := set $strings $name (printf "%.0f" $quantity) -}}
</code_context>
<issue_to_address>
**Exact quantity blocks rendering**
When an unquoted resource quantity is exactly 9007199254740992, `tesk.resourcesJson` treats the exactly representable 2^53 value as out of range because both bounds are strict, so Helm rendering fails.
Allow the exact boundary value while continuing to reject whole numbers outside the exact range.
</issue_to_address>
### Comment 3
<location path="tests/smoke/restricted/values.yaml" line_range="12" />
<code_context>
+ # resources of task pods), until tesk-api 2.1.0 is released: the chart's
+ # release prep that sets `appVersion` 2.1.0 removes it (a chart test
+ # fails while both are set)
+ tag: sha-b87b051ba1389b3696828579df1e78788488bb3f
+ taskmaster:
+ podSecurityContext:
</code_context>
<issue_to_address>
**Default API remains 2.0.0**
The restricted smoke values pin a development build with the new settings, but the chart's default API version remains 2.0.0. Consequently, the default installation does not use a tesk-api release containing these settings.
</issue_to_address>
### Comment 4
<location path=".github/actions/install-chart/action.yml" line_range="10" />
<code_context>
-# hardened defaults (`tests/smoke/check-filer.sh`). Used by the
-# `chart-install` job of `ci.yml` and by `release.yml`. Needs a checkout of
-# the repository.
+# hardened defaults (`tests/smoke/check-filer.sh`). With `restricted:
+# true`, the namespace enforces the `restricted` Pod Security Standard and
+# has a quota on `limits.cpu` and a default memory limit
</code_context>
<issue_to_address>
**Smoke test lacks task output**
The restricted case runs the existing smoke checks, whose input task completes and verifies its output in logs. It does not declare or check a TES task output, as the issue asks.
</issue_to_address>
### Comment 5
<location path="tests/test_chart.py" line_range="5127" />
<code_context>
[email protected](
+ ("tag", "old"),
+ [
+ (None, True),
+ ("v2.0.1", True),
+ ("2.1.0", False),
</code_context>
<issue_to_address>
**Default-version warning test breaks on release**
When the chart's `appVersion` is 2.1.0 or later and the test leaves the API tag unset, `test_notes_task_pod_settings_old_api` treats the unset tag as old and expects a warning. Once `appVersion` reaches 2.1.0, the unset API tag defaults to `appVersion`, so the correct notes omit the warning and this test fails.
Derive the expected `old` value from the default API tag, or set an explicit old tag for this test case.
</issue_to_address>
### Comment 6
<location path="charts/tesk/templates/_helpers.tpl" line_range="535" />
<code_context>
+{{- $ignored := list -}}
+{{- $taskmaster := default dict .Values.tesk.taskmaster -}}
+{{- range $key := list "podSecurityContext" "securityContext" -}}
+{{- if and (kindIs "map" (get $taskmaster $key)) (get $taskmaster $key) -}}
+{{- $ignored = append $ignored (printf "tesk.taskmaster.%s" $key) -}}
+{{- end -}}
</code_context>
<issue_to_address>
**Null contexts trigger false warnings**
When an older tesk-api is used with taskmaster or executor contexts containing only null-valued fields, the notes logic adds these maps or keys to `$ignored` without checking their values, so Helm reports settings as ignored even though they request no pod configuration.
Exclude null-valued fields when deciding whether context settings are ignored.
Also at `charts/tesk/templates/_helpers.tpl:548-549`.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 6 findings to address first, and the chart now forwards security contexts and resource settings that determine how taskmaster, filer, and executor pods run; a mapping or precedence error could leave pods rejected or running with unintended security or resource constraints. Reverting restores the chart behavior, but task pods already created with the wrong settings may continue until they are stopped or finish.
Blocking findings: charts/tesk/templates/_helpers.tpl:262, charts/tesk/templates/_helpers.tpl:256, tests/smoke/restricted/values.yaml:12, .github/actions/install-chart/action.yml:10, tests/test_chart.py:5127, and 1 more
Fail on boolean resource quantities instead of passing "true" on; let the notes ignore null fields of task pod contexts; derive the expected warning of the chart's default tesk-api tag from appVersion. Refs #330 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Closes #330
Summary
Values for namespaces that enforce the
restrictedPod Security Standard and have a quota onlimits.cpu(CERIT-SC, generic-issues#122):tesk.taskmaster.podSecurityContext,securityContext,resources;tesk.filer.resources;tesk.executor.podSecurityContext,securityContext(now the container's context),defaultCpu. They map to the env vars of tesk-api 2.1.0 (tesk-api#210) and toFILER_RESOURCES(taskmaster 0.12.0+). Quantities go on as strings.runAsUser/runAsGroup/fsGroup/runAsNonRootstill go into the<prefix>-executorConfigMap, so tesk-api 2.0.0 still applies them.fsGroupintesk.executor.securityContextfails with a hint to move it topodSecurityContext(breaking, see upgrading.md).tesk.filer.resourceswith a taskmaster older than 0.12.0.chart-installis a matrix,Chart install (default)andChart install (restricted). The restricted case labels the namespace with PSAenforce=restricted, appliestests/smoke/restricted/quota.yaml(alimits.cpuquota and a 512Mi default memory limit) and installs withtests/smoke/restricted/values.yaml. The required check is still onlyCI passed, so the ruleset doesn't change.release.ymlstill installs the default case only.Decisions taken
securityContext/podSecurityContextsplit for executors, withfsGroupmoving topodSecurityContext(main session, 2026-11-22). The CERIT runbook gi-122 was updated to match. uniqueg may veto.Release dependency
tests/smoke/restricted/values.yamlpins the tesk-api dev imagesha-b87b051…(the merge of tesk-api#210) until tesk-api 2.1.0 is released.test_restricted_values_pinfails onceappVersionis 2.1.0 or later and the pin is still there, so the chart's release prep has to remove it.Verification
REQUIRE_HELM=1 pytest tests/test_chart.py(Helm 3.22.1): 981 passed. The fullpytestrun passed too (1178 at the time).pre-commit run --all-files: all hooks pass (ruff, mypy, actionlint, check-yaml, …).mkdocs build --strict: OK.tests/smoke/deployment.shpassed: a task COMPLETE, a task with an input COMPLETE (filer with its hardened defaults), and a cancelled task CANCELED. The events showed no admission refusals.Declined review findings
Round 2, low: tell the schema refusal from the template refusal in test_executor_default_cpu_zero. Declined because either refusal is correct.
Quality review, low: share one list of legacy executor fields between
tesk.executorSecurityContextand the notes. Declined because Helm templates make sharing awkward, and the tests pin the behaviour.Quality review, low: enforce "no
fsGroupin the container context" in the schema too. Declined because the template's failure carries the migration hint, which a schema error wouldn't.🤖 Generated with Claude Code
Summary by Sourcery
Support deploying the chart in namespaces enforcing the restricted Pod Security Standard or CPU quotas by configuring task pod security contexts and resources.
New Features:
Bug Fixes:
Enhancements:
CI:
Documentation:
Tests: