-
Notifications
You must be signed in to change notification settings - Fork 14.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(Helm): Redis with password supported in helm charts and redis chart version updated #18642
feat(Helm): Redis with password supported in helm charts and redis chart version updated #18642
Conversation
@ad-m Could you take a look on @craig-rueda Could you take a look? |
@@ -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): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some lines are duplicated in both condition situations. I wonder if we want to have two ifs or if we want duplicate code. I think it's better not to have two ifs than duplicate code, because then it's easier to maintain consistency when a new parameter is added in the middle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought the same thing, but drying that up will be a little tricky and will likely make the code less readable in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have in mind something like:
class CeleryConfig(object):
CELERY_ANNOTATIONS = {'tasks.add': {'rate_limit': '10/s'}}
CELERY_IMPORTS = ('superset.sql_lab', )
{{- if .Values.supersetNode.connections.redis_password }}
CELERY_RESULT_BACKEND = f"redis://{env('REDIS_PASSWORD')}@{env('REDIS_HOST')}:{env('REDIS_PORT')}/0"
BROKER_URL = f"redis://{env('REDIS_PASSWORD')}@{env('REDIS_HOST')}:{env('REDIS_PORT')}/0"
{{- else }}
CELERY_RESULT_BACKEND = f"redis://{env('REDIS_HOST')}:{env('REDIS_PORT')}/0"
BROKER_URL = 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'
)
Do you think readability has been maintained?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes sense. I've tried it this way before but I wanted diff to be minimal, so I didn't want to change order od parameters. I changed it, because I agree that when it will become bigger one of if/else/end could be omitted and cause lots of troubleshooting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your feedback! And please take a look once again. @craig-rueda @ad-m
Hello @craig-rueda something went wrong with promoting these changes as release. |
Could you provide PR to bump version one more time? |
I've created this PR: #18751, please merge @craig-rueda. |
CELERY_ANNOTATIONS = {'tasks.add': {'rate_limit': '10/s'}} | ||
{{- if .Values.supersetNode.connections.redis_password }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the check of auth.enabled
is needed here. Otherwise, the redis without password is connected with an incorrect url because the default value in value.yaml
is set.
SUMMARY
Redis with password was not supported out-of-the-box, so I've added this support in celery config in _helpers. When variable:
redis_password
in section:supersetNode.connections
other version of config script is created during init.I've also updated quite ancient version of Redis helm chart in dependencies.
Update process was performed according to this doc: https://artifacthub.io/packages/helm/bitnami/redis/16.3.1
I've also added small fix in documentation for helm chart. #18641
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
I've updated values.yaml json schema.
helm lint
command runs successfully. I've also checked helm templates if configs are generated without any missing/additional white space.ADDITIONAL INFORMATION