From 42c39238f6f467bbde635496e91706c737691619 Mon Sep 17 00:00:00 2001 From: joshuasimon-taulia Date: Mon, 22 Nov 2021 13:55:48 -0800 Subject: [PATCH] feat(chart): allow configuration of k8s scheduling priority fix: quote priorityClassName Co-authored-by: Erik Sundell fix: default priorityClass name to .fullname Co-authored-by: Erik Sundell fix: default priorityClass name to .fullname Co-authored-by: Erik Sundell Update charts/nfs-server-provisioner/templates/statefulset.yaml Co-authored-by: Erik Sundell chore: bump chart version Update charts/nfs-server-provisioner/templates/statefulset.yaml Co-authored-by: Andrei Kvapil --- charts/nfs-server-provisioner/Chart.yaml | 2 +- charts/nfs-server-provisioner/README.md | 5 ++++- .../templates/priorityclass.yaml | 14 ++++++++++++++ .../templates/statefulset.yaml | 3 +++ charts/nfs-server-provisioner/values.yaml | 11 +++++++++++ 5 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 charts/nfs-server-provisioner/templates/priorityclass.yaml diff --git a/charts/nfs-server-provisioner/Chart.yaml b/charts/nfs-server-provisioner/Chart.yaml index c0c2dc59..2b114d0c 100644 --- a/charts/nfs-server-provisioner/Chart.yaml +++ b/charts/nfs-server-provisioner/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v1 appVersion: 3.0.0 description: nfs-server-provisioner is an out-of-tree dynamic provisioner for Kubernetes. You can use it to quickly & easily deploy shared storage that works almost anywhere. name: nfs-server-provisioner -version: 1.3.2 +version: 1.4.0 maintainers: - name: kiall email: kiall@macinnes.ie diff --git a/charts/nfs-server-provisioner/README.md b/charts/nfs-server-provisioner/README.md index eaf8d436..04d33d32 100644 --- a/charts/nfs-server-provisioner/README.md +++ b/charts/nfs-server-provisioner/README.md @@ -84,7 +84,10 @@ their default values. | `nodeSelector` | Map of node labels for pod assignment | `{}` | | `tolerations` | List of node taints to tolerate | `[]` | | `affinity` | Map of node/pod affinities | `{}` | -| `podSecurityContext` | Security context settings for nfs-server-provisioner pod (see https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod) | `{}` | +| `podSecurityContext` | Security context settings for nfs-server-provisioner pod (see https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod) | `{}` | +| `priorityClass.create` | Enable creation of a PriorityClass resource for this nfs-server-provisioner instance | `false` | +| `priorityClass.name` | Set a PriorityClass name to override the default name | `""` | +| `priorityClass.value` | PriorityClass value. The higher the value, the higher the scheduling priority | `5` | ```console $ helm install nfs-server-provisioner nfs-ganesha-server-and-external-provisioner/nfs-server-provisioner \ diff --git a/charts/nfs-server-provisioner/templates/priorityclass.yaml b/charts/nfs-server-provisioner/templates/priorityclass.yaml new file mode 100644 index 00000000..f0444355 --- /dev/null +++ b/charts/nfs-server-provisioner/templates/priorityclass.yaml @@ -0,0 +1,14 @@ +{{- if .Values.priorityClass.create -}} +kind: PriorityClass +apiVersion: scheduling.k8s.io/v1 +metadata: + name: {{ .Values.priorityClass.name | default (include "nfs-provisioner.fullname" .) }} + labels: + app: {{ include "nfs-provisioner.name" . }} + chart: {{ include "nfs-provisioner.chart" . }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} +value: {{ .Values.priorityClass.value }} +globalDefault: false +description: "This priority class should be used for nfs-provisioner pods only." +{{- end }} diff --git a/charts/nfs-server-provisioner/templates/statefulset.yaml b/charts/nfs-server-provisioner/templates/statefulset.yaml index 88c9a45e..d2e2aef4 100644 --- a/charts/nfs-server-provisioner/templates/statefulset.yaml +++ b/charts/nfs-server-provisioner/templates/statefulset.yaml @@ -117,6 +117,9 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} + {{- if (or .Values.priorityClass.name .Values.priorityClass.create) }} + priorityClassName: {{ .Values.priorityClass.name | default (include "nfs-provisioner.fullname" .) | quote }} + {{- end }} {{- if not .Values.persistence.enabled }} volumes: diff --git a/charts/nfs-server-provisioner/values.yaml b/charts/nfs-server-provisioner/values.yaml index b11807ed..0ad3b3fb 100644 --- a/charts/nfs-server-provisioner/values.yaml +++ b/charts/nfs-server-provisioner/values.yaml @@ -86,6 +86,17 @@ rbac: ## serviceAccountName: default +## For creating the PriorityClass automatically: +priorityClass: + ## Enable creation of a PriorityClass resource for this nfs-server-provisioner instance + create: false + + ## Set a PriorityClass name to override the default name + name: "" + + ## PriorityClass value. The higher the value, the higher the scheduling priority + value: 5 + resources: {} # limits: # cpu: 100m