You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by je...@apache.org on 2022/07/11 21:27:34 UTC

[airflow] branch main updated: Adding podAnnotations to Redis statefulset (#23708)

This is an automated email from the ASF dual-hosted git repository.

jedcunningham pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 2af19f16a4 Adding podAnnotations to Redis statefulset (#23708)
2af19f16a4 is described below

commit 2af19f16a4d94e749bbf6c7c4704e02aac35fc11
Author: moshederri <38...@users.noreply.github.com>
AuthorDate: Tue Jul 12 00:27:26 2022 +0300

    Adding podAnnotations to Redis statefulset (#23708)
---
 chart/templates/redis/redis-statefulset.yaml |  9 +++++++--
 chart/values.schema.json                     |  8 ++++++++
 chart/values.yaml                            |  1 +
 tests/charts/test_annotations.py             | 13 +++++++++++++
 4 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/chart/templates/redis/redis-statefulset.yaml b/chart/templates/redis/redis-statefulset.yaml
index f1d6976396..ca538fa29c 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 5aedec25bd..435b45e9e7 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 08ccc4e034..591a085005 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 ecb4e7fd08..67d766500d 100644
--- a/tests/charts/test_annotations.py
+++ b/tests/charts/test_annotations.py
@@ -339,6 +339,19 @@ class TestServiceAccountAnnotations:
                 "example": "cleanup",
             },
         ),
+        (
+            {
+                "redis": {
+                    "podAnnotations": {
+                        "example": "redis",
+                    },
+                },
+            },
+            "templates/redis/redis-statefulset.yaml",
+            {
+                "example": "redis",
+            },
+        ),
     ],
 )
 class TestPerComponentPodAnnotations: