RoadieHQ / kubewise

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

Helm chart support for tolerations and nodeSelector - easy #58

Open joncrlsn opened 2 years ago

joncrlsn commented 2 years 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!