mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-10 08:20:59 +00:00
Made mountString params more similar to docker params
see [1] kept support for the previous field names similarly to docker behavior. [1] https://docs.docker.com/storage/bind-mounts/#use-a-read-only-bind-mount
This commit is contained in:
@@ -166,9 +166,9 @@ func StringToStorageMount(s string) StorageMount {
|
||||
switch {
|
||||
case key == "type":
|
||||
sm.MountType = value
|
||||
case key == "src":
|
||||
case key == "src" || key == "source":
|
||||
sm.Src = value
|
||||
case key == "dst":
|
||||
case key == "dst" || key == "target":
|
||||
sm.DstPath = value
|
||||
case key == "rw" && value == "true":
|
||||
sm.ReadWriteMode = true
|
||||
|
||||
@@ -1413,6 +1413,14 @@ func Test_StringToStorageMount(t *testing.T) {
|
||||
in: "type=tmpfs,src=/tmp/test/,dst",
|
||||
expectedOut: "type=tmpfs,source=/tmp/test/,target=,readonly",
|
||||
},
|
||||
{
|
||||
in: "type=bind,source=/tmp/test/,target=/tmp/source/,rw=true",
|
||||
expectedOut: "type=bind,source=/tmp/test/,target=/tmp/source/",
|
||||
},
|
||||
{
|
||||
in: "type=bind,source=/tmp/test/,target=/tmp/source/",
|
||||
expectedOut: "type=bind,source=/tmp/test/,target=/tmp/source/,readonly",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
|
||||
Reference in New Issue
Block a user