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:
release: {{ .Release.Name }}
baseImage: {{ template "system_default_registry" . }}{{ .Values.image.repository }}
nodeSelector:
beta.kubernetes.io/os: linux
{{- include "linux-node-selector" . | nindent 4 }}
{{- range .Values.nodeSelectors }}
{{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }}
......
......@@ -56,7 +56,7 @@ spec:
{{ toYaml .Values.tolerations | indent 8 }}
{{- end }}
nodeSelector:
beta.kubernetes.io/os: linux
{{- include "linux-node-selector" . | nindent 8 }}
{{- range .Values.nodeSelectors }}
{{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }}
......
......@@ -73,7 +73,7 @@ spec:
tolerations:
- operator: Exists
nodeSelector:
beta.kubernetes.io/os: linux
{{- include "linux-node-selector" . | nindent 8 }}
{{- range .Values.nodeSelectors }}
{{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }}
......
......@@ -111,7 +111,7 @@ spec:
{{ toYaml .Values.resources.proxy | indent 10 }}
{{- end }}
nodeSelector:
beta.kubernetes.io/os: linux
{{- include "linux-node-selector" . | nindent 8 }}
{{- range .Values.nodeSelectors }}
{{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }}
......
......@@ -11,6 +11,10 @@ spec:
backoffLimit: 3
template:
spec:
nodeSelector:
{{- include "linux-node-selector" . | nindent 8 }}
tolerations:
{{- include "linux-node-tolerations" . | nindent 8}}
serviceAccountName: {{ template "app.fullname" . }}
containers:
- name: operator-init-crds
......
......@@ -57,7 +57,7 @@ spec:
resources:
{{ toYaml .Values.resources | indent 12 }}
nodeSelector:
beta.kubernetes.io/os: linux
{{- include "linux-node-selector" . | nindent 8 }}
{{- range .Values.nodeSelectors }}
{{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }}
......
......@@ -109,7 +109,7 @@ spec:
{{- end }}
{{- end }}
nodeSelector:
beta.kubernetes.io/os: linux
{{- include "linux-node-selector" . | nindent 4 }}
{{- range .Values.nodeSelectors }}
{{- $pair := regexSplit "=" . 2 }}
{{- if eq 2 (len $pair) }}
......
......@@ -136,4 +136,12 @@ add below linux tolerations to workloads could be scheduled to those linux nodes
value: "linux"
effect: "NoSchedule"
operator: "Equal"
{{- end -}}
\ No newline at end of file
{{- end -}}
{{- 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