traefik-helm-chart icon indicating copy to clipboard operation
traefik-helm-chart copied to clipboard

Added templating capabilities for pod anti-affinity

Open paulcrecan opened this issue 3 years ago • 3 comments

Added templating capabilities for pod anti-affinity

paulcrecan avatar Dec 21 '20 14:12 paulcrecan

Hi @SantoDE,

This changes will enable users to template the values used for the affinity section. For example, it will be possible to use the helm release specific values (e.g. .Release.Name, .Release.Namespace..). Basically, this will run the go templating engine for the values that contains a template. An example value for affinity:

affinity: { "podAntiAffinity": { "requiredDuringSchedulingIgnoredDuringExecution": [ { "labelSelector": { "matchExpressions": [ { "key": "app.kubernetes.io/name", "operator": "In", "values": [ '{{ template "traefik.name" . }}' ] }, { "key": "app.kubernetes.io/name", "operator": "In", "values": [ '{{ .Release.Name }}' ] }, ] }, "topologyKey": "kubernetes.io/hostname" } ] }

paulcrecan avatar Jan 04 '21 08:01 paulcrecan

Any update on this? This would actually make the example (which I fixed in https://github.com/traefik/traefik-helm-chart/pull/539) work, since currently you have to hard-code the app name instead of using the {{ template "traefik.name" . }} template.

reitermarkus avatar Jan 05 '22 03:01 reitermarkus

It would be nice to have some tests, maybe even comments. It isn't obvious to me what that code does, just looking at the diff. Though I kinda get it, as I also noticed templating wasn't working in values, adding topologySpreadConstraints with #466

faust64 avatar Jan 07 '22 23:01 faust64

Duplicates of #584.

mloiseleur avatar Sep 29 '22 09:09 mloiseleur

Duplicates of https://github.com/traefik/traefik-helm-chart/pull/584.

@mloiseleur, I don't see how that PR is related to this PR.

reitermarkus avatar Dec 09 '22 10:12 reitermarkus

I guess you meant https://github.com/traefik/traefik-helm-chart/pull/557.

reitermarkus avatar Dec 09 '22 10:12 reitermarkus