Update mount flag to match docker docs

- Also modify TODO in validator-kubeval example
This commit is contained in:
Prachi Pendse
2020-04-02 10:31:15 -07:00
parent 38973a80c3
commit b17ea88bf7
4 changed files with 12 additions and 6 deletions

View File

@@ -55,7 +55,7 @@ func GetRunFnRunner(name string) *RunFnRunner {
&r.Network, "network", false, "enable network access for functions that declare it") &r.Network, "network", false, "enable network access for functions that declare it")
r.Command.Flags().StringVar( r.Command.Flags().StringVar(
&r.NetworkName, "network-name", "bridge", "the docker network to run the container in") &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{}, &r.Mounts, "mount", []string{},
"a list of storage options read from the filesystem") "a list of storage options read from the filesystem")
return r return r

View File

@@ -219,12 +219,12 @@ apiVersion: v1
{ {
name: "custom kind with storage mounts", name: "custom kind with storage mounts",
args: []string{ args: []string{
"run", "dir", "--mount", "type=bind;src=/mount/path;dst=/local/", "run", "dir", "--mount", "type=bind,src=/mount/path,dst=/local/",
"--mount", "type=volume;src=myvol;dst=/local/", "--mount", "type=volume,src=myvol,dst=/local/",
"--mount", "type=tmpfs;dst=/local/", "--mount", "type=tmpfs,dst=/local/",
"--image", "foo:bar", "--", "Foo", "g=h", "i=j=k"}, "--image", "foo:bar", "--", "Foo", "g=h", "i=j=k"},
path: "dir", 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: ` expected: `
metadata: metadata:
name: function-input name: function-input

View File

@@ -12,6 +12,12 @@ spec:
strict: true strict: true
ignoreMissingSchemas: 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 apiVersion: v1
kind: Service kind: Service

View File

@@ -162,7 +162,7 @@ func (s *StorageMount) String() string {
func StringToStorageMount(s string) StorageMount { func StringToStorageMount(s string) StorageMount {
m := make(map[string]string) m := make(map[string]string)
options := strings.Split(s, ";") options := strings.Split(s, ",")
for _, option := range options { for _, option := range options {
keyVal := strings.Split(option, "=") keyVal := strings.Split(option, "=")
m[keyVal[0]] = keyVal[1] m[keyVal[0]] = keyVal[1]