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 <hoon@linecorp.com>
This commit is contained in:
Sunghoon Kang
2022-01-20 17:01:13 +09:00
parent 947455adb9
commit 4cf07dcd97
+4
View File
@@ -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