diff --git a/sriov/templates/_helpers.tpl b/sriov/templates/_helpers.tpl index a48d162..0e1e040 100644 --- a/sriov/templates/_helpers.tpl +++ b/sriov/templates/_helpers.tpl @@ -27,3 +27,15 @@ app: {{ .Chart.Name }}-dp {{- define "sriov-dp.serviceAccount.Name" }} name: {{ .Values.serviceAccount.name }} {{- end }} + +{{/* Generate SRIOV tolerations */}} +{{- define "sriov.tolerations" }} +- key: node-role.kubernetes.io/master + operator: Exists + effect: NoSchedule +{{- if index .Values "tolerations" }} +{{- if gt (len .Values.tolerations) 0 }} +{{ toYaml .Values.tolerations }} +{{- end }} +{{- end }} +{{- end }} diff --git a/sriov/templates/daemonSet_sriov_cni.yaml b/sriov/templates/daemonSet_sriov_cni.yaml index 25f63e6..4495c00 100644 --- a/sriov/templates/daemonSet_sriov_cni.yaml +++ b/sriov/templates/daemonSet_sriov_cni.yaml @@ -36,9 +36,7 @@ spec: hostNetwork: true nodeSelector: {{- toYaml .Values.labels.nodeSelector | nindent 8 }} tolerations: - - key: node-role.kubernetes.io/master - operator: Exists - effect: NoSchedule +{{- include "sriov.tolerations" . | indent 6 }} serviceAccountName: {{ .Values.serviceAccount.name }} containers: - name: kube-{{ .Chart.Name }}-cni diff --git a/sriov/templates/daemonSet_sriov_device_plugin.yaml b/sriov/templates/daemonSet_sriov_device_plugin.yaml index bc1e6c9..9f24eb8 100644 --- a/sriov/templates/daemonSet_sriov_device_plugin.yaml +++ b/sriov/templates/daemonSet_sriov_device_plugin.yaml @@ -41,9 +41,7 @@ spec: hostNetwork: true nodeSelector: {{- toYaml .Values.labels.nodeSelector | nindent 8 }} tolerations: - - key: node-role.kubernetes.io/master - operator: Exists - effect: NoSchedule +{{- include "sriov.tolerations" . | indent 6 }} serviceAccountName: {{ .Values.serviceAccount.name }} containers: - name: kube-{{ .Chart.Name }}-dp