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:
@@ -55,7 +55,11 @@ func (opts *RunContainerSubCommand) do(input cli.Input) error {
|
||||
|
||||
func (opts *RunContainerSubCommand) complete(input cli.Input) error {
|
||||
fnName := input.String(flagkey.FnName)
|
||||
fnNamespace := input.String(flagkey.NamespaceFunction)
|
||||
|
||||
_, fnNamespace, err := util.GetResourceNamespace(input, flagkey.NamespaceFunction)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error in running container for function ")
|
||||
}
|
||||
|
||||
// user wants a spec, create a yaml file with package and function
|
||||
toSpec := false
|
||||
@@ -68,7 +72,7 @@ func (opts *RunContainerSubCommand) complete(input cli.Input) error {
|
||||
// check for unique function names within a namespace
|
||||
fn, err := opts.Client().V1().Function().Get(&metav1.ObjectMeta{
|
||||
Name: input.String(flagkey.FnName),
|
||||
Namespace: input.String(flagkey.NamespaceFunction),
|
||||
Namespace: fnNamespace,
|
||||
})
|
||||
if err != nil && !ferror.IsNotFound(err) {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user