Allow user to set node selector for system managed components, manager, UI, driver deployer

This feature allow user to deploy Longhorn only on a specific
set of nodes

Longhorn #2199

Signed-off-by: Phan Le <phan.le@rancher.com>
This commit is contained in:
Phan Le 2021-04-13 15:50:25 -07:00 committed by David Ko
parent 5918e89fcd
commit 47a34c4b36
8 changed files with 39 additions and 22 deletions

View File

@ -304,26 +304,6 @@ The available modes are:
type: int type: int
min: 0 min: 0
default: 300 default: 300
- variable: defaultSettings.taintToleration
label: Kubernetes Taint Toleration
description: "To dedicate nodes to store Longhorn replicas and reject other general workloads, set tolerations for Longhorn and add taints for the storage nodes.
All Longhorn volumes should be detached before modifying toleration settings.
We recommend setting tolerations during Longhorn deployment because the Longhorn system cannot be operated during the update.
Multiple tolerations can be set here, and these tolerations are separated by semicolon. For example:
* `key1=value1:NoSchedule; key2:NoExecute`
* `:` this toleration tolerates everything because an empty key with operator `Exists` matches all keys, values and effects
* `key1=value1:` this toleration has empty effect. It matches all effects with key `key1`
Because `kubernetes.io` is used as the key of all Kubernetes default tolerations, it should not be used in the toleration settings.
WARNING: DO NOT CHANGE THIS SETTING WITH ATTACHED VOLUMES!"
group: "Longhorn Default Settings"
type: string
default: ""
- variable: defaultSettings.priorityClass
label: Priority Class
description: "The name of the Priority Class to set on the Longhorn workloads. This can help prevent Longhorn workloads from being evicted under Node Pressure. WARNING: DO NOT CHANGE THIS SETTING WITH ATTACHED VOLUMES."
group: "Longhorn Default Settings"
type: string
default: ""
- variable: defaultSettings.autoSalvage - variable: defaultSettings.autoSalvage
label: Automatic salvage label: Automatic salvage
description: "If enabled, volumes will be automatically salvaged when all the replicas become faulty e.g. due to network disconnection. Longhorn will try to figure out which replica(s) are usable, then use them for the volume. By default true." description: "If enabled, volumes will be automatically salvaged when all the replicas become faulty e.g. due to network disconnection. Longhorn will try to figure out which replica(s) are usable, then use them for the volume. By default true."

View File

@ -96,6 +96,10 @@ spec:
tolerations: tolerations:
{{ toYaml .Values.longhornManager.tolerations | indent 6 }} {{ toYaml .Values.longhornManager.tolerations | indent 6 }}
{{- end }} {{- end }}
{{- if .Values.longhornManager.nodeSelector }}
nodeSelector:
{{ toYaml .Values.longhornManager.nodeSelector | indent 8 }}
{{- end }}
updateStrategy: updateStrategy:
rollingUpdate: rollingUpdate:
maxUnavailable: "100%" maxUnavailable: "100%"

View File

@ -21,6 +21,7 @@ data:
default-longhorn-static-storage-class: {{ .Values.defaultSettings.defaultLonghornStaticStorageClass }} default-longhorn-static-storage-class: {{ .Values.defaultSettings.defaultLonghornStaticStorageClass }}
backupstore-poll-interval: {{ .Values.defaultSettings.backupstorePollInterval }} backupstore-poll-interval: {{ .Values.defaultSettings.backupstorePollInterval }}
taint-toleration: {{ .Values.defaultSettings.taintToleration }} taint-toleration: {{ .Values.defaultSettings.taintToleration }}
system-managed-components-node-selector: {{ .Values.defaultSettings.systemManagedComponentsNodeSelector }}
priority-class: {{ .Values.defaultSettings.priorityClass }} priority-class: {{ .Values.defaultSettings.priorityClass }}
auto-salvage: {{ .Values.defaultSettings.autoSalvage }} auto-salvage: {{ .Values.defaultSettings.autoSalvage }}
auto-delete-pod-when-volume-detached-unexpectedly: {{ .Values.defaultSettings.autoDeletePodWhenVolumeDetachedUnexpectedly }} auto-delete-pod-when-volume-detached-unexpectedly: {{ .Values.defaultSettings.autoDeletePodWhenVolumeDetachedUnexpectedly }}

View File

@ -94,6 +94,10 @@ spec:
{{- if .Values.longhornDriver.tolerations }} {{- if .Values.longhornDriver.tolerations }}
tolerations: tolerations:
{{ toYaml .Values.longhornDriver.tolerations | indent 6 }} {{ toYaml .Values.longhornDriver.tolerations | indent 6 }}
{{- end }}
{{- if .Values.longhornDriver.nodeSelector }}
nodeSelector:
{{ toYaml .Values.longhornDriver.nodeSelector | indent 8 }}
{{- end }} {{- end }}
serviceAccountName: longhorn-service-account serviceAccountName: longhorn-service-account
securityContext: securityContext:

View File

@ -38,6 +38,10 @@ spec:
tolerations: tolerations:
{{ toYaml .Values.longhornManager.tolerations | indent 6 }} {{ toYaml .Values.longhornManager.tolerations | indent 6 }}
{{- end }} {{- end }}
{{- if .Values.longhornUI.nodeSelector }}
nodeSelector:
{{ toYaml .Values.longhornManager.nodeSelector | indent 8 }}
{{- end }}
--- ---
kind: Service kind: Service
apiVersion: v1 apiVersion: v1

View File

@ -42,3 +42,7 @@ spec:
tolerations: tolerations:
{{ toYaml .Values.longhornManager.tolerations | indent 6 }} {{ toYaml .Values.longhornManager.tolerations | indent 6 }}
{{- end }} {{- end }}
{{- if .Values.longhornManager.nodeSelector }}
nodeSelector:
{{ toYaml .Values.longhornManager.nodeSelector | indent 8 }}
{{- end }}

View File

@ -43,3 +43,7 @@ spec:
tolerations: tolerations:
{{ toYaml .Values.longhornManager.tolerations | indent 6 }} {{ toYaml .Values.longhornManager.tolerations | indent 6 }}
{{- end }} {{- end }}
{{- if .Values.longhornManager.nodeSelector }}
nodeSelector:
{{ toYaml .Values.longhornManager.nodeSelector | indent 8 }}
{{- end }}

View File

@ -82,6 +82,7 @@ defaultSettings:
defaultLonghornStaticStorageClass: ~ defaultLonghornStaticStorageClass: ~
backupstorePollInterval: ~ backupstorePollInterval: ~
taintToleration: ~ taintToleration: ~
systemManagedComponentsNodeSelector: ~
priorityClass: ~ priorityClass: ~
autoSalvage: ~ autoSalvage: ~
autoDeletePodWhenVolumeDetachedUnexpectedly: ~ autoDeletePodWhenVolumeDetachedUnexpectedly: ~
@ -116,26 +117,41 @@ longhornManager:
# operator: "Equal" # operator: "Equal"
# value: "value" # value: "value"
# effect: "NoSchedule" # effect: "NoSchedule"
nodeSelector: {}
## If you want to set node selector for Longhorn Manager DaemonSet, delete the `{}` in the line above
## and uncomment this example block
# label-key1: "label-value1"
# label-key2: "label-value2"
longhornDriver: longhornDriver:
priorityClass: ~ priorityClass: ~
tolerations: [] tolerations: []
## If you want to set tolerations for Longhorn Manager DaemonSet, delete the `[]` in the line above ## If you want to set tolerations for Longhorn Driver Deployer Deployment, delete the `[]` in the line above
## and uncomment this example block ## and uncomment this example block
# - key: "key" # - key: "key"
# operator: "Equal" # operator: "Equal"
# value: "value" # value: "value"
# effect: "NoSchedule" # effect: "NoSchedule"
nodeSelector: {}
## If you want to set node selector for Longhorn Driver Deployer Deployment, delete the `{}` in the line above
## and uncomment this example block
# label-key1: "label-value1"
# label-key2: "label-value2"
longhornUI: longhornUI:
priorityClass: ~ priorityClass: ~
tolerations: [] tolerations: []
## If you want to set tolerations for Longhorn Manager DaemonSet, delete the `[]` in the line above ## If you want to set tolerations for Longhorn UI Deployment, delete the `[]` in the line above
## and uncomment this example block ## and uncomment this example block
# - key: "key" # - key: "key"
# operator: "Equal" # operator: "Equal"
# value: "value" # value: "value"
# effect: "NoSchedule" # effect: "NoSchedule"
nodeSelector: {}
## If you want to set node selector for Longhorn UI Deployment, delete the `{}` in the line above
## and uncomment this example block
# label-key1: "label-value1"
# label-key2: "label-value2"
resources: {} resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious # We usually recommend not to specify default resources and to leave this as a conscious