From 2336bb5cb27669c5a812008f3b0533cd7ac6da4f Mon Sep 17 00:00:00 2001 From: Jason Hall Date: Wed, 13 Jul 2022 16:55:31 -0400 Subject: [PATCH] ko run: remove --generator flag (#751) * ko run: remove --generator flag * ignore dashes when passing args to kubectl * avoid panic --- pkg/commands/run.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkg/commands/run.go b/pkg/commands/run.go index 5143268082..55efa3b9a3 100644 --- a/pkg/commands/run.go +++ b/pkg/commands/run.go @@ -67,8 +67,8 @@ func addRun(topLevel *cobra.Command) { kubectlArgs := []string{} dashes = unparsedDashes() - if dashes != -1 { - kubectlArgs = os.Args[dashes:] + if dashes != -1 && dashes != len(os.Args) { + kubectlArgs = os.Args[dashes+1:] } bo.InsecureRegistry = po.InsecureRegistry @@ -102,7 +102,6 @@ func addRun(topLevel *cobra.Command) { // These are better defaults: defaults := []string{ - "--generator=run-pod/v1", // create a pod instead of deployment "--attach", // stream logs back "--rm", // clean up after ourselves "--restart=Never", // we just want to run once