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

Add defaultMode to additionalConfigMaps #647

Merged
merged 2 commits into from
Aug 21, 2023

Conversation

bianchi2
Copy link
Collaborator

@bianchi2 bianchi2 commented Aug 16, 2023

We may want to make mounted files executable, so control over defaultMode will help. Other uses cases - security requirements that may enforce certain default modes.

Checklist

  • I have added unit tests
  • I have applied the change to all applicable products
  • The E2E test has passed (use e2e label)

@@ -1063,6 +1063,7 @@ additionalConfigMaps: []
# keys:
# - fileName: hello.properties
# mountPath: /opt/atlassian/jira/atlassian-jira/WEB-INF/classes
# defaultMode:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I find it a bit confusing to put defaultMode under each key.
mode in my opinion might be a better addition, so that we'll have spec.template.spec.volumes[n].configMap.items.mode in the statefulset.
Maybe it makes more sense to put defaultMode at configmap level? i.e.

  - name: extra-configmap
    defaultMode:
    keys:
      - fileName: hello.properties
        mountPath: /opt/atlassian/jira/atlassian-jira/WEB-INF/classes
        mode: 
        content: |
          foo=bar
          hello=world

But I have limited knowledge on how you designed additionalConfigMaps at the beginning, happy to have a chat about it.

Copy link
Collaborator Author

@bianchi2 bianchi2 Aug 17, 2023

Choose a reason for hiding this comment

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

@yzha645 thanks for your comment. I tried to use K8s terms, so, defaultMode is the volume's defaultMode. See: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#configmapvolumesource-v1-core

Also, if we move it one level up, and they have an override in each key, this will make template even more complicated - we'll have to check if defaultMode is set and then if keys[n].mode is defined. I don't see any scenarios where this type of flexibility will help.

Also, setting defaultMode is a rare case. You mostly need it if you want to make the mounted file executable.

Copy link
Collaborator

Choose a reason for hiding this comment

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

yea, thanks for the clarification. I guess in our case, each configmapvolumesource will have one and only one item, so whether set defaultMode in upper level or mode in item level probably have the same effect.

@bianchi2 bianchi2 merged commit 203a119 into main Aug 21, 2023
2 checks passed
@bianchi2 bianchi2 deleted the default-mode-for-additional-configmaps branch August 21, 2023 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants