add namespace param for fn and env (#2556)

This PR moves fission CLI as closer as possible to kubectl command behaviour.  We have improved namespace handling behaviour across CLI.

* add namespace param for fn and env
* use common fn for ns check
* update validation
* default namespace for httpTrigger, env and package, config and triggers
* use default ns
* add namespace filter to spec
* add forceNamespace flag
* set current namespace
* add default namespace in config
* add namespace specific destroy
* add all namespace in the list of resources
* add namespace as global tag
* use %s instead of %v
* add test cases for namespace
* use ns in get all functions
This commit is contained in:
neha_gupta
2022-10-11 13:23:47 +05:30
committed by GitHub
parent 0739aca920
commit b9513868ed
74 changed files with 1289 additions and 304 deletions
+15 -3
View File
@@ -23,9 +23,11 @@ import (
"github.com/pkg/errors"
v1 "github.com/fission/fission/pkg/apis/core/v1"
"github.com/fission/fission/pkg/fission-cli/cliwrapper/cli"
"github.com/fission/fission/pkg/fission-cli/cmd"
flagkey "github.com/fission/fission/pkg/fission-cli/flag/key"
"github.com/fission/fission/pkg/fission-cli/util"
)
type ListSubCommand struct {
@@ -36,9 +38,19 @@ func List(input cli.Input) error {
return (&ListSubCommand{}).do(input)
}
func (opts *ListSubCommand) do(input cli.Input) error {
ttNs := input.String(flagkey.NamespaceTrigger)
tts, err := opts.Client().V1().TimeTrigger().List(ttNs)
func (opts *ListSubCommand) do(input cli.Input) (err error) {
_, ttNs, err := util.GetResourceNamespace(input, flagkey.NamespaceTrigger)
if err != nil {
return errors.Wrap(err, "error in deleting function ")
}
var tts []v1.TimeTrigger
if input.Bool(flagkey.AllNamespaces) {
tts, err = opts.Client().V1().TimeTrigger().List("")
} else {
tts, err = opts.Client().V1().TimeTrigger().List(ttNs)
}
if err != nil {
return errors.Wrap(err, "list Time triggers")
}