From 3941787cd0565d923afd460f2589bcb49e8183ef Mon Sep 17 00:00:00 2001 From: Jason Hancock Date: Tue, 23 Feb 2021 16:03:50 -0800 Subject: [PATCH] sriov: support for tolerations --- sriov/templates/_helpers.tpl | 12 ++++++++++++ sriov/templates/daemonSet_sriov_cni.yaml | 4 +--- sriov/templates/daemonSet_sriov_device_plugin.yaml | 4 +--- 3 files changed, 14 insertions(+), 6 deletions(-) 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 5425cf0..ebd3646 100644 --- a/sriov/templates/daemonSet_sriov_device_plugin.yaml +++ b/sriov/templates/daemonSet_sriov_device_plugin.yaml @@ -38,9 +38,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