Skip to content

Commit

Permalink
feat(Helm): Redis with password supported in helm charts and redis ch…
Browse files Browse the repository at this point in the history
…art version updated (#18642)

* fix import_datasources documentation

* Redis with password supported in helm chart

* fix conditionals format and redisURL
  • Loading branch information
wiktor2200 authored Feb 10, 2022
1 parent 4db70b5 commit 33d1c96
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 38 deletions.
2 changes: 1 addition & 1 deletion docs/docs/installation/running-on-kubernetes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion helm/superset/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ dependencies:
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
12 changes: 10 additions & 2 deletions helm/superset/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,22 @@ WTF_CSRF_EXEMPT_LIST = []
# A CSRF token that expires in 1 year
WTF_CSRF_TIME_LIMIT = 60 * 60 * 24 * 365
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'}}
{{- 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 }}
BROKER_URL = f"redis://{env('REDIS_HOST')}:{env('REDIS_PORT')}/0"
CELERY_RESULT_BACKEND = f"redis://{env('REDIS_HOST')}:{env('REDIS_PORT')}/0"
{{- 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'
)
Expand Down
3 changes: 3 additions & 0 deletions helm/superset/templates/secret-env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
43 changes: 25 additions & 18 deletions helm/superset/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@
"redis_host": {
"type": "string"
},
"redis_password": {
"type": "string"
},
"redis_port": {
"type": "string"
},
Expand Down Expand Up @@ -476,24 +479,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,
Expand Down Expand Up @@ -539,9 +547,8 @@
},
"required": [
"enabled",
"usePassword",
"master",
"cluster"
"architecture",
"master"
]
},
"nodeSelector": {
Expand Down
38 changes: 22 additions & 16 deletions helm/superset/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ extraSecretEnv: {}
# GOOGLE_SECRET: ...

extraConfigs: {}
# datasources-init.yaml: |
# import_datasources.yaml: |
# databases:
# - allow_file_upload: true
# allow_ctas: true
Expand Down Expand Up @@ -224,8 +224,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
Expand Down Expand Up @@ -397,27 +400,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
Expand All @@ -438,10 +448,6 @@ redis:
## Access mode:
accessModes:
- ReadWriteOnce
##
## Disable cluster management by default.
cluster:
enabled: false

nodeSelector: {}

Expand Down

0 comments on commit 33d1c96

Please sign in to comment.