This is an automated email from the ASF dual-hosted git repository.
rom 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 ded67d04c6 [redis]adding additional values for existing persistence
claim (#41619)
ded67d04c6 is described below
commit ded67d04c666aa8dc92d0c752e7d0fb5f856da1d
Author: Dewen Kong <[email protected]>
AuthorDate: Tue Aug 27 05:18:52 2024 -0400
[redis]adding additional values for existing persistence claim (#41619)
* Update values.yaml
* Update redis-statefulset.yaml
* Update values.schema.json
* Update redis-statefulset.yaml
* add testing
* update unit testing
* update
---
chart/templates/redis/redis-statefulset.yaml | 5 +++++
chart/values.schema.json | 8 ++++++++
chart/values.yaml | 2 ++
helm_tests/other/test_redis.py | 10 ++++++++++
4 files changed, 25 insertions(+)
diff --git a/chart/templates/redis/redis-statefulset.yaml
b/chart/templates/redis/redis-statefulset.yaml
index db98f0bf4d..826ce764a6 100644
--- a/chart/templates/redis/redis-statefulset.yaml
+++ b/chart/templates/redis/redis-statefulset.yaml
@@ -114,6 +114,11 @@ spec:
volumes:
- name: redis-db
emptyDir: {{- toYaml (default (dict) .Values.redis.emptyDirConfig) |
nindent 12 }}
+ {{- else if .Values.redis.persistence.existingClaim }}
+ volumes:
+ - name: redis-db
+ persistentVolumeClaim:
+ claimName: {{ .Values.redis.persistence.existingClaim }}
{{- else }}
volumeClaimTemplates:
- metadata:
diff --git a/chart/values.schema.json b/chart/values.schema.json
index 65dd79bf2d..9ecbf043df 100644
--- a/chart/values.schema.json
+++ b/chart/values.schema.json
@@ -7451,6 +7451,14 @@
"additionalProperties": {
"type": "string"
}
+ },
+ "existingClaim": {
+ "description": "The name of an existing PVC to
use.",
+ "type": [
+ "string",
+ "null"
+ ],
+ "default": null
}
}
},
diff --git a/chart/values.yaml b/chart/values.yaml
index 0d4e617dba..fe79ca368a 100644
--- a/chart/values.yaml
+++ b/chart/values.yaml
@@ -2294,6 +2294,8 @@ redis:
storageClassName:
# Annotations to add to redis volumes
annotations: {}
+ # the name of an existing PVC to use
+ existingClaim:
# Configuration for empty dir volume (if redis.persistence.enabled == false)
# emptyDirConfig:
diff --git a/helm_tests/other/test_redis.py b/helm_tests/other/test_redis.py
index b32dd71d11..a5a6f2099e 100644
--- a/helm_tests/other/test_redis.py
+++ b/helm_tests/other/test_redis.py
@@ -403,6 +403,16 @@ class TestRedis:
"spec.volumeClaimTemplates[0].spec.storageClassName", docs[0]
)
+ def test_redis_template_persistence_storage_existing_claim(self):
+ docs = render_chart(
+ values={"redis": {"persistence": {"existingClaim":
"test-existing-claim"}}},
+ show_only=["templates/redis/redis-statefulset.yaml"],
+ )
+ assert {
+ "name": "redis-db",
+ "persistentVolumeClaim": {"claimName": "test-existing-claim"},
+ } in jmespath.search("spec.template.spec.volumes", docs[0])
+
@pytest.mark.parametrize(
"redis_values, expected",
[