Skip to content

Commit

Permalink
add http protocol for elastic endpoint (#1951)
Browse files Browse the repository at this point in the history
* add http protocol for elastic endpoint

* precommit fix

* add test case to validate http endpoint is added

* update test cases

---------

Co-authored-by: Rishabh Karajgi <rishabh.karajgi@gmail.com>
  • Loading branch information
pgvishnuram and rishkarajgi committed Aug 9, 2023
1 parent 7b06fdf commit 9685c57
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ workflows:
- quay.io/astronomer/ap-base:3.18.0-1
- quay.io/astronomer/ap-blackbox-exporter:0.24.0
- quay.io/astronomer/ap-cli-install:0.26.17
- quay.io/astronomer/ap-commander:0.33.1
- quay.io/astronomer/ap-commander:0.33.2
- quay.io/astronomer/ap-configmap-reloader:0.11.0
- quay.io/astronomer/ap-curator:8.0.4
- quay.io/astronomer/ap-db-bootstrapper:0.31.4
Expand Down
4 changes: 2 additions & 2 deletions charts/astronomer/templates/houston/houston-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ data:
elasticsearch:
enabled: true
connection:
host: {{ printf "%s-external-es-proxy.%s" .Release.Name .Release.Namespace }}
host: {{ printf "http://%s-external-es-proxy.%s" .Release.Name .Release.Namespace }}
port: 9200
elasticsearch:
Expand All @@ -404,7 +404,7 @@ data:
elasticsearch:
enabled: true
connection:
host: {{ printf "%s-elasticsearch-nginx.%s" .Release.Name .Release.Namespace }}
host: {{ printf "http://%s-elasticsearch-nginx.%s" .Release.Name .Release.Namespace }}
port: 9200
elasticsearch:
Expand Down
21 changes: 21 additions & 0 deletions tests/chart_tests/test_external_elasticsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,3 +492,24 @@ def test_externalelasticsearch_with_extraenv(self, kube_version):
assert {"name": "TEST_VAR_NAME", "value": "test_var_value"} in doc["spec"][
"template"
]["spec"]["containers"][0]["env"]

def test_externalelasticsearch_houston_configmap_with_http_endpoint(
self, kube_version
):
"""Test Houston Configmap with kibanaUIFlag."""
docs = render_chart(
kube_version=kube_version,
values={"global": {"customLogging": {"enabled": True}}},
show_only=[
"charts/astronomer/templates/houston/houston-configmap.yaml",
],
)
doc = docs[0]
prod = yaml.safe_load(doc["data"]["production.yaml"])
print(prod)
assert (
prod["deployments"]["helm"]["airflow"]["elasticsearch"]["enabled"] is True
)
assert prod["deployments"]["helm"]["airflow"]["elasticsearch"]["connection"][
"host"
].startswith("http://")
3 changes: 3 additions & 0 deletions tests/chart_tests/test_houston_configmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ def test_houston_configmap():
# Ensure elasticsearch client param is at the correct location and contains http://
assert "node" in prod["elasticsearch"]["client"]
assert prod["elasticsearch"]["client"]["node"].startswith("http://")
assert prod["deployments"]["helm"]["airflow"]["elasticsearch"]["connection"][
"host"
].startswith("http://")
with pytest.raises(KeyError):
# Ensure sccEnabled is not defined by default
assert prod["deployments"]["helm"]["sccEnabled"] is False
Expand Down

0 comments on commit 9685c57

Please sign in to comment.