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

No way to mount Single FIle. #58

Closed
amanhigh opened this issue Oct 13, 2022 · 5 comments
Closed

No way to mount Single FIle. #58

amanhigh opened this issue Oct 13, 2022 · 5 comments

Comments

@amanhigh
Copy link

I have usecase where i can't mount a directory but only a file.

Application uses a config /etc/tinyproxy.conf. Mounting /etc overrides all other configs. Hence there is need to just map single file.

Possible ways to do this

  1. File using subPath from ConfigMap. But Voulmes don't support Config map currently.
    https://stackoverflow.com/questions/44325048/kubernetes-configmap-only-one-file

  2. Init Script that can run before Pod Start.

  • Here i can mount my files /etc/tiny/tinyproxy.conf.
  • Init Script can then copy /etc/tiny/tinyproxy.conf to /etc/tinyproxy.conf before starting Container.
@laszlocph
Copy link
Contributor

The listed cases are not supported, but there is another solution that you can try.

https://gimlet.io/docs/onechart-reference#mounting-secrets-as-files

fileSecrets:
  - name: rabbitmq-conf
    path: /etc/rabbitmq
    secrets:
      rabbitmq.conf: |
        this is the conf file content
      definitions.json: |
        this
        is
        a
        multiline
        secret

It is technically a secret resource in k8s not a configmap.. you can add the file content in the values file.

Volumes configmap support is required feature and will land in OneChart. Thank you for the issue.

@amanhigh
Copy link
Author

amanhigh commented Oct 14, 2022 via email

@laszlocph
Copy link
Contributor

Oh, yes. I hate that problem.

Let me look at it.

@YoucefGuichi
Copy link
Contributor

YoucefGuichi commented Mar 16, 2023

Follow-up 🪄

hello @amanhigh,
The following use cases are possible now within onechart's volumes:

Case 1 (Mount an existing configMap as a file):

volumes:
- existingConfigMap: map
  path: /data/map.conf
  subPath: map.conf

Case 2 (Mount an emptyDir):

volumes:
- emptyDir: true
  path: /data
  name: empty

Case 3 (Mount a custom string as a file):

volumes:
- fileName: blabla.conf
  fileContent: |
     multi-line-text
     multi-line-text
  path: /data   

@laszlocph
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants