Skip to content

Commit

Permalink
[Superset] Fixed init script in case of no database discovery
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaspi committed Dec 10, 2024
1 parent 5633041 commit ef685ff
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
8 changes: 4 additions & 4 deletions charts/superset/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ keywords:
- BI
- Visualization
home: https://superset.apache.org/
sources:
sources:
- https://github.com/InseeFrLab/helm-charts-datascience/tree/master/charts/superset
- https://github.com/apache/superset
# A chart can be either an 'application' or a 'library' chart.
Expand All @@ -22,16 +22,16 @@ 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.5
version: 0.1.6

# 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
# follow Semantic Versioning. They should reflect the version the application is using.

dependencies:
- name: superset
version: 0.12.11
version: 0.13.5
repository: https://apache.github.io/superset
- name: library-chart
version: 1.5.23
version: 1.5.31
repository: https://inseefrlab.github.io/helm-charts-interactive-services
31 changes: 17 additions & 14 deletions charts/superset/templates/_discovery.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Create the name of the config map S3 to use
{{- $data := dict "postgres" $postgres "service" $service "index" $index "username" $username "password" $password "database" $database "port" $port}}
{{- if $test }}
{{ printf "databases:" | indent 2 }}
{{- $test = 0}}
{{- $test = 0 }}
{{- end }}
{{- template "superset.postgres" $data -}}
{{- end -}}
Expand All @@ -45,20 +45,20 @@ Create the name of the config map S3 to use
{{- $data := dict "elastic" $elastic "service" $service "name" $name "port" $port "password" $password "username" $username "tls" $tls }}
{{- if $test }}
{{ printf "databases:" | indent 2 }}
{{- $test = 0}}
{{- $test = 0 }}
{{- end }}
{{- template "superset.elastic" $data -}}
{{- end -}}
{{- if and (index $secret "metadata" "annotations" "onyxia/discovery") (eq "trino" (index $secret "metadata" "annotations" "onyxia/discovery" | toString)) }}
{{- $service:= ( index $secret.data "trino-service" | default "") | b64dec }}
{{- $username:= ( index $secret.data "trino-username") | b64dec }}
{{- $password:= ( index $secret.data "trino-password") | b64dec }}
{{- $database:= ( index $secret.data "trino-database") | b64dec }}
{{- $port:= ( index $secret.data "trino-port") | b64dec }}
{{- $username:= ( index $secret.data "trino-username") | b64dec }}
{{- $password:= ( index $secret.data "trino-password") | b64dec }}
{{- $database:= ( index $secret.data "trino-database") | b64dec }}
{{- $port:= ( index $secret.data "trino-port") | b64dec }}
{{- $data := dict "trino" $trino "service" $service "index" $index "username" $username "password" $password "database" $database "port" $port}}
{{- if $test }}
{{ printf "databases:" | indent 2 }}
{{- $test = 0}}
{{- $test = 0 }}
{{- end }}
{{- template "superset.trino" $data -}}
{{- end -}}
Expand All @@ -68,13 +68,16 @@ Create the name of the config map S3 to use
{{- $data := dict "spark" $spark "service" $service "index" $index "port" $port}}
{{- if $test }}
{{ printf "databases:" | indent 2 }}
{{- $test = 0}}
{{- $test = 0 }}
{{- end }}
{{- template "superset.spark" $data -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- if eq $test 1 }}
{{ printf "databases: []" | indent 2 }}
{{- end -}}
{{- end -}}

{{- define "superset.postgres" -}}
{{- $postgres:= .postgres }}
Expand All @@ -92,7 +95,7 @@ Create the name of the config map S3 to use
{{ printf "sqlalchemy_uri: postgresql://%s:%s/%s?user=%s&password=%s" $service $port $database $username $password | indent 4}}
{{ printf "tables: []" | indent 4}}
{{- end }}
{{- end -}}
{{- end -}}

{{- define "superset.elastic" -}}
{{- $elastic:= .elastic }}
Expand All @@ -118,7 +121,7 @@ Create the name of the config map S3 to use
{{- end }}
{{ printf "tables: []" | indent 4}}
{{- end }}
{{- end -}}
{{- end -}}

{{- define "superset.trino" -}}
{{- $trino:= .trino }}
Expand All @@ -136,7 +139,7 @@ Create the name of the config map S3 to use
{{ printf "sqlalchemy_uri: trino://%s:%s@%s:%s/%s" $username $password $service $port $database | indent 4}}
{{ printf "tables: []" | indent 4}}
{{- end }}
{{- end -}}
{{- end -}}

{{- define "superset.spark" -}}
{{- $spark:= .spark }}
Expand All @@ -151,4 +154,4 @@ Create the name of the config map S3 to use
{{ printf "sqlalchemy_uri: hive://%s:%s/" $service $port | indent 4}}
{{ printf "tables: []" | indent 4}}
{{- end }}
{{- end -}}
{{- end -}}

0 comments on commit ef685ff

Please sign in to comment.