---
id: scheduling-topology-spread-on
name: "Capability: topologySpreadConstraints settable on ALL workloads (ON)"
description: >-
  Renders the product chart with a topologySpreadConstraint configured (maxSkew=1, topologyKey=topology.kubernetes.io/zone, whenUnsatisfiable=DoNotSchedule) and asserts that every workload pod spec carries the constraint. The sample chart does NOT expose a topologySpreadConstraints knob in its values.yaml and has no topologySpreadConstraints block in any Deployment template — setting the constraint has no effect. This scenario is EXPECTED to FAIL (honest red gap) documenting that the chart lacks the topologySpreadConstraints scheduling knob.
labels: {customer: enterprise, profile: compliance}
cluster:
  provider: kind
  k8s_version: v1.30.0
product:
  chart: ./chart
  release: sample
  namespace: sample
  set:
    topologySpreadConstraints[0].maxSkew: 1
    topologySpreadConstraints[0].topologyKey: topology.kubernetes.io/zone
    topologySpreadConstraints[0].whenUnsatisfiable: DoNotSchedule
    topologySpreadConstraints[0].labelSelector.matchLabels.app: sample
asserts:
  - type: scheduling-present
    namespace: sample
    source: rendered
    expect_present: true
    check_nodeSelector: false
    check_tolerations: false
    check_affinity: false
    check_topologySpreadConstraints: true
    topologySpreadConstraints:
      - topologyKey: topology.kubernetes.io/zone
        maxSkew: 1
        whenUnsatisfiable: DoNotSchedule
tags: [capability, compliance]
category: capability
capability: topology-spread-constraints
tier: capability
mechanisms: ["capability:scheduling"]
