From b17ea88bf79d9311d2f214328e4e498e37ea2ef0 Mon Sep 17 00:00:00 2001 From: Prachi Pendse Date: Thu, 2 Apr 2020 10:31:15 -0700 Subject: [PATCH] Update mount flag to match docker docs - Also modify TODO in validator-kubeval example --- cmd/config/internal/commands/run-fns.go | 2 +- cmd/config/internal/commands/run_test.go | 8 ++++---- .../validator-kubeval/local-resource/example-use.yaml | 6 ++++++ kyaml/kio/filters/container.go | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/cmd/config/internal/commands/run-fns.go b/cmd/config/internal/commands/run-fns.go index 523cf9015..12558f044 100644 --- a/cmd/config/internal/commands/run-fns.go +++ b/cmd/config/internal/commands/run-fns.go @@ -55,7 +55,7 @@ func GetRunFnRunner(name string) *RunFnRunner { &r.Network, "network", false, "enable network access for functions that declare it") r.Command.Flags().StringVar( &r.NetworkName, "network-name", "bridge", "the docker network to run the container in") - r.Command.Flags().StringSliceVar( + r.Command.Flags().StringArrayVar( &r.Mounts, "mount", []string{}, "a list of storage options read from the filesystem") return r diff --git a/cmd/config/internal/commands/run_test.go b/cmd/config/internal/commands/run_test.go index a3e8f492d..33a400df6 100644 --- a/cmd/config/internal/commands/run_test.go +++ b/cmd/config/internal/commands/run_test.go @@ -219,12 +219,12 @@ apiVersion: v1 { name: "custom kind with storage mounts", args: []string{ - "run", "dir", "--mount", "type=bind;src=/mount/path;dst=/local/", - "--mount", "type=volume;src=myvol;dst=/local/", - "--mount", "type=tmpfs;dst=/local/", + "run", "dir", "--mount", "type=bind,src=/mount/path,dst=/local/", + "--mount", "type=volume,src=myvol,dst=/local/", + "--mount", "type=tmpfs,dst=/local/", "--image", "foo:bar", "--", "Foo", "g=h", "i=j=k"}, path: "dir", - mount: []string{"type=bind;src=/mount/path;dst=/local/", "type=volume;src=myvol;dst=/local/", "type=tmpfs;dst=/local/"}, + mount: []string{"type=bind,src=/mount/path,dst=/local/", "type=volume,src=myvol,dst=/local/", "type=tmpfs,dst=/local/"}, expected: ` metadata: name: function-input diff --git a/functions/examples/validator-kubeval/local-resource/example-use.yaml b/functions/examples/validator-kubeval/local-resource/example-use.yaml index 0c040422e..e1067b543 100644 --- a/functions/examples/validator-kubeval/local-resource/example-use.yaml +++ b/functions/examples/validator-kubeval/local-resource/example-use.yaml @@ -12,6 +12,12 @@ spec: strict: true ignoreMissingSchemas: true + # TODO: Update this to use network/volumes features. + # Relevant issues: + # - https://github.com/kubernetes-sigs/kustomize/issues/1901 + # - https://github.com/kubernetes-sigs/kustomize/issues/1902 + kubernetesVersion: "1.16.0" + schemaLocation: "file:///schemas" --- apiVersion: v1 kind: Service diff --git a/kyaml/kio/filters/container.go b/kyaml/kio/filters/container.go index 54dfdec57..9e6a681fb 100644 --- a/kyaml/kio/filters/container.go +++ b/kyaml/kio/filters/container.go @@ -162,7 +162,7 @@ func (s *StorageMount) String() string { func StringToStorageMount(s string) StorageMount { m := make(map[string]string) - options := strings.Split(s, ";") + options := strings.Split(s, ",") for _, option := range options { keyVal := strings.Split(option, "=") m[keyVal[0]] = keyVal[1]