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:
@@ -29,6 +29,7 @@ import (
|
||||
"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 UpdateSubCommand struct {
|
||||
@@ -50,9 +51,12 @@ func (opts *UpdateSubCommand) do(input cli.Input) error {
|
||||
return opts.run(input)
|
||||
}
|
||||
|
||||
func (opts *UpdateSubCommand) complete(input cli.Input) error {
|
||||
func (opts *UpdateSubCommand) complete(input cli.Input) (err error) {
|
||||
opts.pkgName = input.String(flagkey.PkgName)
|
||||
opts.pkgNamespace = input.String(flagkey.NamespacePackage)
|
||||
_, opts.pkgNamespace, err = util.GetResourceNamespace(input, flagkey.NamespacePackage)
|
||||
if err != nil {
|
||||
return fv1.AggregateValidationErrors("Environment", err)
|
||||
}
|
||||
opts.force = input.Bool(flagkey.PkgForce)
|
||||
return nil
|
||||
}
|
||||
@@ -94,7 +98,6 @@ func (opts *UpdateSubCommand) run(input cli.Input) error {
|
||||
|
||||
func UpdatePackage(input cli.Input, client client.Interface, pkg *fv1.Package) (*metav1.ObjectMeta, error) {
|
||||
envName := input.String(flagkey.PkgEnvironment)
|
||||
envNamespace := input.String(flagkey.NamespaceEnvironment)
|
||||
srcArchiveFiles := input.StringSlice(flagkey.PkgSrcArchive)
|
||||
deployArchiveFiles := input.StringSlice(flagkey.PkgDeployArchive)
|
||||
buildcmd := input.String(flagkey.PkgBuildCmd)
|
||||
@@ -119,12 +122,6 @@ func UpdatePackage(input cli.Input, client client.Interface, pkg *fv1.Package) (
|
||||
needToUpdate = true
|
||||
}
|
||||
|
||||
if input.IsSet(flagkey.NamespaceEnvironment) {
|
||||
pkg.Spec.Environment.Namespace = envNamespace
|
||||
needToRebuild = true
|
||||
needToUpdate = true
|
||||
}
|
||||
|
||||
if input.IsSet(flagkey.PkgBuildCmd) {
|
||||
pkg.Spec.BuildCommand = buildcmd
|
||||
needToRebuild = true
|
||||
|
||||
Reference in New Issue
Block a user