Bridge-To-Kubernetes icon indicating copy to clipboard operation
Bridge-To-Kubernetes copied to clipboard

When copying volume mounts that use multiple subPaths, only the first is copied

Open matthew117 opened this issue 2 years ago • 3 comments

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 image

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 avatar Aug 30 '23 16:08 matthew117

@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.

hsubramanianaks avatar Jan 10 '24 20:01 hsubramanianaks

It still happens but I switched to using a pre launch task that performs a bunch of kubectl cp commands

matthew117 avatar Jan 10 '24 20:01 matthew117

Same issue happening on my end with the latest version

losbaltica avatar Mar 13 '24 12:03 losbaltica