Skip to content
This repository was archived by the owner on Dec 15, 2021. It is now read-only.

Fix --env flag for arrays #908

Merged
merged 1 commit into from
Sep 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/kubeless/function/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ var deployCmd = &cobra.Command{
logrus.Fatal(err)
}

envs, err := cmd.Flags().GetStringArray("env")
envs, err := cmd.Flags().GetStringSlice("env")
if err != nil {
logrus.Fatal(err)
}
Expand Down Expand Up @@ -264,7 +264,7 @@ func init() {
deployCmd.Flags().StringP("from-file", "f", "", "Specify code file or a URL to the code file")
deployCmd.Flags().StringSliceP("label", "l", []string{}, "Specify labels of the function. Both separator ':' and '=' are allowed. For example: --label foo1=bar1,foo2:bar2")
deployCmd.Flags().StringSliceP("secrets", "", []string{}, "Specify Secrets to be mounted to the functions container. For example: --secrets mySecret")
deployCmd.Flags().StringArrayP("env", "e", []string{}, "Specify environment variable of the function. Both separator ':' and '=' are allowed. For example: --env foo1=bar1,foo2:bar2")
deployCmd.Flags().StringSliceP("env", "e", []string{}, "Specify environment variable of the function. Both separator ':' and '=' are allowed. For example: --env foo1=bar1,foo2:bar2")
deployCmd.Flags().StringP("namespace", "n", "", "Specify namespace for the function")
deployCmd.Flags().StringP("dependencies", "d", "", "Specify a file containing list of dependencies for the function")
deployCmd.Flags().StringP("schedule", "", "", "Specify schedule in cron format for scheduled function")
Expand Down
4 changes: 2 additions & 2 deletions cmd/kubeless/function/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ var updateCmd = &cobra.Command{
logrus.Fatal(err)
}

envs, err := cmd.Flags().GetStringArray("env")
envs, err := cmd.Flags().GetStringSlice("env")
if err != nil {
logrus.Fatal(err)
}
Expand Down Expand Up @@ -210,7 +210,7 @@ func init() {
updateCmd.Flags().StringP("cpu", "", "", "Request amount of cpu for the function.")
updateCmd.Flags().StringSliceP("label", "l", []string{}, "Specify labels of the function")
updateCmd.Flags().StringSliceP("secrets", "", []string{}, "Specify Secrets to be mounted to the functions container. For example: --secrets mySecret")
updateCmd.Flags().StringArrayP("env", "e", []string{}, "Specify environment variable of the function")
updateCmd.Flags().StringSliceP("env", "e", []string{}, "Specify environment variable of the function")
updateCmd.Flags().StringP("namespace", "n", "", "Specify namespace for the function")
updateCmd.Flags().StringP("dependencies", "d", "", "Specify a file containing list of dependencies for the function")
updateCmd.Flags().StringP("runtime-image", "", "", "Custom runtime image")
Expand Down
4 changes: 3 additions & 1 deletion examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,12 @@ post-go-verify:
echo $$logs | grep -q "cli.kubeless.io"

get-python-metadata:
kubeless function deploy get-python-metadata --runtime python2.7 --handler helloget.foo --from-file python/helloget.py --env foo:bar,bar=foo,foo --memory 128Mi --label foo:bar,bar=foo,foobar
kubeless function deploy get-python-metadata --runtime python2.7 --handler helloget.foo --from-file python/helloget.py --env foo:bar,bar=foo --memory 128Mi --label foo:bar,bar=foo,foobar

get-python-metadata-verify:
kubeless function call get-python-metadata |egrep hello.world
kubectl get po -o jsonpath='{.items[0].spec.containers[0].env}' -l function=get-python-metadata | grep "name:foo value:bar"
kubectl get po -o jsonpath='{.items[0].spec.containers[0].env}' -l function=get-python-metadata | grep "name:bar value:foo"

get-python-secrets:
kubectl create secret generic test-secret --from-literal=key=MY_KEY || true
Expand Down