-
Notifications
You must be signed in to change notification settings - Fork 792
[BUG] Kompose does not mount secrets like compose #1778
Description
Expected Behavior
secrets defined in compose.yaml should be mounted in the pods in /run/secrets/<secret>
Actual Behavior
/run/secrets/<secret> is mounted as a directory
Steps To Reproduce
- Add secrets to compose.yaml
services:
myservice:
...
secrets:
- config-ini
secrets:
config-ini:
file: secrets/Config.ini
-
kompose convert
-
examine generated pod config file:
The result is:
volumeMounts:
- mountPath: /run/secrets/config-ini
name: config-ini
Which appears correct at a glance, but when running, I get the error that config-ini is a directory.
Kompose Version
1.31.2 (HEAD)
Docker-Compose file
No response
Anything else?
I was able to fix the pod file by adding subPath:
volumeMounts:
- mountPath: /run/secrets/config-ini
subPath: config-ini
name: config-ini
With subPath, it gets mounted as a file instead of a directory.
I don't know k8 very well, I would guess it's mounted as a directory because secrets can hold more than one key-value pair. In that case it wouldn't necessarily make sense to put all the key-value pairs into one file, especially if each key should be its own file.
But with docker compose, secrets are only one key->value, so that behavior should be translated.