From 7256a6d65cf70b18609d9397bdc8465ebaa512f3 Mon Sep 17 00:00:00 2001 From: Prateek Pandey Date: Wed, 28 Jul 2021 12:39:49 +0530 Subject: [PATCH] [stable/zfs]: add custom priorityclass template for zfs charts (#363) Signed-off-by: prateekpandey14 --- deploy/helm/charts/Chart.yaml | 2 +- deploy/helm/charts/templates/_helpers.tpl | 22 +++++++++++++++++++ .../helm/charts/templates/priority-class.yaml | 19 ++++++++++++++++ deploy/helm/charts/values.yaml | 7 ++++++ 4 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 deploy/helm/charts/templates/priority-class.yaml diff --git a/deploy/helm/charts/Chart.yaml b/deploy/helm/charts/Chart.yaml index 3efa049..ed2db92 100644 --- a/deploy/helm/charts/Chart.yaml +++ b/deploy/helm/charts/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 name: zfs-localpv description: Helm chart for CSI Driver for dynamic provisioning of ZFS Persistent Local Volumes. For instructions on how to use this helm chart, see - https://openebs.github.io/zfs-localpv/ -version: 1.9.1 +version: 1.9.2 appVersion: 1.9.0 icon: https://raw.githubusercontent.com/cncf/artwork/master/projects/openebs/icon/color/openebs-icon-color.png home: http://www.openebs.io/ diff --git a/deploy/helm/charts/templates/_helpers.tpl b/deploy/helm/charts/templates/_helpers.tpl index a611c8f..84830c9 100644 --- a/deploy/helm/charts/templates/_helpers.tpl +++ b/deploy/helm/charts/templates/_helpers.tpl @@ -114,3 +114,25 @@ Create labels for openebs zfs-localpv node daemon {{ include "zfslocalpv.zfsNode.matchLabels" . }} {{ include "zfslocalpv.zfsNode.componentLabels" . }} {{- end -}} + +{{/* +Create the name of the priority class for csi node plugin +*/}} +{{- define "zfslocalpv.zfsNode.priorityClassName" -}} +{{- if .Values.zfsNode.priorityClass.create }} +{{- printf "%s-%s" .Release.Name .Values.zfsNode.priorityClass.name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s" .Values.zfsNode.priorityClass.name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} + +{{/* +Create the name of the priority class for csi controller plugin +*/}} +{{- define "zfslocalpv.zfsController.priorityClassName" -}} +{{- if .Values.zfsController.priorityClass.create }} +{{- printf "%s-%s" .Release.Name .Values.zfsController.priorityClass.name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s" .Values.zfsController.priorityClass.name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} diff --git a/deploy/helm/charts/templates/priority-class.yaml b/deploy/helm/charts/templates/priority-class.yaml new file mode 100644 index 0000000..71ad435 --- /dev/null +++ b/deploy/helm/charts/templates/priority-class.yaml @@ -0,0 +1,19 @@ +{{- if .Values.zfsController.priorityClass.create }} +apiVersion: scheduling.k8s.io/v1 +kind: PriorityClass +metadata: + name: {{ template "zfslocalpv.zfsController.priorityClassName" . }} +value: 900000000 +globalDefault: false +description: "This priority class should be used for the CStor CSI driver controller deployment only." +{{- end }} +--- +{{- if .Values.zfsNode.priorityClass.create }} +apiVersion: scheduling.k8s.io/v1 +kind: PriorityClass +metadata: + name: {{ template "zfslocalpv.zfsNode.priorityClassName" . }} +value: 900001000 +globalDefault: false +description: "This priority class should be used for the CStor CSI driver node deployment only." +{{- end }} diff --git a/deploy/helm/charts/values.yaml b/deploy/helm/charts/values.yaml index 5300484..1e8dc2b 100644 --- a/deploy/helm/charts/values.yaml +++ b/deploy/helm/charts/values.yaml @@ -46,6 +46,9 @@ zfsNode: tolerations: [] securityContext: {} labels: {} + priorityClass: + create: true + name: zfs-csi-node-critical # zfsController contains the configurables for # the zfs controller statefulset @@ -110,6 +113,10 @@ zfsController: nodeSelector: {} tolerations: [] securityContext: {} + priorityClass: + create: true + name: zfs-csi-controller-critical + # zfsPlugin is the common csi container used by the # controller statefulset and node daemonset