Skip to content

Commit

Permalink
Adding podAnnotations to Redis statefulset (#23708)
Browse files Browse the repository at this point in the history
GitOrigin-RevId: 2af19f16a4d94e749bbf6c7c4704e02aac35fc11
  • Loading branch information
moshederri authored and Cloud Composer Team committed Jan 30, 2023
1 parent d134ace commit bae22c0
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
9 changes: 7 additions & 2 deletions chart/templates/redis/redis-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
8 changes: 8 additions & 0 deletions chart/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
},
Expand Down
1 change: 1 addition & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
13 changes: 13 additions & 0 deletions tests/charts/test_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit bae22c0

Please sign in to comment.