No way to mount Single FIle.
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
-
File using subPath from ConfigMap. But Voulmes don't support Config map currently. https://stackoverflow.com/questions/44325048/kubernetes-configmap-only-one-file
-
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.
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.
I tried this but it is not solving the problem, as it mounts the files however any files which exist in that directory would no longer be present.
I have even tried adding Subpath as recommended in Stack Overflow. But this also leads to overwriting the full /etc/logrotate.d directory with one file default.conf in this case.
fileSecrets:
- name: config path: /etc/logrotate.d/ subPath: default.conf secrets: key.txt: Another File default.conf: | server { listen 80; server_name localhost; proxy_pass https://www.google.com/; } }
Regards, Amanpreet Singh.
On Thu, Oct 13, 2022 at 4:36 PM Laszlo Fogas @.***> wrote:
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.
— Reply to this email directly, view it on GitHub https://github.com/gimlet-io/onechart/issues/58#issuecomment-1277434572, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADEC5PUY2TMO45RSZWK4OLWC7UL3ANCNFSM6AAAAAARDYVQQE . You are receiving this because you authored the thread.Message ID: @.***>
Oh, yes. I hate that problem.
Let me look at it.
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
https://github.com/gimlet-io/onechart/releases/tag/v0.43.0