diff --git a/chart/templates/redis/redis-statefulset.yaml b/chart/templates/redis/redis-statefulset.yaml index f1d69763964..ca538fa29c3 100644 --- a/chart/templates/redis/redis-statefulset.yaml +++ b/chart/templates/redis/redis-statefulset.yaml @@ -53,10 +53,15 @@ spec: {{- with .Values.labels }} {{ toYaml . | indent 8 }} {{- end }} - {{- if .Values.redis.safeToEvict }} +{{- if or .Values.redis.safeToEvict .Values.redis.podAnnotations }} annotations: +{{- if .Values.redis.podAnnotations }} +{{- toYaml .Values.redis.podAnnotations | nindent 8 }} +{{- end }} + {{- if .Values.redis.safeToEvict }} cluster-autoscaler.kubernetes.io/safe-to-evict: "true" - {{- end }} + {{- end }} +{{- end }} spec: nodeSelector: {{ toYaml $nodeSelector | indent 8 }} diff --git a/chart/values.schema.json b/chart/values.schema.json index 5aedec25bd4..435b45e9e78 100644 --- a/chart/values.schema.json +++ b/chart/values.schema.json @@ -4218,6 +4218,14 @@ "description": "Redis run as user parameter.", "type": "integer", "default": 0 + }, + "podAnnotations": { + "description": "Annotations to add to the redis pods.", + "type": "object", + "default": {}, + "additionalProperties": { + "type": "string" + } } } }, diff --git a/chart/values.yaml b/chart/values.yaml index 08ccc4e0344..591a0850051 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -1477,6 +1477,7 @@ redis: # runAsUser: 999 # runAsGroup: 0 + podAnnotations: {} # Auth secret for a private registry # This is used if pulling airflow images from a private registry registry: diff --git a/tests/charts/test_annotations.py b/tests/charts/test_annotations.py index ecb4e7fd083..67d766500da 100644 --- a/tests/charts/test_annotations.py +++ b/tests/charts/test_annotations.py @@ -339,6 +339,19 @@ def test_annotations_are_added(self, values, show_only, expected_annotations): "example": "cleanup", }, ), + ( + { + "redis": { + "podAnnotations": { + "example": "redis", + }, + }, + }, + "templates/redis/redis-statefulset.yaml", + { + "example": "redis", + }, + ), ], ) class TestPerComponentPodAnnotations: