From a72fc7131c7be4dbf728e89afb1e04587f459f3a Mon Sep 17 00:00:00 2001 From: wiktor2200 Date: Wed, 9 Feb 2022 12:45:39 +0100 Subject: [PATCH 1/3] fix import_datasources documentation --- docs/docs/installation/running-on-kubernetes.mdx | 2 +- helm/superset/values.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/docs/installation/running-on-kubernetes.mdx b/docs/docs/installation/running-on-kubernetes.mdx index a9fe285c45331..f879f2e6b5092 100644 --- a/docs/docs/installation/running-on-kubernetes.mdx +++ b/docs/docs/installation/running-on-kubernetes.mdx @@ -178,7 +178,7 @@ Data source definitions can be automatically declared by providing key/value yam ```yaml extraConfigs: - datasources-init.yaml: | + import_datasources.yaml: | databases: - allow_file_upload: true allow_ctas: true diff --git a/helm/superset/values.yaml b/helm/superset/values.yaml index a30323f823aa7..e9d7e56206da1 100644 --- a/helm/superset/values.yaml +++ b/helm/superset/values.yaml @@ -83,7 +83,7 @@ extraSecretEnv: {} # GOOGLE_SECRET: ... extraConfigs: {} - # datasources-init.yaml: | + # import_datasources.yaml: | # databases: # - allow_file_upload: true # allow_ctas: true From 8ed08e5f358801a14c7198fe6d38acdd87f7f556 Mon Sep 17 00:00:00 2001 From: wiktor2200 Date: Wed, 9 Feb 2022 12:58:35 +0100 Subject: [PATCH 2/3] Redis with password supported in helm chart --- helm/superset/Chart.yaml | 4 +-- helm/superset/templates/_helpers.tpl | 16 +++++++++ helm/superset/templates/secret-env.yaml | 3 ++ helm/superset/values.schema.json | 43 ++++++++++++++----------- helm/superset/values.yaml | 36 ++++++++++++--------- 5 files changed, 67 insertions(+), 35 deletions(-) diff --git a/helm/superset/Chart.yaml b/helm/superset/Chart.yaml index 3e9bda1dcf7b3..e34786d04c224 100644 --- a/helm/superset/Chart.yaml +++ b/helm/superset/Chart.yaml @@ -22,13 +22,13 @@ maintainers: - name: craig-rueda email: craig@craigrueda.com url: https://github.com/craig-rueda -version: 0.5.7 +version: 0.5.8 dependencies: - name: postgresql version: 10.2.0 repository: https://charts.bitnami.com/bitnami condition: postgresql.enabled - name: redis - version: 12.3.3 + version: 16.3.1 repository: https://charts.bitnami.com/bitnami condition: redis.enabled diff --git a/helm/superset/templates/_helpers.tpl b/helm/superset/templates/_helpers.tpl index eef1b09c2c409..02b5b4e78806c 100644 --- a/helm/superset/templates/_helpers.tpl +++ b/helm/superset/templates/_helpers.tpl @@ -89,6 +89,21 @@ WTF_CSRF_ENABLED = True WTF_CSRF_EXEMPT_LIST = [] # A CSRF token that expires in 1 year WTF_CSRF_TIME_LIMIT = 60 * 60 * 24 * 365 +{{- if .Values.supersetNode.connections.redis_password }} +class CeleryConfig(object): + BROKER_URL = f"redis://{env('REDIS_PASSWORD')}@{env('REDIS_HOST')}:{env('REDIS_PORT')}/0" + CELERY_IMPORTS = ('superset.sql_lab', ) + CELERY_RESULT_BACKEND = f"redis://{env('REDIS_PASSWORD')}@{env('REDIS_HOST')}:{env('REDIS_PORT')}/0" + CELERY_ANNOTATIONS = {'tasks.add': {'rate_limit': '10/s'}} + +CELERY_CONFIG = CeleryConfig +RESULTS_BACKEND = RedisCache( + host=env('REDIS_HOST'), + password=env('REDIS_PASSWORD'), + port=env('REDIS_PORT'), + key_prefix='superset_results' +) +{{- else }} class CeleryConfig(object): BROKER_URL = f"redis://{env('REDIS_HOST')}:{env('REDIS_PORT')}/0" CELERY_IMPORTS = ('superset.sql_lab', ) @@ -101,6 +116,7 @@ RESULTS_BACKEND = RedisCache( port=env('REDIS_PORT'), key_prefix='superset_results' ) +{{- end -}} {{ if .Values.configOverrides }} # Overrides diff --git a/helm/superset/templates/secret-env.yaml b/helm/superset/templates/secret-env.yaml index 278ecc4012110..4126507324439 100644 --- a/helm/superset/templates/secret-env.yaml +++ b/helm/superset/templates/secret-env.yaml @@ -26,6 +26,9 @@ metadata: type: Opaque stringData: REDIS_HOST: {{ tpl .Values.supersetNode.connections.redis_host . | quote }} + {{- if .Values.supersetNode.connections.redis_password }} + REDIS_PASSWORD: {{ .Values.supersetNode.connections.redis_password | quote }} + {{- end }} REDIS_PORT: {{ .Values.supersetNode.connections.redis_port | quote }} DB_HOST: {{ tpl .Values.supersetNode.connections.db_host . | quote }} DB_PORT: {{ .Values.supersetNode.connections.db_port | quote }} diff --git a/helm/superset/values.schema.json b/helm/superset/values.schema.json index 431dfb36d79f4..90310280418fc 100644 --- a/helm/superset/values.schema.json +++ b/helm/superset/values.schema.json @@ -206,6 +206,9 @@ "redis_host": { "type": "string" }, + "redis_password": { + "type": "string" + }, "redis_port": { "type": "string" }, @@ -456,24 +459,29 @@ "enabled": { "type": "boolean" }, - "usePassword": { - "type": "boolean" - }, - "existingSecret": { - "type": [ - "string", - "null" - ] + "architecture": { + "type": "string" }, - "existingSecretKey": { - "type": [ - "string", - "null" + "auth": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "existingSecret": { + "type": "string" + }, + "existingSecretKey": { + "type": "string" + }, + "password": { + "type": "string" + } + }, + "required": [ + "enabled" ] }, - "password": { - "type": "string" - }, "master": { "type": "object", "additionalProperties": true, @@ -519,9 +527,8 @@ }, "required": [ "enabled", - "usePassword", - "master", - "cluster" + "architecture", + "master" ] }, "nodeSelector": { diff --git a/helm/superset/values.yaml b/helm/superset/values.yaml index e9d7e56206da1..0f01d7ce54711 100644 --- a/helm/superset/values.yaml +++ b/helm/superset/values.yaml @@ -220,8 +220,11 @@ supersetNode: - "-c" - ". {{ .Values.configMountPath }}/superset_bootstrap.sh; /usr/bin/run-server.sh" connections: + # Change in case of bringing your own redis and then also set redis.enabled:false redis_host: '{{ template "superset.fullname" . }}-redis-headless' + # redis_password: superset redis_port: "6379" + # You need to change below configuration incase bringing own PostgresSQL instance and also set postgresql.enabled:false db_host: '{{ template "superset.fullname" . }}-postgresql' db_port: "5432" db_user: superset @@ -393,27 +396,34 @@ postgresql: - ReadWriteOnce ## Configuration values for the Redis dependency. -## ref: https://github.com/kubernetes/charts/blob/master/stable/redis/README.md +## ref: https://github.com/bitnami/charts/blob/master/bitnami/redis +## More documentation can be found here: https://artifacthub.io/packages/helm/bitnami/redis redis: ## ## Use the redis chart dependency. + ## + ## If you are bringing your own redis, you can set the host in supersetNode.connections.redis_host + ## ## Set to false if bringing your own redis. enabled: true - usePassword: false - ## - ## The name of an existing secret that contains the redis password. - existingSecret: - ## Name of the key containing the secret. - existingSecretKey: redis-password ## - ## If you are bringing your own redis, you can set the host in redisHost. - ## redisHost: + ## Set architecture to standalone/replication + architecture: standalone ## - ## Redis password + ## Auth configuration: ## - password: superset + auth: + ## Enable password authentication + enabled: false + ## The name of an existing secret that contains the redis password. + existingSecret: "" + ## Name of the key containing the secret. + existingSecretKey: "" + ## Redis password + password: superset ## ## Master configuration + ## master: ## ## Image configuration @@ -434,10 +444,6 @@ redis: ## Access mode: accessModes: - ReadWriteOnce - ## - ## Disable cluster management by default. - cluster: - enabled: false nodeSelector: {} From 12dffad5868410812094fdb0fcbd1fdb8a71a1d6 Mon Sep 17 00:00:00 2001 From: wiktor2200 Date: Thu, 10 Feb 2022 13:40:20 +0100 Subject: [PATCH 3/3] fix conditionals format and redisURL --- helm/superset/templates/_helpers.tpl | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/helm/superset/templates/_helpers.tpl b/helm/superset/templates/_helpers.tpl index 02b5b4e78806c..593fd0319885d 100644 --- a/helm/superset/templates/_helpers.tpl +++ b/helm/superset/templates/_helpers.tpl @@ -89,34 +89,26 @@ WTF_CSRF_ENABLED = True WTF_CSRF_EXEMPT_LIST = [] # A CSRF token that expires in 1 year WTF_CSRF_TIME_LIMIT = 60 * 60 * 24 * 365 -{{- if .Values.supersetNode.connections.redis_password }} class CeleryConfig(object): - BROKER_URL = f"redis://{env('REDIS_PASSWORD')}@{env('REDIS_HOST')}:{env('REDIS_PORT')}/0" CELERY_IMPORTS = ('superset.sql_lab', ) - CELERY_RESULT_BACKEND = f"redis://{env('REDIS_PASSWORD')}@{env('REDIS_HOST')}:{env('REDIS_PORT')}/0" CELERY_ANNOTATIONS = {'tasks.add': {'rate_limit': '10/s'}} - -CELERY_CONFIG = CeleryConfig -RESULTS_BACKEND = RedisCache( - host=env('REDIS_HOST'), - password=env('REDIS_PASSWORD'), - port=env('REDIS_PORT'), - key_prefix='superset_results' -) +{{- if .Values.supersetNode.connections.redis_password }} + BROKER_URL = f"redis://:{env('REDIS_PASSWORD')}@{env('REDIS_HOST')}:{env('REDIS_PORT')}/0" + CELERY_RESULT_BACKEND = f"redis://:{env('REDIS_PASSWORD')}@{env('REDIS_HOST')}:{env('REDIS_PORT')}/0" {{- else }} -class CeleryConfig(object): BROKER_URL = f"redis://{env('REDIS_HOST')}:{env('REDIS_PORT')}/0" - CELERY_IMPORTS = ('superset.sql_lab', ) CELERY_RESULT_BACKEND = f"redis://{env('REDIS_HOST')}:{env('REDIS_PORT')}/0" - CELERY_ANNOTATIONS = {'tasks.add': {'rate_limit': '10/s'}} +{{- end }} CELERY_CONFIG = CeleryConfig RESULTS_BACKEND = RedisCache( host=env('REDIS_HOST'), +{{- if .Values.supersetNode.connections.redis_password }} + password=env('REDIS_PASSWORD'), +{{- end }} port=env('REDIS_PORT'), key_prefix='superset_results' ) -{{- end -}} {{ if .Values.configOverrides }} # Overrides