From 50f2783ab0b15a383326d335c8e01408d233083b Mon Sep 17 00:00:00 2001 From: Phan Le Date: Mon, 15 Mar 2021 12:12:28 -0700 Subject: [PATCH] Allow user to specify priority class and tolerations for Longhorn UI, Driver, Manager Now that we only watch/update managed components, we should allow user to specify Helm values for user deployed components (manager, driver, UI). Longhorn #2120 Signed-off-by: Phan Le --- chart/templates/daemonset-sa.yaml | 7 ++++++ chart/templates/deployment-driver.yaml | 7 ++++++ chart/templates/deployment-ui.yaml | 7 ++++++ chart/templates/postupgrade-job.yaml | 7 ++++++ chart/templates/uninstall-job.yaml | 7 ++++++ chart/values.yaml | 30 ++++++++++++++++++++++++++ 6 files changed, 65 insertions(+) diff --git a/chart/templates/daemonset-sa.yaml b/chart/templates/daemonset-sa.yaml index d1cb711..2a4c205 100644 --- a/chart/templates/daemonset-sa.yaml +++ b/chart/templates/daemonset-sa.yaml @@ -86,7 +86,14 @@ spec: imagePullSecrets: - name: {{ .Values.privateRegistry.registrySecret }} {{- end }} + {{- if .Values.longhornManager.priorityClass }} + priorityClassName: {{ .Values.longhornManager.priorityClass | quote}} + {{- end }} serviceAccountName: longhorn-service-account + {{- if .Values.longhornManager.tolerations }} + tolerations: +{{ toYaml .Values.longhornManager.tolerations | indent 6 }} + {{- end }} updateStrategy: rollingUpdate: maxUnavailable: "100%" diff --git a/chart/templates/deployment-driver.yaml b/chart/templates/deployment-driver.yaml index c4b6e35..65c5b3b 100644 --- a/chart/templates/deployment-driver.yaml +++ b/chart/templates/deployment-driver.yaml @@ -87,6 +87,13 @@ spec: {{- if .Values.privateRegistry.registrySecret }} imagePullSecrets: - name: {{ .Values.privateRegistry.registrySecret }} + {{- end }} + {{- if .Values.longhornDriver.priorityClass }} + priorityClassName: {{ .Values.longhornDriver.priorityClass | quote}} + {{- end }} + {{- if .Values.longhornDriver.tolerations }} + tolerations: +{{ toYaml .Values.longhornDriver.tolerations | indent 6 }} {{- end }} serviceAccountName: longhorn-service-account securityContext: diff --git a/chart/templates/deployment-ui.yaml b/chart/templates/deployment-ui.yaml index da7c0ea..cf14352 100644 --- a/chart/templates/deployment-ui.yaml +++ b/chart/templates/deployment-ui.yaml @@ -31,6 +31,13 @@ spec: imagePullSecrets: - name: {{ .Values.privateRegistry.registrySecret }} {{- end }} + {{- if .Values.longhornUI.priorityClass }} + priorityClassName: {{ .Values.longhornUI.priorityClass | quote}} + {{- end }} + {{- if .Values.longhornUI.tolerations }} + tolerations: +{{ toYaml .Values.longhornManager.tolerations | indent 6 }} + {{- end }} --- kind: Service apiVersion: v1 diff --git a/chart/templates/postupgrade-job.yaml b/chart/templates/postupgrade-job.yaml index 36e79e8..2f37580 100644 --- a/chart/templates/postupgrade-job.yaml +++ b/chart/templates/postupgrade-job.yaml @@ -34,4 +34,11 @@ spec: imagePullSecrets: - name: {{ .Values.privateRegistry.registrySecret }} {{- end }} + {{- if .Values.longhornManager.priorityClass }} + priorityClassName: {{ .Values.longhornManager.priorityClass | quote}} + {{- end }} serviceAccountName: longhorn-service-account + {{- if .Values.longhornManager.tolerations }} + tolerations: +{{ toYaml .Values.longhornManager.tolerations | indent 6 }} + {{- end }} diff --git a/chart/templates/uninstall-job.yaml b/chart/templates/uninstall-job.yaml index a32acd4..5153008 100644 --- a/chart/templates/uninstall-job.yaml +++ b/chart/templates/uninstall-job.yaml @@ -35,4 +35,11 @@ spec: imagePullSecrets: - name: {{ .Values.privateRegistry.registrySecret }} {{- end }} + {{- if .Values.longhornManager.priorityClass }} + priorityClassName: {{ .Values.longhornManager.priorityClass | quote}} + {{- end }} serviceAccountName: longhorn-service-account + {{- if .Values.longhornManager.tolerations }} + tolerations: +{{ toYaml .Values.longhornManager.tolerations | indent 6 }} + {{- end }} diff --git a/chart/values.yaml b/chart/values.yaml index db64a0d..3fe72c1 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -104,6 +104,36 @@ privateRegistry: registryPasswd: ~ registrySecret: ~ +longhornManager: + priorityClass: ~ + tolerations: [] + ## If you want to set tolerations for Longhorn Manager DaemonSet, delete the `[]` in the line above + ## and uncomment this example block + # - key: "key" + # operator: "Equal" + # value: "value" + # effect: "NoSchedule" + +longhornDriver: + priorityClass: ~ + tolerations: [] + ## If you want to set tolerations for Longhorn Manager DaemonSet, delete the `[]` in the line above + ## and uncomment this example block + # - key: "key" + # operator: "Equal" + # value: "value" + # effect: "NoSchedule" + +longhornUI: + priorityClass: ~ + tolerations: [] + ## If you want to set tolerations for Longhorn Manager DaemonSet, delete the `[]` in the line above + ## and uncomment this example block + # - key: "key" + # operator: "Equal" + # value: "value" + # effect: "NoSchedule" + resources: {} # We usually recommend not to specify default resources and to leave this as a conscious # choice for the user. This also increases chances charts run on environments with little