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

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

Open
matthew117 opened this issue Aug 30, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@matthew117
Copy link

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 matthew117 added the bug Something isn't working label Aug 30, 2023
@hsubramanianaks
Copy link
Collaborator

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

@matthew117
Copy link
Author

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

@losbaltica
Copy link

Same issue happening on my end with the latest version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants