Files
kubevela/pkg/appfile
Ankit kumar 4f7d787871 Fix: make podDisruptive actually trigger pod restart . (#7231)
* fix: make podDisruptive actually trigger pod restart for outputs-based traits

When a TraitDefinition sets podDisruptive: true but renders its output
via outputs: (e.g. a ConfigMap) instead of patch:, the workload's pod
was never restarted when the trait's content changed - podDisruptive
was effectively a no-op.

This adds propagatePodDisruptiveHash, called from SetOAMContract for
every rendered trait. When the trait's TraitDefinition has
podDisruptive: true and the target workload has a spec.template, a
content hash of the trait's rendered output is stamped onto
spec.template.metadata.annotations as
app.oam.dev/trait-restart-hash-<traitType>. Since this lives inside
spec.template, any change to the trait's content changes the pod
template, causing the owning controller (Deployment/StatefulSet/...)
to roll the pods automatically.

Fixes #7204

Signed-off-by: Ankit Kumar <ankitkumarrain12@gmail.com>

* fix: address cubic review for podDisruptive restart hash

Harden annotation key length checks against the Kubernetes name-segment
limit (63 chars after the slash) and document selective metadata hashing
so user name/labels/annotations change the restart hash while
controller/OAM revision churn does not. Expand unit coverage and drop a
duplicate test case.

Signed-off-by: Ankit Kumar <ankitkumarrain12@gmail.com>

* Revert "fix: address cubic review for podDisruptive restart hash"

This reverts commit d666da0024099b8935347137cac81609b7c1d84a.

Signed-off-by: Ankit Kumar <ankitkumarrain12@gmail.com>

---------

Signed-off-by: Ankit Kumar <ankitkumarrain12@gmail.com>
2026-07-15 11:12:15 +01:00
..