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:
Richard Gee
2021-03-11 14:46:06 +00:00
committed by Alex Ellis
parent 6e1d484801
commit 2cec97955a
4 changed files with 8 additions and 10 deletions

View File

@@ -20,7 +20,7 @@ import (
)
const (
defaultFunctionNamespace = "openfaas-fn"
defaultFunctionNamespace = ""
resourceKind = "Function"
defaultAPIVersion = "openfaas.com/v1"
)

View File

@@ -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

View File

@@ -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
}

View File

@@ -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",
},