Skip to content

fix(chart): the prober chart renders every resources block through a helper, and the authz-canary resources become values (#1361, #1362) - #1365

Merged
bpalermo merged 2 commits into
mainfrom
fix/prober-resources-helper
Oct 7, 2026
Merged

bpalermo merged 2 commits into
mainfrom
fix/prober-resources-helper

Conversation

@bpalermo

@bpalermo bpalermo commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Closes #1361
Closes #1362

Written by an agent (Claude Code).

What changes

The prober chart renders three containers. All three now render their resources through a new prober.resources helper (a copy of aether.resources; charts do not share templates), which leaves out an empty or null quantity instead of rendering cpu: "".

Workload Container Values key Before After
DaemonSet prober prober resources toYaml helper
Deployment authz-echo echo authzCanary.echo.resources (new) literal in the template helper
Deployment authz-canary curl authzCanary.resources (new) literal in the template helper

New values keys, defaults equal to the former literals:

authzCanary:
  resources:            # the curl client
    requests: {cpu: 10m, memory: 16Mi}
    limits: {memory: 32Mi}
  echo:
    resources:          # each echo replica
      requests: {cpu: 10m, memory: 32Mi}
      limits: {memory: 64Mi}

Documented in charts/prober/values.yaml and in a new "Resources" paragraph of the prober section of docs/configuration.md (the three keys, how to remove a default, and a command to check a release's values against the chart).

Chart prober 1.0.3 -> 1.0.4. No Go change, no workflow change, charts/aether untouched.

One file outside the chart: bazel/helm/defs.bzl gains a test rule, helm_template_match_test. See "Tests" for why it was needed.

No default changes, so no GOMAXPROCS decision

The prober is a Go binary, but this pull request changes no default: no container gains or loses a CPU limit, so there is no GOMAXPROCS decision to make. (The prober already ships without a CPU limit and without a GOMAXPROCS pin; that is unchanged here.)

Unchanged values (measured)

Renders of origin/main (90718a7) against this branch, Helm 3.18.4, helm template prober <chart> -n aether-test, build stamps replaced by fixed text on both sides.

Default values: byte-identical apart from the chart version label. 104 lines. The only differing lines are the three helm.sh/chart: prober-1.0.3-… -> prober-1.0.4-… labels. With the label set back, cmp reports no difference (sha256 cbc1e372… on both sides).

authzCanary.enabled=true: the same objects, but NOT byte-identical. 346 lines. Apart from the eight version labels, two blocks have their two keys in the other order:

           resources:
+            limits:
+              memory: 64Mi
             requests:
               cpu: 10m
               memory: 32Mi
-            limits:
-              memory: 64Mi

(and the same for the curl container with 32Mi / 16Mi). The literals were written requests then limits; the helper ends in toYaml, which sorts keys, so it writes limits then requests, as the prober container and every container of charts/aether already do. Parsing both renders as YAML and comparing the seven objects gives equality (with the version label set back). So the two canary Deployments' pod templates are unchanged as objects.

I chose the helper's order over keeping the text identical: the alternative is a second code path that emits the two keys by hand in the old order, for these two containers only. If the text must stay identical, say so and I will do that instead.

Emptied CPU limit, before and after (measured)

--set resources.limits.cpu= on origin/main:

          resources:
            limits:
              cpu: ""
              memory: 64Mi

On this branch:

          resources:
            limits:
              memory: 64Mi
            requests:
              cpu: 100m
              memory: 32Mi

With the canary on and the CPU limit emptied on all three keys, this branch renders 0 lines reading cpu: "" (origin/main: 1, and it ignores the two canary keys).

Tests, red first

16 targets in charts/prober/BUILD.bazel (5 existed). Against the unchanged templates and values, 9 of the 11 new ones failed ("7 tests pass and 9 fail locally"); after the change all 16 pass.

Test Unchanged chart Why
prober_empty_cpu_limit_test red cpu: "" rendered
prober_empty_cpu_request_test red cpu: "" rendered
prober_default_resources_test, prober_cpu_limit_override_test green (guards) behaviour that must not change
prober_authz_echo_resources_override_test, prober_authz_curl_resources_override_test red the operator's value was ignored
prober_authz_echo_empty_cpu_request_test, prober_authz_curl_empty_cpu_request_test red the literal cpu: 10m could not be removed
prober_authz_echo_empty_cpu_limit_test, prober_authz_curl_empty_cpu_limit_test, prober_authz_canary_default_resources_test red, but only for the key order see below

One failing line, from prober_empty_cpu_limit_test:

Error: The file `prober/templates/daemonset.yaml` does not contain the pattern:
drop:\n\s+- ALL\n\s+resources:\n\s+limits:\n\s+memory: 64Mi\n\s+requests:\n\s+cpu: 100m\n\s+memory: 32Mi\s*$

The last row deserves a caveat. The literals had no CPU limit, so "emptying the CPU limit renders no cpu key" was already true on main; those three tests were red there only because the pattern expects the helper's key order. To show the two empty-limit tests can fail for the right reason, I temporarily rendered the canary blocks with plain toYaml instead of the helper: both empty-limit tests and both empty-request tests failed (4 red, cpu: "" in the render), and passed again with the helper restored.

Each canary pattern is anchored on the line before its container's block (seconds: 5 for echo, the script's done for curl) and each test also asserts the other container's block, so a test cannot be satisfied by the wrong container.

Why a new test rule

helm_template_test's template_patterns cannot test the canary containers. Its runner (rules_helm helm/private/runner/runner.go, parseHelmOutput) splits the render on --- and stores each document in a map keyed by its # Source: path, so for a template that renders several documents only the last one printed is searched. authz-canary.yaml renders five; the last is the HTTPFilter. I first wrote the canary tests as helm_template_test and they still failed after the fix, with the expected block visibly present in the output.

helm_template_match_test (next to the repository's existing helm_template_fail_test and helm_template_absent_test) matches each pattern against the whole render. Patterns are POSIX extended regular expressions matched by bash itself, with \n and \s translated by the runner, so the rule needs no particular grep (a review comment pointed out that grep -P is GNU-only). The prober container's tests stay on helm_template_test: the DaemonSet is a single-document template.

Verification

  • bazel test //charts/... //bazel/helm/...: 127 of 127 pass.
  • bazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //...: succeeds.
  • make format-check: succeeds.

What an operator does on upgrade

Nothing. Values that rendered before render the same objects. As with every prober chart release, the DaemonSet rolls, because its pod template carries the helm.sh/chart label. The two canary Deployments do not roll: their pod templates carry no version label and are unchanged as objects (inferred from the parsed comparison above; not applied to a cluster).

To check a release's values against the new chart first (read the values back; never --reuse-values):

helm get values prober -n <namespace> -o yaml > values.yaml
helm template prober <chart 1.0.4> -n <namespace> -f values.yaml | grep -n -E '^[[:space:]]+(cpu|memory): (""|null)?$'

No output means no container carries an empty quantity. There is nothing to measure after a deploy: no request or limit changes, so no CFS or memory series should move.

Not verified

  • Nothing was applied to a cluster. That the apiserver rejects cpu: "" is taken from the issue, and that a reordered-but-equal pod template causes no rollout is inferred from the objects being equal.
  • helm_template_match_test was run on Linux only. It relies on bash and the C library's regular expressions; I could not run it on macOS.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

…ober.resources; the authz-canary resources are values (#1361, #1362)

#1361: charts/prober rendered the prober container's resources with plain
toYaml, so `--set resources.limits.cpu=` rendered `cpu: ""`, which the
apiserver rejects. The chart gets its own copy of the aether chart's
resources helper (prober.resources), which drops an empty or null quantity.

#1362: the two authz-canary containers had their resources written into the
template. They are now `authzCanary.resources` (the curl client) and
`authzCanary.echo.resources` (the echo target), defaulting to the former
literals and rendered through the same helper.

Tests: rules_helm's template_patterns only search the document helm prints
last for a template, so they cannot see the two Deployments in
authz-canary.yaml. bazel/helm gains helm_template_match_test, which matches
multi-line patterns against the whole render.

Chart prober 1.0.3 -> 1.0.4. No default value changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
Copilot AI balanced review requested due to automatic review settings October 7, 2026 22:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new tests and documented check rely on non-portable GNU grep behavior.

2 open findings
What changed in this PR

Adds configurable, empty-safe resource rendering across all prober chart containers.

Changes:

  • Adds shared resource rendering and authz-canary resource values.
  • Expands Helm rendering tests with whole-output matching.
  • Documents behavior and bumps the chart to 1.0.4.
File Description
docs/​configuration.md Documents resource configuration and validation.
charts/​prober/​values.yaml Adds canary resource defaults.
charts/​prober/​templates/​daemonset.yaml Uses the resource helper.
charts/​prober/​templates/​authz-canary.yaml Makes canary resources configurable.
charts/​prober/​templates/​_helpers.tpl Adds empty-safe resource rendering.
charts/​prober/​Chart.yaml Bumps chart version.
charts/​prober/​BUILD.bazel Adds resource rendering tests.
bazel/​helm/​defs.bzl Adds whole-render matching test rule.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread bazel/helm/defs.bzl Resolved
Comment thread docs/configuration.md Resolved
…-P; the documented check uses [[:space:]]

Review of #1365. `grep -P` is GNU-only (BSD grep on macOS has no -P), so the
rule depended on the host's grep. Patterns are now POSIX extended regular
expressions matched by bash's `[[ =~ ]]`, with `\n` and `\s` translated by the
runner. The check command in docs/configuration.md used `\s` under `grep -E`,
which BSD grep reads as a literal `s`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
Copilot AI balanced review requested due to automatic review settings October 7, 2026 22:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The implementation addresses both issues with matching documentation, chart versioning, and focused regression coverage.

0 open findings

2 resolved since last review

🧠 Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants