From 4cf07dcd97dbe2cae5547d47f58c3aeb16af5d6c Mon Sep 17 00:00:00 2001 From: Sunghoon Kang Date: Thu, 20 Jan 2022 17:01:13 +0900 Subject: [PATCH] Fix: prioritize namespace flag for `vela up` Currently, CLI applies application to `default` namespace when there is no explicit namespace in application spec, even if the namespace flag is set. This commit fixes issue by overriding the namespace if the namespace flag is set. Signed-off-by: Sunghoon Kang --- references/cli/up.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/references/cli/up.go b/references/cli/up.go index 1b2ceee06..a9be5a4a4 100644 --- a/references/cli/up.go +++ b/references/cli/up.go @@ -68,6 +68,10 @@ func NewUpCommand(c common2.Args, order string, ioStream cmdutil.IOStreams) *cob if err != nil { return errors.Wrap(err, "File format is illegal, only support vela appfile format or OAM Application object yaml") } + // override namespace if namespace flag is set + if namespace != "" { + app.SetNamespace(namespace) + } err = common.ApplyApplication(app, ioStream, kubecli) if err != nil { return err