Skip to content

EAI-7889 Add pod anti-affinity for SeaweedFS and fix keycloak-old CNPG topology - #803

Merged
silokimmo merged 1 commit into
mainfrom
EAI-7889-pod-anti-affinity
Aug 7, 2026
Merged

EAI-7889 Add pod anti-affinity for SeaweedFS and fix keycloak-old CNPG topology#803
silokimmo merged 1 commit into
mainfrom
EAI-7889-pod-anti-affinity

Conversation

@silokimmo

Copy link
Copy Markdown
Contributor

Related:

Companion to #802 (CNPG topology fix) and #801 (small profile pin). This PR
covers the remaining anti-affinity work from EAI-7889 that those PRs do not
address.

Problem

SeaweedFS — master, volume, and filer have zero anti-affinity. In large
clusters (3 master replicas, 3 volume replicas) all pods can land on one node.
Losing that node takes down the entire S3 storage layer.

keycloak-old CNPG#802 fixed keycloak-config but the active Keycloak
chart is keycloak-old (root/values.yaml maps keycloak to
path: keycloak-old). The keycloak-old CNPG cluster still hardcodes
topology.kubernetes.io/zone, which is a no-op on bare-metal.

Large profile CNPG instance counts — AIRM and Keycloak CNPG run 1 instance
even on large clusters (6+ nodes). A single database instance means no
automatic failover; losing the node requires pod rescheduling and WAL recovery.

Change

SeaweedFS anti-affinity

Add preferredDuringSchedulingIgnoredDuringExecution pod anti-affinity for
master, volume, and filer components in the Seaweed CR template. Topology key
is configurable via seaweed.affinity.topologyKey (default
kubernetes.io/hostname).

Component Large replicas Anti-affinity
master 3 soft, weight 100
volume 3 soft, weight 100
filer 1 soft, weight 100 (future-proofing)

Soft anti-affinity ensures single-node and medium clusters still schedule all
pods without anything sitting Pending.

keycloak-old CNPG topology fix

Same pattern as #802 — expose podAntiAffinityType and topologyKey as
values, defaulting to preferred and kubernetes.io/hostname. Consistent with
the AIRM and AIWB CNPG charts from #802.

Large profile instance counts

App Before After Reason
AIRM CNPG 1 2 Primary + hot standby for automatic failover
Keycloak CNPG 1 2 Auth DB failover in seconds instead of minutes

AIWB CNPG already has 3 instances — no change needed.

Files touched:

  • sources/seaweedfs-config/templates/seaweedfs-seaweed.yaml — anti-affinity blocks
  • sources/seaweedfs-config/values.yaml — affinity defaults
  • sources/keycloak-old/templates/keycloak-cnpg.yaml — templatize topology
  • sources/keycloak-old/values.yaml — topology defaults
  • root/values_large.yaml — AIRM and Keycloak CNPG instances: 2

Testing

  • Deploy on single-node ephemeral VM (medium profile) — verify no scheduling failures
  • Deploy on multi-node cluster (3+ CP nodes) — verify SeaweedFS and CNPG pods spread across nodes
  • helm template ./root on all four profiles

@silokimmo
silokimmo requested a review from a team as a code owner August 7, 2026 08:42
@oskarasbrink

Copy link
Copy Markdown
Contributor

once testing steps are done, this is great

…G topology

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
@silokimmo
silokimmo force-pushed the EAI-7889-pod-anti-affinity branch from 14625db to 7e87085 Compare August 7, 2026 10:58
@silokimmo
silokimmo merged commit 350e881 into main Aug 7, 2026
7 checks passed
@silokimmo
silokimmo deleted the EAI-7889-pod-anti-affinity branch August 7, 2026 11:00
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.

3 participants