Skip to content
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: Add extraVolumes and extraVolumeMounts to all main containers #16361

Merged

Conversation

cccs-tom
Copy link
Contributor

@cccs-tom cccs-tom commented Aug 19, 2021

SUMMARY

Adds extraVolumes and extraVolumeMounts objects to the Helm chart. Any volumes specified will be mounted to the main containers of all deployments as well as the init-job. Use cases include mounting additional Python modules (so they don't have to be written in-line as a YAML string) and passing in CA certs that are required by our stack.

TESTING INSTRUCTIONS

  • Add one or more extraVolumes and extraVolumeMounts.
  • Run helm install --dry-run and confirm that the pod specs contain the new volumes
  • Example:
extraVolumes:
  volume1:
    configMap:
      name: '{{ template "superset.fullname" . }}-custom-config'
  volume2:
    secret:
      secretName: my-secret
extraVolumeMounts:
  volume1:
    mountPath: /mnt/volume1
  volume2:
    mountPath: /mnt/volume2

ADDITIONAL INFORMATION

@junlincc junlincc changed the title Add extraVolumes and extraVolumeMounts to all main containers feat: Add extraVolumes and extraVolumeMounts to all main containers Aug 19, 2021
@@ -82,6 +82,10 @@ extraConfigs: {}

extraSecrets: {}

extraVolumes: {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add an example of each so people know how to use these

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -76,5 +80,9 @@ spec:
configMap:
name: {{ template "superset.fullname" . }}-extra-config
{{- end }}
{{- range $volumeName, $volume := .Values.extraVolumes }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just range over all of these and just call toyaml on them directly? That would allow users to customize extra volume options, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you suggesting changing this to a list instead of a map? The reason I implemented it this way is that my team manages multiple clusters (with one deployment of Superset per cluster). It is useful to have one "base configuration" with common values, which can then be appended to in the more specific values. Making this a list would force us to repeat this part of our configuration in multiple locations, which I was trying to avoid.

Having said that, I'm open to changing it. I'm just trying to better understand your comment:

That would allow users to customize extra volume options, etc.

With the way I implemented it, users are indeed free to specify whatever options they require. I've added a few extra options to the examples I committed in response to your previous comment. The only potential issue I can think of is that the volume names are slightly restricted by what Helm considers a valid key. Everything else will be used as-is by this line (85):

{{- tpl (toYaml $volume) $ | nindent 10 -}}

Am I misunderstanding your comment?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes total sense. I just think that most folks will run into a spot where they need an extra option for the volume, and will need to add a PR to get the additional config they need shoved in.

Something like this is what I was thinking:
https://github.com/Kong/charts/blob/main/charts/kong/values.yaml#L35

It really allows for the most flexibility possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. So using the example you linked to, that would turn into:

extraVolumes:
  volumeName:
    emptyDir: {}
extraVolumeMounts:
  volumeName:
    mountPath: "/opt/user/dir/mount"

The syntax is a little different, but I believe the flexibility is the same, is it not? With the added bonus that additional volumes can be appended without overriding the entire list (as per the use case I laid out in my previous reply).

Copy link
Member

@craig-rueda craig-rueda Aug 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, it would look like:

extraVolumes:
  - name: "cool-volume"
    emptyDir: {}

extraVolumeMounts:
 - name: "cool-volume"
   mountPath: "/opt/user/dir/mount"

This allows us to add things like defaultMode, etc. to the volume definitions. We can also mount from secrets, or configMaps without changing this chart.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I meant was that, if you modify the example in the way I wrote it in my reply, you would get the exact same YAML output as if I made the changes you requested.
My intent was to allow maximum flexibility. As far as I know, this implementation allows 100% of the volumes and volumeMounts spec. Could you provide an example of something that isn't supported with this implementation to help me better understand, please?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should use a list rather than a map here. Nested maps are a little tricky to follow in this context. The volumes and volumeMounts stanzas in Deployments, etc. use lists, so it makes the transition pretty straight forward for end users to just drop their list into this chart's values override.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just pushed this change.

@craig-rueda craig-rueda merged commit 970d762 into apache:master Aug 22, 2021
amitmiran137 pushed a commit to nielsen-oss/superset that referenced this pull request Aug 24, 2021
* master: (582 commits)
  feat: config to customize bootstrap data overrides (apache#16386)
  fix: regex for multi-region IPs (apache#16410)
  chore: Changes the DatabaseSelector to use the new Select component (apache#16334)
  chore: Displays the dataset description in a tooltip in the datasets list (apache#16392)
  fix(pylint): Fix master (apache#16405)
  chore(pylint): Enable useless-suppression check (apache#16388)
  feat: Add extraVolumes and extraVolumeMounts to all main containers (apache#16361)
  initial commit (apache#16366)
  fix: big number default date format (apache#16383)
  initial commit (apache#16380)
  fix: import dashboard w/o metadata (apache#16360)
  test: Functional RTL for email report modal II (apache#16148)
  fix: update table ID in query context on chart import (apache#16374)
  docs: document FLASK_APP_MUTATOR (apache#16286)
  feat: Add new dev commands to Makefile (apache#16327)
  fix: call external metadata endpoint with correct rison object (apache#16369)
  fix: Fix parsing onSaving reports toast when user hasn't saved chart (apache#16330)
  fix: columns/index rebuild (apache#16355)
  chore(viz): bump deckgl plugin to 0.4.11 (apache#16353)
  fix: Blank space in Change dataset modal without warning message (apache#16324)
  ...

# Conflicts:
#	superset/app.py
#	superset/models/dashboard.py
#	tests/integration_tests/charts/filter_sets/__init__.py
#	tests/integration_tests/charts/filter_sets/conftest.py
#	tests/integration_tests/charts/filter_sets/consts.py
#	tests/integration_tests/charts/filter_sets/create_api_tests.py
#	tests/integration_tests/charts/filter_sets/delete_api_tests.py
#	tests/integration_tests/charts/filter_sets/get_api_tests.py
#	tests/integration_tests/charts/filter_sets/update_api_tests.py
#	tests/integration_tests/charts/filter_sets/utils.py
#	tests/integration_tests/superset_test_config.py
@cccs-tom cccs-tom deleted the feature/helm-add-extra-volumes branch September 7, 2021 17:40
opus-42 pushed a commit to opus-42/incubator-superset that referenced this pull request Nov 14, 2021
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 28, 2021
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.4.0 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/M 🚢 1.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants