Remove "openfaas-fn" as default namespace
A user deployed to Okteto where the namespace by default is their username. Byforcing openfaas-fn by default this was preventing a zero value from being passed which had the effect of always over-riding the users default namespace. Signed-off-by: Richard Gee <richard@technologee.co.uk>
This commit is contained in:
@@ -20,7 +20,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
defaultFunctionNamespace = "openfaas-fn"
|
||||
defaultFunctionNamespace = ""
|
||||
resourceKind = "Function"
|
||||
defaultAPIVersion = "openfaas.com/v1"
|
||||
)
|
||||
|
||||
@@ -23,7 +23,7 @@ var generateTestcases = []struct {
|
||||
Version string
|
||||
}{
|
||||
{
|
||||
Name: "Default Namespace and API Version",
|
||||
Name: "Specified Namespace and API Version",
|
||||
Input: `
|
||||
provider:
|
||||
name: openfaas
|
||||
|
||||
@@ -64,13 +64,11 @@ func getNamespace(flagNamespace, stackNamespace string) string {
|
||||
if len(flagNamespace) > 0 {
|
||||
return flagNamespace
|
||||
}
|
||||
|
||||
// if both the namespace flag in stack.yaml and the namespace flag are ommitted
|
||||
// return the defaultNamespace (openfaas-fn)
|
||||
if len(stackNamespace) == 0 && len(flagNamespace) == 0 {
|
||||
return defaultFunctionNamespace
|
||||
// https://github.com/openfaas/faas-cli/issues/742#issuecomment-625746405
|
||||
if len(stackNamespace) > 0 {
|
||||
return stackNamespace
|
||||
}
|
||||
|
||||
// Else return the namespace in stack.yaml
|
||||
return stackNamespace
|
||||
return defaultFunctionNamespace
|
||||
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ func Test_getOverrideNamespace(t *testing.T) {
|
||||
{
|
||||
stack: "",
|
||||
flag: "",
|
||||
want: "openfaas-fn",
|
||||
want: "",
|
||||
scenario: "no namespace value set in flag and in namespace field of stack file",
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user