dpgaspar commented on code in PR #26663: URL: https://github.com/apache/superset/pull/26663#discussion_r1471177675
########## helm/superset/templates/_helpers.tpl: ########## @@ -85,13 +101,8 @@ SQLALCHEMY_TRACK_MODIFICATIONS = True class CeleryConfig: imports = ("superset.sql_lab", ) - {{- if .Values.supersetNode.connections.redis_password }} - broker_url = f"redis://:{env('REDIS_PASSWORD')}@{env('REDIS_HOST')}:{env('REDIS_PORT')}/0" - 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" - result_backend = f"redis://{env('REDIS_HOST')}:{env('REDIS_PORT')}/0" - {{- end }} + broker_url = f"{CELERY_REDIS_URL}" + result_backend = f"{CELERY_REDIS_URL}" Review Comment: no need for f-strings here ########## helm/superset/templates/_helpers.tpl: ########## @@ -61,22 +61,38 @@ Create chart name and version as used by the chart label. {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} {{- end -}} + {{- define "superset-config" }} import os from flask_caching.backends.rediscache import RedisCache def env(key, default=None): return os.getenv(key, default) +# Redis Base URL +{{- if .Values.supersetNode.connections.redis_password }} +REDIS_BASE_URL=f"{env('REDIS_PROTO')}://:{env('REDIS_PASSWORD')}@{env('REDIS_HOST')}:{env('REDIS_PORT')}" +{{- else }} +REDIS_BASE_URL=f"{env('REDIS_PROTO')}://{env('REDIS_HOST')}:{env('REDIS_PORT')}" +{{- end }} + +# Redis URL Params +{{- if .Values.supersetNode.connections.use_redis_ssl }} +REDIS_URL_PARAMS = f"?ssl_cert_req={env('REDIS_SSL_CERT_REQS')}" +{{- else }} +REDIS_URL_PARAMS = "" +{{- end}} + +# Build Redis URLs +CACHE_REDIS_URL = f"{REDIS_BASE_URL}/{env('REDIS_DB', 1)}{REDIS_URL_PARAMS}" +CELERY_REDIS_URL = f"{REDIS_BASE_URL}/{env('REDIS_CELERY_DB', 0)}{REDIS_URL_PARAMS}" + MAPBOX_API_KEY = env('MAPBOX_API_KEY', '') CACHE_CONFIG = { 'CACHE_TYPE': 'RedisCache', 'CACHE_DEFAULT_TIMEOUT': 300, 'CACHE_KEY_PREFIX': 'superset_', - 'CACHE_REDIS_HOST': env('REDIS_HOST'), - 'CACHE_REDIS_PORT': env('REDIS_PORT'), - 'CACHE_REDIS_PASSWORD': env('REDIS_PASSWORD'), - 'CACHE_REDIS_DB': env('REDIS_DB', 1), + 'CACHE_REDIS_URL': f"{CACHE_REDIS_URL}", Review Comment: nit: no need for a f-string here ########## helm/superset/values.yaml: ########## @@ -260,6 +260,12 @@ supersetNode: redis_host: '{{ .Release.Name }}-redis-headless' # redis_password: superset redis_port: "6379" + redis_cache_db: "1" + redis_celery_db: "0" + # Or SSL port is usually 6380 + # Add following if you want to use SSL with Redis + # use_redis_ssl: + # ssl_cert_reqs: CERT_NONE Review Comment: another possibility would be: ``` yaml redis_ssl: enabled: false ssl_cert_reqs: CERT_NONE ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org