Skip to content

Commit 2cec979

Browse files
rgee0alexellis
authored andcommitted
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 <[email protected]>
1 parent 6e1d484 commit 2cec979

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

commands/generate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
)
2121

2222
const (
23-
defaultFunctionNamespace = "openfaas-fn"
23+
defaultFunctionNamespace = ""
2424
resourceKind = "Function"
2525
defaultAPIVersion = "openfaas.com/v1"
2626
)

commands/generate_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var generateTestcases = []struct {
2323
Version string
2424
}{
2525
{
26-
Name: "Default Namespace and API Version",
26+
Name: "Specified Namespace and API Version",
2727
Input: `
2828
provider:
2929
name: openfaas

commands/priority.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,11 @@ func getNamespace(flagNamespace, stackNamespace string) string {
6464
if len(flagNamespace) > 0 {
6565
return flagNamespace
6666
}
67-
68-
// if both the namespace flag in stack.yaml and the namespace flag are ommitted
69-
// return the defaultNamespace (openfaas-fn)
70-
if len(stackNamespace) == 0 && len(flagNamespace) == 0 {
71-
return defaultFunctionNamespace
67+
// https://github.com/openfaas/faas-cli/issues/742#issuecomment-625746405
68+
if len(stackNamespace) > 0 {
69+
return stackNamespace
7270
}
7371

74-
// Else return the namespace in stack.yaml
75-
return stackNamespace
72+
return defaultFunctionNamespace
73+
7674
}

commands/priority_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func Test_getOverrideNamespace(t *testing.T) {
6161
{
6262
stack: "",
6363
flag: "",
64-
want: "openfaas-fn",
64+
want: "",
6565
scenario: "no namespace value set in flag and in namespace field of stack file",
6666
},
6767

0 commit comments

Comments
 (0)