Bridge-To-Kubernetes
Bridge-To-Kubernetes copied to clipboard
When copying volume mounts that use multiple subPaths, only the first is copied
Describe the bug When using Bridge to Kubernetes to redirect a deployment that has multiple volumeMounts using subPath to selectively sync and rename some files, only the first file from each mount is downloaded locally.
I have a KubernetesLocalProcessConfig.yaml that looks like:
version: 0.1
volumeMounts:
- name: company-app-fileshare
localPath: C:\company-app
- name: company-app-config
localPath: C:\company-app
env:
- name: LOCAL_SETTINGS_PATH
value: $(volumeMounts:company-app-fileshare)/app/app-settings.json
- name: LOCAL_SECRETS_PATH
value: $(volumeMounts:company-app-fileshare)/app/app-secrets.json
- name: LOCAL_SERVICES_PATH
value: $(volumeMounts:company-app-config)/app/services.json
and my K8s deployment looks like:
volumeMounts:
- name: company-app-config
mountPath: /app/service_discovery-settings.json
subPath: service_discovery-settings.json
- name: company-app-config
mountPath: /app/services.json
subPath: services.json
- name: company-app-fileshare
mountPath: /app/app-secrets.json
subPath: company-app.json
- name: company-app-fileshare
mountPath: /app/app-settings.json
subPath: company-app.json
- name: company-app-fileshare
mountPath: /app/tenants-settings.json
subPath: company-app.json
I realise that the setup is a bit weird with one file from the fileshare being mounted as several different names but it happens with the config map that uses different keys too.
Mention the platform you are using VScode and AKS
To Reproduce Steps to reproduce the behavior: Create a pod with a mount that has mounts multiple files using subPath from one volume source:
volumeMounts:
- name: company-app-config
mountPath: /app/service_discovery-settings.json
subPath: service_discovery-settings.json
- name: company-app-config
mountPath: /app/services.json
subPath: services.json
Example config map:
apiVersion: v1
kind: ConfigMap
metadata:
name: company-app-config
data:
service_discovery-settings.json: '{"useServiceDiscoveryFile": true }'
services.json: '{"service": "127.0.0.1" }'
Setup your KubernetesLocalProcessConfig.yaml to mount the volume
version: 0.1
volumeMounts:
- name: company-app-config
localPath: C:\company-app
env:
- name: LOCAL_SETTINGS_PATH
value: $(volumeMounts:company-app-config)/app/service_discovery-settings.json
- name: LOCAL_SERVICES_PATH
value: $(volumeMounts:company-app-config)/app/services.json
Expected behavior All files are available locally.
Screenshots
Logs:
2023-08-30T16:26:56.3699286Z | Library | TRACE | Loaded env var 'company-app-fileshare' of type VolumeToken: {"localPath":"C:\\company-app","name":"company-app-fileshare"} => C:\company-app
2023-08-30T16:26:56.3704419Z | Library | TRACE | Loaded env var '' of type VerbatimToken: {"name":""} => /app/app-settings.json
2023-08-30T16:26:56.3719766Z | Library | TRACE | Loaded env var 'company-app-fileshare' of type VolumeToken: {"localPath":"C:\\company-app","name":"company-app-fileshare"} => C:\company-app
2023-08-30T16:26:56.3720454Z | Library | TRACE | Loaded env var '' of type VerbatimToken: {"name":""} => /app/app-secrets.json
2023-08-30T16:26:56.3721286Z | Library | TRACE | Loaded env var 'company-app-config' of type VolumeToken: {"localPath":"C:\\company-app","name":"company-app-config"} => C:\company-app
2023-08-30T16:26:56.3721712Z | Library | TRACE | Loaded env var '' of type VerbatimToken: {"name":""} => /app/services.json
Desktop (please complete the following information):
- OS: Windows 11 Professional
- Browser: Chrome
- Version: 116.0.5845.111 (Official Build) (64-bit)
Smartphone (please complete the following information): N/A
Additional context Add any other context about the problem here.
@matthew117 Apologies for late response, is this still happening, or you found a workaround for this ? Please let us know. We are very small team just maintaining this repo, if you are willing to contribute, we are happy to assist you with it. Thank you.
It still happens but I switched to using a pre launch task that performs a bunch of kubectl cp commands
Same issue happening on my end with the latest version