From 48524759e68c5ac944de3886df8dfe5c83663fae Mon Sep 17 00:00:00 2001
From: Mojtaba Arezoomand <mojtaba.arezoomand@snapp.cab>
Date: Wed, 17 Apr 2024 16:02:13 +0330
Subject: [PATCH] feat: add priority class name

---
 README.md                  | 3 ++-
 templates/statefulset.yaml | 7 +++++--
 values.yaml                | 4 +++-
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index 4e33695..6dc9bcf 100644
--- a/README.md
+++ b/README.md
@@ -13,13 +13,14 @@ This repository contains Redis cluster helm charts that can survive pod restarts
 `fullnameOverride` | String to override `redis-cluster.fullname`  `template` | `redis-cluster`
 `securityContext.enabled` | Whether to enable pod's container security context or not | `false`
 `securityContext` | Pod's security context | `{}`
+`minReadySeconds` | minimum number of seconds for which a newly created Pod should be running and ready without any of its containers crashing, for it to be considered available | `10`
+`priorityClassName` | Priority indicates the importance of a Pod relative to other Pods | `high-priority`
 `redis.image` | Redis docker image | `redis:7.2.4`
 `redis.port` | Redis server port | `6379`
 `redis.bus` | Redis cluster bus port | `16379`
 `redis.securityContext.enabled` | Whether to enable the Redis container security context or not | `false`
 `redis.securityContext` | Redis container security context | `{}`
 `redis.resources` | The resources of the redis container | `{}`
-`redis.minReadySeconds` | minimum number of seconds for which a newly created Pod should be running and ready without any of its containers crashing, for it to be considered available | `10`
 `cluster.init` | A boolean to specify whether the cluster should be initialized. (Can be false when cluster is already created and maybe you just want to change the resources of the cluster) | `true`
 `cluster.master` | Number of master nodes | `3`
 `cluster.replicas` | Number of replicas of each master | `1`
diff --git a/templates/statefulset.yaml b/templates/statefulset.yaml
index 6cacb00..cb0f77a 100644
--- a/templates/statefulset.yaml
+++ b/templates/statefulset.yaml
@@ -9,8 +9,8 @@ spec:
     matchLabels: {{ include "redis-cluster.labels" . | nindent 6 }}
   serviceName: {{ include "redis-cluster.name" . }}-headless
   replicas: {{ include "redis-cluster.replicaCount" . }}
-  {{- if .Values.redis.minReadySeconds }}
-  minReadySeconds: {{ .Values.redis.minReadySeconds }}
+  {{- if .Values.minReadySeconds }}
+  minReadySeconds: {{ .Values.minReadySeconds }}
   {{- end }}
   template:
     metadata:
@@ -19,6 +19,9 @@ spec:
       {{- if and .Values.securityContext .Values.securityContext.enabled }}
       securityContext: {{ omit .Values.securityContext "enabled" | toYaml | nindent 8 }}
       {{- end }}
+      {{- if .Values.priorityClassName }}
+      priorityClassName: {{ .Values.priorityClassName }}
+      {{- end }}
       initContainers:
         - name: fix-outdated-ips
           image: ubuntu:24.04
diff --git a/values.yaml b/values.yaml
index d404eb4..5294d38 100644
--- a/values.yaml
+++ b/values.yaml
@@ -1,11 +1,13 @@
 nameOverride: ""
 fullnameOverride: ""
 
+minReadySeconds: 0
+priorityClassName: ""
+
 redis:
   image: redis:7.2.4
   port: 6379
   bus: 16379
-  minReadySeconds: 0
   securityContext:
     enabled: false