Skip to content

feat(charts): support topologySpreadConstraints on every deployment - #210

Merged
IxDay merged 1 commit into
lago-v2from
feat/topology-spread-constraints
Jun 16, 2026
Merged

feat(charts): support topologySpreadConstraints on every deployment#210
IxDay merged 1 commit into
lago-v2from
feat/topology-spread-constraints

Conversation

@IxDay

@IxDay IxDay commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds an optional topologySpreadConstraints value to every chart that renders a standard Kubernetes Deployment, alongside the existing nodeSelector, tolerations, and affinity fields. Defaults to [], rendered only when non-empty — existing manifests are unchanged.

Affected charts:

  • lago-rails (api / clock / *-worker releases)
  • lago-front
  • lago-pdf (under .gotenberg.topologySpreadConstraints)
  • lago-mcp-server
  • lago-data-api
  • lago-data-worker
  • lago-events-processor-worker

Skipped: lago-data-rev-rec renders a FlinkDeployment (Flink operator CR), not a standard Deployment, and currently exposes no scheduling fields at all. Spread support there would land in jobManager.podTemplate / taskManager.podTemplate separately.

Motivation

We need to spread the staging main api's 3 replicas across 3 distinct nodes (to mimic production), and topologySpreadConstraints is the cleanest expression. Today only affinity.podAntiAffinity works (see lago-deploy#2097).

Test plan

  • task test:unit — the shared tests-common/deployment/common_patterns_test.yaml now covers topologySpreadConstraints; all 6 charts that consume it (rails, front, mcp-server, data-api, data-worker, events-processor-worker) pass with the new assertions.
  • task lint:all — 14/14 charts lint successfully.
  • Once merged & released, replace the affinity.podAntiAffinity block in lago-deploy/staging/staging-main-values.yaml with topologySpreadConstraints and confirm the 3 api pods land on 3 distinct nodes.

Add an optional topologySpreadConstraints value to every chart that
renders a standard Kubernetes Deployment, alongside the existing
nodeSelector, tolerations, and affinity scheduling fields. The value
defaults to [] and is rendered only when non-empty, so existing manifests
are unchanged.

Affected charts:
- lago-rails (api / clock / *-worker releases)
- lago-front
- lago-pdf (under .gotenberg.topologySpreadConstraints)
- lago-mcp-server
- lago-data-api
- lago-data-worker
- lago-events-processor-worker

Also extend tests-common/deployment/common_patterns_test.yaml so every
deployment chart that consumes the shared test suite asserts that
topologySpreadConstraints render through to the pod spec.

lago-data-rev-rec is intentionally skipped — it renders a FlinkDeployment
(Flink operator CR), not a standard Deployment, and currently exposes no
scheduling fields at all. Adding spread support there is a separate
change.
@IxDay
IxDay merged commit 6031f24 into lago-v2 Jun 16, 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.

1 participant