Allow functions to enable the starlark filter (off by default)

This commit is contained in:
Phillip Wittrock
2020-03-24 20:12:39 -07:00
parent 85e9779bd6
commit 7164e55831
7 changed files with 215 additions and 37 deletions

View File

@@ -154,6 +154,44 @@ kind: Foo
apiVersion: v1
`,
},
{
name: "star",
args: []string{"run", "dir",
"--enable-star",
"--star-path", "a/b/c",
"--star-name", "foo",
"--", "Foo", "g=h"},
path: "dir",
expected: `
metadata:
name: function-input
annotations:
config.kubernetes.io/function: |
starlark: {path: a/b/c, name: foo}
data: {g: h}
kind: Foo
apiVersion: v1
`,
},
{
name: "star-not-enabled",
args: []string{"run", "dir",
"--star-path", "a/b/c",
"--star-name", "foo",
"--", "Foo", "g=h"},
path: "dir",
err: "must specify --star-path with --enable-star",
},
{
name: "image-star-not-enabled",
args: []string{"run", "dir",
"--image", "some_image",
"--star-path", "a/b/c",
"--star-name", "foo",
"--", "Foo", "g=h"},
path: "dir",
err: "must specify --star-path with --enable-star",
},
{
name: "function paths",
args: []string{"run", "dir", "--fn-path", "path1", "--fn-path", "path2"},