Skip to content

kustomize build breaks Docker volume mounts by converting volume names to absolute paths #6072

@tonobo

Description

@tonobo

When using a container-based transformer with a volume type storage mount, kustomize build incorrectly
converts the volume name to an absolute host path.

For example, given a transformer like:

apiVersion: example.com/v1
kind: MyProcessor
metadata:
  name: my-processor
  annotations:
    config.kubernetes.io/function: |
      container:
        image: my-registry/my-plugin:latest
        mounts:
          - src: my-volume
            dst: /data
            type: volume

Running kustomize build --enable-alpha-plugins produces a Docker command with:

--mount type=volume,source=/current/working/dir/my-volume,target=/data

instead of the correct:

--mount type=volume,source=my-volume,target=/data

This happens because commit 9d5491c added relative-to-absolute path conversion for all StorageMount.Src
values. This is correct for bind mounts (Docker requires absolute paths for those), but for volume
mounts the source is a Docker volume name, not a filesystem path.

Expected behavior: Volume mount sources should be passed through as-is. Only bind mount sources should
have relative paths converted to absolute.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-kindIndicates a PR lacks a `kind/foo` label and requires one.needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions