RoadieHQ / kubewise

Get Helm notifications in your team chat
Apache License 2.0
59 stars 6 forks source link

Helm chart support for tolerations and nodeSelector - easy #58

Open joncrlsn opened 1 year ago

joncrlsn commented 1 year ago

Hi! Thanks for a great tool! Most 3rd party helm charts we've used support tolerations: and nodeSelector: at the top level of the values.yaml file to help control which nodepool it will run on. It is pretty easy to implement. If you'd like a merge request, let me know.

default values.yaml:

...
tolerations: []
nodeSelector: {}
...

Overridden values.yaml example:

...
tolerations:
  - key: my-pool
    effect: NoSchedule
    operator: Exists
nodeSelector:
  cloud.google.com/gke-nodepool: my-pool

They are placed under spec.template.spec in the deployment template.

...
spec:
  ...
  template:
    ...
    spec:
    {{- if .Values.tolerations }}
      tolerations:
        {{- .Values.tolerations | toYaml | nindent 8 }}
    {{- end }}
    {{- if .Values.nodeSelector }}
      nodeSelector:
        {{- .Values.nodeSelector | toYaml | nindent 8 }}
    {{- end }}

Thanks!