traefik-helm-chart
traefik-helm-chart copied to clipboard
Added templating capabilities for pod anti-affinity
Added templating capabilities for pod anti-affinity
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" } ] }
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.
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
Duplicates of #584.
Duplicates of https://github.com/traefik/traefik-helm-chart/pull/584.
@mloiseleur, I don't see how that PR is related to this PR.
I guess you meant https://github.com/traefik/traefik-helm-chart/pull/557.