From b5e1d939a9b03e401a31848b6909649d8e3c0e6e Mon Sep 17 00:00:00 2001 From: ihiverlet Date: Tue, 18 Jun 2024 12:55:53 +0000 Subject: [PATCH] superset discovers elastic --- charts/superset/Chart.yaml | 4 ++-- charts/superset/templates/_discovery.tpl | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/charts/superset/Chart.yaml b/charts/superset/Chart.yaml index daaa86f..b85045d 100644 --- a/charts/superset/Chart.yaml +++ b/charts/superset/Chart.yaml @@ -22,7 +22,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.2 +version: 0.1.3 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to @@ -33,5 +33,5 @@ dependencies: version: 0.12.4 repository: https://apache.github.io/superset - name: library-chart - version: 1.5.20 + version: 1.5.23 repository: https://inseefrlab.github.io/helm-charts-interactive-services diff --git a/charts/superset/templates/_discovery.tpl b/charts/superset/templates/_discovery.tpl index 9e4fa6b..13d24b7 100644 --- a/charts/superset/templates/_discovery.tpl +++ b/charts/superset/templates/_discovery.tpl @@ -39,7 +39,10 @@ Create the name of the config map S3 to use {{- $service:= ( index $secret.data "elastic-service" | default "") | b64dec }} {{- $name:= ( index $secret.data "elastic-name" | default "") | b64dec }} {{- $port:= ( index $secret.data "elastic-port") | b64dec }} -{{- $data := dict "elastic" $elastic "service" $service "name" $name "port" $port}} +{{- $password := ( index $secret.data "elastic-password" | default "") | b64dec }} +{{- $tls := ( index $secret.data "elastic-tls" | default "ZmFsc2U=") | b64dec }} +{{- $username := ( index $secret.data "elastic-username" | default "") | b64dec }} +{{- $data := dict "elastic" $elastic "service" $service "name" $name "port" $port "password" $password "username" $username "tls" $tls }} {{- if $test }} {{ printf "databases:" | indent 2 }} {{- $test = 0}} @@ -96,12 +99,23 @@ Create the name of the config map S3 to use {{- $service:= .service }} {{- $port:= .port }} {{- $name:= .name }} +{{- $username:= .username }} +{{- $password:= .password }} +{{- $tls:= .tls }} {{- if $elastic }} {{ printf "- allow_file_upload: true"| indent 2}} {{ printf "allow_ctas: true"| indent 4}} {{ printf "allow_cvas: true"| indent 4}} {{ printf "database_name: %s" $name | indent 4}} +{{- if eq $tls "true" }} +{{- if and $password $username }} +{{ printf "sqlalchemy_uri: elasticsearch+https://%s:%s@%s:%s/" $username $password $service $port | indent 4 }} +{{- else }} +{{ printf "sqlalchemy_uri: elasticsearch+https://%s:%s/" $service $port | indent 4 }} +{{- end }} +{{- else }} {{ printf "sqlalchemy_uri: elasticsearch+http://%s:%s/" $service $port | indent 4}} +{{- end }} {{ printf "tables: []" | indent 4}} {{- end }} {{- end -}}