Skip to content

Commit

Permalink
Remove "openfaas-fn" as default namespace
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
rgee0 authored and alexellis committed Mar 11, 2021
1 parent 6e1d484 commit 2cec979
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion commands/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
)

const (
defaultFunctionNamespace = "openfaas-fn"
defaultFunctionNamespace = ""
resourceKind = "Function"
defaultAPIVersion = "openfaas.com/v1"
)
Expand Down
2 changes: 1 addition & 1 deletion commands/generate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 5 additions & 7 deletions commands/priority.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

}
2 changes: 1 addition & 1 deletion commands/priority_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},

Expand Down

0 comments on commit 2cec979

Please sign in to comment.