You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(chart): the agent DaemonSet says which external-harness contract version its chart was packaged with, and a contract bump rolls no pod (#1544) - #1627
A harness outside this repository pins a version of test/harnesscontract/external-harness.yaml. Until now a deployed mesh could not say which one it satisfies.
The external-harness contract changed: one new entry (object.annotation.harness_contract_version) and one new key on an existing object. Both are additions, so version stays 2.
What a harness reads
kubectl -n aether-system get daemonset aether-agent \
-o jsonpath='{.metadata.annotations.aether\.io/harness-contract-version}'
It identifies the contract, not the build. Charts of different versions answer the same while the contract's version stays, and it says nothing about which images run.
An empty answer is "not known", never a version: a chart older than 2.4.28, or one rendered from the source tree.
How the value gets there
//test/harnesscontract exports external-harness.yaml to //charts/aether only.
The genrule //charts/aether:harness_contract_version reads the top-level version: line into files/harness-contract-version. It fails the build unless there is exactly one such line and it holds a positive integer.
Both packagings (:aether, :aether_commit) pass that file in files.
The helper aether.harnessContractVersion reads it with .Files.Get, and agent-daemonset.yaml writes it as an annotation on the DaemonSet's own metadata.
There is no literal anywhere. A contract bump edits nothing under charts/.
The annotation is optional in the template. A render of the source tree (helm template charts/aether, which the conformance action and one ci.yaml step run) has no generated file and renders no annotation.
Upgrade
Chart 2.4.28 (main is at 2.4.27). Nothing to set, nothing to do before upgrading.
No workload rolls for this change. Every pod template is byte-identical before and after.
The agent DaemonSet object's metadata gains one annotation.
The helm.sh/chart label on each object's own metadata changes, as with every chart version.
Measured on packages built unstamped on one workstation from the base commit 9359b9f6 and from this branch, rendered with helm template and a kubeconfig that names no cluster:
The source-tree render of this branch holds no line with the key.
The two jsonpath expressions in the runbook were run over the rendered DaemonSet with kubectl 1.35.1's own printer and no cluster: the first prints 2, the second (the pod template) prints an empty line. Nothing here was run on a cluster. The runbook section "Chart 2.4.28" has the commands to run after a deploy, including reading the agent pods' controller-revision-hash before and after.
A later contract bump changes what both packagings render without a Chart.yaml bump. That is the intent. The bare <X.Y.Z> tag is already rewritten by every commit (#1588); the <X.Y.Z>-<sha> tag stays unique.
Decisions
Annotation, on the object. Not a label: nothing selects by a contract version, and an annotation cannot end up in a selector. Not on a pod template: a contract bump must replace no pod.
No render failure for a malformed file (the earlier design had one). The build step refuses to produce such a file and the contract test compares the value, so that branch of the template could only be reached, or tested, through a second hand-made package. Left out.
The check lives in the contract's chart test, as a new object key contract_version_annotation: <names entry>. The entry has no Go constant (only the chart writes the key), so its checked_by is //test/harnesscontract:aether_chart_test, which holds the object to: that key on its own metadata, the contract's version as a string for its value, and the key nowhere else (not a label, not on a pod template, on no other object of the render). The version it compares with is the one the contract library parses, an independent read from the genrule's.
Both packagings are held to the contract.helm_contract_test gains other_packagings; the aether test now renders :aether_commit too. That covers the whole contract for the per-commit package, not only the annotation.
A new rule, helm_pod_template_file_test, because no existing rule can render a package with a file changed or removed. It unpacks the package three times (as is, another number in the file, no file) and requires: byte-identical pod templates in all three, exactly changed_lines rendered lines following the file, and a file-less render that only loses lines. It has its own fixture chart and a self-test of six failing cases.
Left unchanged on purpose: the contract's version, every existing promise and lock line, every pod template.
Tests
Seen red first, against the unchanged chart:
//test/harnesscontract:aether_chart_test: DaemonSet/aether-agent has no annotation aether.io/harness-contract-version ... on its own metadata, for each packaging.
//charts/aether:aether_harness_contract_version_rolls_no_pod_test, ..._all_enabled_test, aether_commit_..._test: the render is the same with other content in files/harness-contract-version: no template reads it.
//charts/aether:aether_harness_contract_version_annotation_test: the pattern stops at labels:.
//test/harnesscontract:harnesscontract_test (TestVersionBump) printed the two lock lines to add.
Mutations, each reverted:
Mutation
Fails
The annotation also on the agent pod template
the three rolls_no_pod tests (a pod template changes with other content ..., workload DaemonSet/release-aether-agent) and aether_chart_test (also carries ... as an annotation of its pod template)
The build step writes another number
aether_chart_test (with the value "20", and ... is at version 2), both packagings
:aether_commit without files
aether_commit_..._rolls_no_pod_test and aether_chart_test
version: "2", or a second version: line, in the contract
the genrule fails the build with a message naming the file
Run locally on the final tree: bazel test //charts/... //test/harnesscontract/... //test/harnesscontract:checks //bazel/helm/... (280 pass), both packagings built, bazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation over the same three trees, make format-check, scripts/check-chart-version-bump.sh, scripts/check-harness-contract-bump.sh origin/main, scripts/check-shell-lint.sh, and --config=race on the two Go tests touched.
Also fixed
scripts/check-harness-contract-bump.sh sorted the lock's promise lines by bytes and compared them with comm in the caller's locale. Under a UTF-8 locale comm found them "not in sorted order" and reported promises as gone that were still there, so a lock that only gained lines failed the check. The script now sets LC_ALL=C for everything it runs. //scripts:check_harness_contract_bump_test gained five cases run under a UTF-8 locale over names whose byte order and locale order differ; two were red first (an added line reported as 3 broken promises, under en_US.utf8). The cases are skipped with a note on a host with no UTF-8 locale, and under C.UTF-8 alone they would not have been red.
Docs
docs/runbook.md: "The external-harness contract" (which contract a deployed mesh satisfies) and "Chart 2.4.28" (what an upgrade changes, what to run afterwards).
test/harnesscontract/README.md: where a harness reads it, the new row of the tie table, the new tie.
docs/configuration.md, charts/README.md (the new rule's row).
… version its chart was packaged with, and a contract bump rolls no pod (#1544)
A harness outside the repository pins a `version` of
test/harnesscontract/external-harness.yaml and had no way to ask a deployed
mesh which one it satisfies.
- charts/aether (2.4.28): a build step reads `version` from the contract file
into the package (files/harness-contract-version); both packagings carry it,
and the agent DaemonSet's own metadata renders it as the annotation
aether.io/harness-contract-version. No literal anywhere: a contract bump
edits nothing under charts/. A render of the source tree has no such file
and renders no annotation.
- The annotation is on the object, never on a pod template. New rule
helm_pod_template_file_test renders a package as it is, with another number
in the file and without the file, and requires every pod template to be
byte-identical.
- The key is a contract entry (object.annotation.harness_contract_version, no
version bump), tied to the render by a new object key,
contract_version_annotation: aether_chart_test compares the rendered
annotation with the version the contract library loads, and now renders the
per-commit packaging as well.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
…llation, whatever the caller's locale
scripts/check-harness-contract-bump.sh sorted the promise lines by bytes and
compared them with comm in the caller's locale. Under a UTF-8 locale comm
found them "not in sorted order" and reported promises as gone that were still
there: a lock that only gained lines failed the check. The script now sets
LC_ALL=C for everything it runs; the test runs it under a UTF-8 locale over
names whose byte order and locale order differ.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The version-only marker cannot distinguish additive contract revisions, so older packages may falsely appear compatible with newer harness expectations.
0 open findings
Previously missed (1)
In code that hasn't changed since last review
Contract version does not change for additive compatibility changes
This value cannot reliably tell a harness that the deployed chart satisfies the contract it was written against. The contract’s own compatibility rules allow new entries, rendered objects, and additional promises without changing version (test/harnesscontract/README.md:55-57). After the next such addition, both an older package and the new package will advertise "2", although a harness written against the newer contract may rely on behavior the older package lacks. Please expose a monotonically changing contract revision/digest in addition to the compatibility version, or bump the advertised identifier for every additive contract change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1544
A harness outside this repository pins a
versionoftest/harnesscontract/external-harness.yaml. Until now a deployed mesh could not say which one it satisfies.The external-harness contract changed: one new entry (
object.annotation.harness_contract_version) and one new key on an existing object. Both are additions, soversionstays 2.What a harness reads
kubectl -n aether-system get daemonset aether-agent \ -o jsonpath='{.metadata.annotations.aether\.io/harness-contract-version}'versionstays, and it says nothing about which images run.How the value gets there
//test/harnesscontractexportsexternal-harness.yamlto//charts/aetheronly.//charts/aether:harness_contract_versionreads the top-levelversion:line intofiles/harness-contract-version. It fails the build unless there is exactly one such line and it holds a positive integer.:aether,:aether_commit) pass that file infiles.aether.harnessContractVersionreads it with.Files.Get, andagent-daemonset.yamlwrites it as an annotation on the DaemonSet's own metadata.There is no literal anywhere. A contract bump edits nothing under
charts/.The annotation is optional in the template. A render of the source tree (
helm template charts/aether, which the conformance action and oneci.yamlstep run) has no generated file and renders no annotation.Upgrade
Chart
2.4.28(main is at2.4.27). Nothing to set, nothing to do before upgrading.helm.sh/chartlabel on each object's own metadata changes, as with every chart version.Measured on packages built unstamped on one workstation from the base commit
9359b9f6and from this branch, rendered withhelm templateand a kubeconfig that names no cluster::aether,controller.webhook.spire=true,edge.enabled=truee2cecd325905b8a4e2cecd325905b8a4:aether, default values173db91985a6afff173db91985a6afff:aether_commit,controller.webhook.spire=true,edge.enabled=truee2cecd325905b8a4e2cecd325905b8a4The whole-render diff of the first row is 40
helm.sh/chart: aether-2.4.27→aether-2.4.28lines and this, on the agent DaemonSet:The source-tree render of this branch holds no line with the key.
The two
jsonpathexpressions in the runbook were run over the rendered DaemonSet with kubectl 1.35.1's own printer and no cluster: the first prints2, the second (the pod template) prints an empty line. Nothing here was run on a cluster. The runbook section "Chart 2.4.28" has the commands to run after a deploy, including reading the agent pods'controller-revision-hashbefore and after.A later contract bump changes what both packagings render without a
Chart.yamlbump. That is the intent. The bare<X.Y.Z>tag is already rewritten by every commit (#1588); the<X.Y.Z>-<sha>tag stays unique.Decisions
contract_version_annotation: <names entry>. The entry has no Go constant (only the chart writes the key), so itschecked_byis//test/harnesscontract:aether_chart_test, which holds the object to: that key on its own metadata, the contract'sversionas a string for its value, and the key nowhere else (not a label, not on a pod template, on no other object of the render). The version it compares with is the one the contract library parses, an independent read from the genrule's.helm_contract_testgainsother_packagings; the aether test now renders:aether_committoo. That covers the whole contract for the per-commit package, not only the annotation.helm_pod_template_file_test, because no existing rule can render a package with a file changed or removed. It unpacks the package three times (as is, another number in the file, no file) and requires: byte-identical pod templates in all three, exactlychanged_linesrendered lines following the file, and a file-less render that only loses lines. It has its own fixture chart and a self-test of six failing cases.version, every existing promise and lock line, every pod template.Tests
Seen red first, against the unchanged chart:
//test/harnesscontract:aether_chart_test:DaemonSet/aether-agent has no annotation aether.io/harness-contract-version ... on its own metadata, for each packaging.//charts/aether:aether_harness_contract_version_rolls_no_pod_test,..._all_enabled_test,aether_commit_..._test:the render is the same with other content in files/harness-contract-version: no template reads it.//charts/aether:aether_harness_contract_version_annotation_test: the pattern stops atlabels:.//test/harnesscontract:harnesscontract_test(TestVersionBump) printed the two lock lines to add.Mutations, each reverted:
rolls_no_podtests (a pod template changes with other content ..., workloadDaemonSet/release-aether-agent) andaether_chart_test(also carries ... as an annotation of its pod template)aether_chart_test(with the value "20", and ... is at version 2), both packagings:aether_commitwithoutfilesaether_commit_..._rolls_no_pod_testandaether_chart_testversion: "2", or a secondversion:line, in the contractRun locally on the final tree:
bazel test //charts/... //test/harnesscontract/... //test/harnesscontract:checks //bazel/helm/...(280 pass), both packagings built,bazel build --config=lint --@aspect_rules_lint//lint:fail_on_violationover the same three trees,make format-check,scripts/check-chart-version-bump.sh,scripts/check-harness-contract-bump.sh origin/main,scripts/check-shell-lint.sh, and--config=raceon the two Go tests touched.Also fixed
scripts/check-harness-contract-bump.shsorted the lock's promise lines by bytes and compared them withcommin the caller's locale. Under a UTF-8 localecommfound them "not in sorted order" and reported promises as gone that were still there, so a lock that only gained lines failed the check. The script now setsLC_ALL=Cfor everything it runs.//scripts:check_harness_contract_bump_testgained five cases run under a UTF-8 locale over names whose byte order and locale order differ; two were red first (an added line reported as 3 broken promises, underen_US.utf8). The cases are skipped with a note on a host with no UTF-8 locale, and underC.UTF-8alone they would not have been red.Docs
docs/runbook.md: "The external-harness contract" (which contract a deployed mesh satisfies) and "Chart 2.4.28" (what an upgrade changes, what to run afterwards).test/harnesscontract/README.md: where a harness reads it, the new row of the tie table, the new tie.docs/configuration.md,charts/README.md(the new rule's row).🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr