---
id: scheduling-affinity-on
name: "Capability: affinity settable on ALL workloads (ON)"
description: >-
  Renders the product chart with a nodeAffinity rule configured (requiredDuringSchedulingIgnoredDuringExecution preferring kubernetes.io/os=linux) and asserts that every workload pod spec carries the affinity block. The sample chart does NOT expose an affinity knob in its values.yaml and has no affinity block in any Deployment template — setting affinity has no effect. This scenario is EXPECTED to FAIL (honest red gap) documenting that the chart lacks the affinity scheduling knob.
labels: {customer: enterprise, profile: compliance}
cluster:
  provider: kind
  k8s_version: v1.30.0
product:
  chart: ./chart
  release: sample
  namespace: sample
  set:
    affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms[0].matchExpressions[0].key: kubernetes.io/os
    affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms[0].matchExpressions[0].operator: In
    affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms[0].matchExpressions[0].values[0]: linux
asserts:
  - type: scheduling-present
    namespace: sample
    source: rendered
    expect_present: true
    check_nodeSelector: false
    check_tolerations: false
    check_affinity: true
    check_topologySpreadConstraints: false
    affinity:
      nodeAffinity: true
tags: [capability, compliance]
category: capability
capability: affinity
tier: capability
mechanisms: ["capability:scheduling"]
