Skip to content

fix: support revision-scoped HA pod anti-affinity - #208

Merged
borg-z merged 1 commit into
mainfrom
fix/ha-anti-affinity-pod-template-hash
Aug 10, 2026
Merged

fix: support revision-scoped HA pod anti-affinity#208
borg-z merged 1 commit into
mainfrom
fix/ha-anti-affinity-pod-template-hash

Conversation

@mary-ppv

Copy link
Copy Markdown
Contributor

Description

Added optional revision-scoped pod anti-affinity to helm_lib_pod_anti_affinity_for_ha.

Callers can enable it using:

{{ include "helm_lib_pod_anti_affinity_for_ha" (list . (dict "app" "test") (dict "revisionScoped" true)) }}

When enabled, the helper adds:

matchLabelKeys:
- pod-template-hash

Existing calls remain unchanged because revision scoping is disabled by default.

Why do we need it?

During a Deployment rolling update, required pod anti-affinity based only on common application labels can prevent a pod from the new ReplicaSet from being scheduled alongside a pod from the old ReplicaSet.

Scoping the rule by pod-template-hash keeps replicas of the same revision distributed across different nodes, while allowing pods from different revisions to temporarily run on the same node. This prevents rollouts from becoming blocked during transitions such as HA to non-HA.

The behavior is opt-in to avoid changing scheduling semantics for existing users of the helper.

Testing

Added unit tests verifying that:

  • existing calls do not render matchLabelKeys;
  • calls with revisionScoped: true render pod-template-hash;
  • pod anti-affinity is not rendered when HA is disabled.

All unit tests passed:

Test Suites: 83 passed
Tests: 358 passed

The generated Helm library documentation was updated.

Version

Bumped the chart patch version from 1.72.13 to 1.72.14.

Signed-off-by: Maria Popova <mary_ppv@mail.ru>
@mary-ppv
mary-ppv force-pushed the fix/ha-anti-affinity-pod-template-hash branch from 8a20d22 to faa1213 Compare August 10, 2026 13:33
@mary-ppv
mary-ppv requested a review from borg-z August 10, 2026 13:36
@mary-ppv
mary-ppv marked this pull request as ready for review August 10, 2026 13:36
@borg-z
borg-z merged commit 302405f into main Aug 10, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants