You need to sign in or sign up before continuing.
Commit 41775563 by michelia feng Committed by Craig Jellick

Improve linux node selector and tolerations

Problem: New add charts operator-init lack of linux node selector and tolerations Solution: Improve node selector and tolerations
parent 72af4960
...@@ -19,7 +19,7 @@ spec: ...@@ -19,7 +19,7 @@ spec:
release: {{ .Release.Name }} release: {{ .Release.Name }}
baseImage: {{ template "system_default_registry" . }}{{ .Values.image.repository }} baseImage: {{ template "system_default_registry" . }}{{ .Values.image.repository }}
nodeSelector: nodeSelector:
beta.kubernetes.io/os: linux {{- include "linux-node-selector" . | nindent 4 }}
{{- range .Values.nodeSelectors }} {{- range .Values.nodeSelectors }}
{{- $pair := regexSplit "=" . 2 }} {{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }} {{- if eq 2 (len $pair) }}
......
...@@ -56,7 +56,7 @@ spec: ...@@ -56,7 +56,7 @@ spec:
{{ toYaml .Values.tolerations | indent 8 }} {{ toYaml .Values.tolerations | indent 8 }}
{{- end }} {{- end }}
nodeSelector: nodeSelector:
beta.kubernetes.io/os: linux {{- include "linux-node-selector" . | nindent 8 }}
{{- range .Values.nodeSelectors }} {{- range .Values.nodeSelectors }}
{{- $pair := regexSplit "=" . 2 }} {{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }} {{- if eq 2 (len $pair) }}
......
...@@ -73,7 +73,7 @@ spec: ...@@ -73,7 +73,7 @@ spec:
tolerations: tolerations:
- operator: Exists - operator: Exists
nodeSelector: nodeSelector:
beta.kubernetes.io/os: linux {{- include "linux-node-selector" . | nindent 8 }}
{{- range .Values.nodeSelectors }} {{- range .Values.nodeSelectors }}
{{- $pair := regexSplit "=" . 2 }} {{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }} {{- if eq 2 (len $pair) }}
......
...@@ -111,7 +111,7 @@ spec: ...@@ -111,7 +111,7 @@ spec:
{{ toYaml .Values.resources.proxy | indent 10 }} {{ toYaml .Values.resources.proxy | indent 10 }}
{{- end }} {{- end }}
nodeSelector: nodeSelector:
beta.kubernetes.io/os: linux {{- include "linux-node-selector" . | nindent 8 }}
{{- range .Values.nodeSelectors }} {{- range .Values.nodeSelectors }}
{{- $pair := regexSplit "=" . 2 }} {{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }} {{- if eq 2 (len $pair) }}
......
...@@ -11,6 +11,10 @@ spec: ...@@ -11,6 +11,10 @@ spec:
backoffLimit: 3 backoffLimit: 3
template: template:
spec: spec:
nodeSelector:
{{- include "linux-node-selector" . | nindent 8 }}
tolerations:
{{- include "linux-node-tolerations" . | nindent 8}}
serviceAccountName: {{ template "app.fullname" . }} serviceAccountName: {{ template "app.fullname" . }}
containers: containers:
- name: operator-init-crds - name: operator-init-crds
......
...@@ -57,7 +57,7 @@ spec: ...@@ -57,7 +57,7 @@ spec:
resources: resources:
{{ toYaml .Values.resources | indent 12 }} {{ toYaml .Values.resources | indent 12 }}
nodeSelector: nodeSelector:
beta.kubernetes.io/os: linux {{- include "linux-node-selector" . | nindent 8 }}
{{- range .Values.nodeSelectors }} {{- range .Values.nodeSelectors }}
{{- $pair := regexSplit "=" . 2 }} {{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }} {{- if eq 2 (len $pair) }}
......
...@@ -109,7 +109,7 @@ spec: ...@@ -109,7 +109,7 @@ spec:
{{- end }} {{- end }}
{{- end }} {{- end }}
nodeSelector: nodeSelector:
beta.kubernetes.io/os: linux {{- include "linux-node-selector" . | nindent 4 }}
{{- range .Values.nodeSelectors }} {{- range .Values.nodeSelectors }}
{{- $pair := regexSplit "=" . 2 }} {{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }} {{- if eq 2 (len $pair) }}
......
...@@ -136,4 +136,12 @@ add below linux tolerations to workloads could be scheduled to those linux nodes ...@@ -136,4 +136,12 @@ add below linux tolerations to workloads could be scheduled to those linux nodes
value: "linux" value: "linux"
effect: "NoSchedule" effect: "NoSchedule"
operator: "Equal" operator: "Equal"
{{- end -}} {{- end -}}
\ No newline at end of file
{{- define "linux-node-selector" -}}
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}}
beta.kubernetes.io/os: linux
{{- else -}}
kubernetes.io/os: linux
{{- end -}}
{{- end -}}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment