From ab5dc617409a7bbf6dafcdaec0d3d879c09213a5 Mon Sep 17 00:00:00 2001 From: Shovan Maity Date: Tue, 11 May 2021 12:11:32 +0530 Subject: [PATCH] fix(helm chart): rename priority class name for CSI plugin (node and controller) (#72) Include storage engine name in priority class name to make sure CSI driver of different storage will have different priority class. This will resolve the issue of installing multiple storage engine using helm chart. Signed-off-by: Shovan Maity --- deploy/helm/charts/Chart.yaml | 2 +- deploy/helm/charts/templates/_helpers.tpl | 22 +++++++++++++++++++ .../helm/charts/templates/csi-controller.yaml | 2 +- deploy/helm/charts/templates/csi-node.yaml | 2 +- .../helm/charts/templates/priority-class.yaml | 8 +++++-- deploy/helm/charts/values.yaml | 6 +++++ 6 files changed, 37 insertions(+), 5 deletions(-) diff --git a/deploy/helm/charts/Chart.yaml b/deploy/helm/charts/Chart.yaml index fdd99cd..a26c4a7 100644 --- a/deploy/helm/charts/Chart.yaml +++ b/deploy/helm/charts/Chart.yaml @@ -4,7 +4,7 @@ description: Jiva-Operator helm chart for Kubernetes type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. -version: 2.8.0 +version: 2.8.1 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. appVersion: 2.8.0 diff --git a/deploy/helm/charts/templates/_helpers.tpl b/deploy/helm/charts/templates/_helpers.tpl index 9fccfda..88fed2e 100644 --- a/deploy/helm/charts/templates/_helpers.tpl +++ b/deploy/helm/charts/templates/_helpers.tpl @@ -126,3 +126,25 @@ Create labels for jiva csi controller {{ include "jiva.csiController.matchLabels" . }} {{ include "jiva.csiController.componentLabels" . }} {{- end -}} + +{{/* +Create the name of the priority class for csi node plugin +*/}} +{{- define "jiva.csiNode.priorityClassName" -}} +{{- if .Values.csiNode.priorityClass.create }} +{{- printf "%s-%s" .Release.Name .Values.csiNode.priorityClass.name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s" .Values.csiNode.priorityClass.name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} + +{{/* +Create the name of the priority class for csi controller plugin +*/}} +{{- define "jiva.csiController.priorityClassName" -}} +{{- if .Values.csiController.priorityClass.create }} +{{- printf "%s-%s" .Release.Name .Values.csiController.priorityClass.name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s" .Values.csiController.priorityClass.name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} diff --git a/deploy/helm/charts/templates/csi-controller.yaml b/deploy/helm/charts/templates/csi-controller.yaml index 7920302..76094f6 100644 --- a/deploy/helm/charts/templates/csi-controller.yaml +++ b/deploy/helm/charts/templates/csi-controller.yaml @@ -21,7 +21,7 @@ spec: {{ toYaml .Values.csiController.podLabels | nindent 8 }} {{- end }} spec: - priorityClassName: openebs-csi-controller-critical + priorityClassName: {{ template "jiva.csiController.priorityClassName" . }} serviceAccount: {{ .Values.serviceAccount.csiController.name }} containers: - name: {{ .Values.csiController.resizer.name }} diff --git a/deploy/helm/charts/templates/csi-node.yaml b/deploy/helm/charts/templates/csi-node.yaml index 88b4b17..3acf07f 100644 --- a/deploy/helm/charts/templates/csi-node.yaml +++ b/deploy/helm/charts/templates/csi-node.yaml @@ -19,7 +19,7 @@ spec: {{ toYaml .Values.csiNode.podLabels | nindent 8 }} {{- end }} spec: - priorityClassName: openebs-csi-node-critical + priorityClassName: {{ template "jiva.csiNode.priorityClassName" . }} serviceAccount: {{ .Values.serviceAccount.csiNode.name }} hostNetwork: true containers: diff --git a/deploy/helm/charts/templates/priority-class.yaml b/deploy/helm/charts/templates/priority-class.yaml index 631754d..4e3c774 100644 --- a/deploy/helm/charts/templates/priority-class.yaml +++ b/deploy/helm/charts/templates/priority-class.yaml @@ -1,15 +1,19 @@ +{{- if .Values.csiController.priorityClass.create }} apiVersion: scheduling.k8s.io/v1 kind: PriorityClass metadata: - name: openebs-csi-controller-critical + name: {{ template "jiva.csiController.priorityClassName" . }} value: 900000000 globalDefault: false description: "This priority class should be used for the OpenEBS CSI driver controller deployment only." +{{- end }} --- +{{- if .Values.csiNode.priorityClass.create }} apiVersion: scheduling.k8s.io/v1 kind: PriorityClass metadata: - name: openebs-csi-node-critical + name: {{ template "jiva.csiNode.priorityClassName" . }} value: 900001000 globalDefault: false description: "This priority class should be used for the OpenEBS CSI driver node deployment only." +{{- end }} diff --git a/deploy/helm/charts/values.yaml b/deploy/helm/charts/values.yaml index a917739..ab641d8 100644 --- a/deploy/helm/charts/values.yaml +++ b/deploy/helm/charts/values.yaml @@ -50,6 +50,9 @@ jivaOperator: csiController: + priorityClass: + create: true + name: jiva-csi-controller-critical componentName: "openebs-jiva-csi-controller" attacher: name: "csi-attacher" @@ -112,6 +115,9 @@ jivaCSIPlugin: remount: "true" csiNode: + priorityClass: + create: true + name: jiva-csi-node-critical componentName: "openebs-jiva-csi-node" driverRegistrar: name: "csi-node-driver-registrar"