helm-charts icon indicating copy to clipboard operation
helm-charts copied to clipboard

Enable Helm Template for the Pod affinity

Open joachimBurket opened this issue 5 months ago • 1 comments

Details

Describe the solution you'd like:

Allow to use Helm Template for fields in the affinity block (e.g. defaultPodOptions.affinity).

Additional Information:

I like to set the podAntiAffinity on the hostname to avoid having two Pods of the same application running on the same hosts. Generally, I configure it like so:

[....]
podAntiAffinity:
  requiredDuringSchedulingIgnoredDuringExecution:
    - labelSelector:
        matchExpressions:
          - key: app
            operator: In
            values:
              - "my-app"
      topologyKey: kubernetes.io/hostname
  preferredDuringSchedulingIgnoredDuringExecution:
    - podAffinityTerm:
        labelSelector:
          matchExpressions:
            - key: app
              operator: In
              values:
                - "my-app"
        topologyKey: region
[....]

Enabling Helm Template for the affinity block would allow me to make this re-usable for all my applications, changing my-app by {{ Release.Name }}

joachimBurket avatar Sep 05 '24 13:09 joachimBurket