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 b5f2ae3 Chart: Support elasticsearch connection scheme (#20564)
b5f2ae3 is described below
commit b5f2ae38ec7b31cebaf075c871ddc82d5000260c
Author: Jed Cunningham <[email protected]>
AuthorDate: Wed Dec 29 16:20:17 2021 -0700
Chart: Support elasticsearch connection scheme (#20564)
---
chart/templates/secrets/elasticsearch-secret.yaml | 2 +-
chart/tests/test_elasticsearch_secret.py | 19 +++++++++++++++++++
chart/values.schema.json | 6 ++++++
3 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/chart/templates/secrets/elasticsearch-secret.yaml
b/chart/templates/secrets/elasticsearch-secret.yaml
index 50c1a22..d8d65fa 100644
--- a/chart/templates/secrets/elasticsearch-secret.yaml
+++ b/chart/templates/secrets/elasticsearch-secret.yaml
@@ -33,6 +33,6 @@ metadata:
type: Opaque
data:
{{- with .Values.elasticsearch.connection }}
- connection: {{ urlJoin (dict "scheme" "http" "userinfo" (printf "%s:%s"
(.user | urlquery) (.pass | urlquery)) "host" (printf "%s:%s" .host ((default
80 .port) | toString) ) ) | b64enc | quote }}
+ connection: {{ urlJoin (dict "scheme" (default "http" .scheme) "userinfo"
(printf "%s:%s" (.user | urlquery) (.pass | urlquery)) "host" (printf "%s:%s"
.host ((default 80 .port) | toString) ) ) | b64enc | quote }}
{{- end }}
{{- end }}
diff --git a/chart/tests/test_elasticsearch_secret.py
b/chart/tests/test_elasticsearch_secret.py
index 588b487..22d5cfc 100644
--- a/chart/tests/test_elasticsearch_secret.py
+++ b/chart/tests/test_elasticsearch_secret.py
@@ -20,6 +20,7 @@ import unittest
from subprocess import CalledProcessError
import jmespath
+from parameterized import parameterized
from tests.helm_template_generator import render_chart
@@ -113,3 +114,21 @@ class ElasticsearchSecretTest(unittest.TestCase):
)
assert "http://username:password@elastichostname:2222" == connection
+
+ @parameterized.expand(["http", "https"])
+ def test_should_generate_secret_with_specified_schemes(self, scheme):
+ connection = self._get_connection(
+ {
+ "elasticsearch": {
+ "enabled": True,
+ "connection": {
+ "scheme": scheme,
+ "user": "username",
+ "pass": "password",
+ "host": "elastichostname",
+ },
+ }
+ }
+ )
+
+ assert f"{scheme}://username:password@elastichostname:80" == connection
diff --git a/chart/values.schema.json b/chart/values.schema.json
index d4fadd3..5bc25b7 100644
--- a/chart/values.schema.json
+++ b/chart/values.schema.json
@@ -3611,6 +3611,11 @@
"default": {},
"additionalProperties": false,
"properties": {
+ "scheme": {
+ "description": "Scheme",
+ "type": "string",
+ "default": "http"
+ },
"user": {
"description": "Username",
"type": "string",
@@ -3634,6 +3639,7 @@
},
"examples": [
{
+ "scheme": "https",
"user": "...",
"pass": "...",
"host": "...",