MCPcopy Create free account
hub / github.com/devfile/devworkspace-operator / GetNamespace

Function GetNamespace

pkg/infrastructure/namespace.go:56–66  ·  view source on GitHub ↗

GetNamespace gets the namespace of the operator by checking GetOperatorNamespace and GetWatchNamespace in that order. Returns an error if both GetOperatorNamespace and GetWatchNamespace return an error.

()

Source from the content-addressed store, hash-verified

54// GetNamespace gets the namespace of the operator by checking GetOperatorNamespace and GetWatchNamespace in that order.
55// Returns an error if both GetOperatorNamespace and GetWatchNamespace return an error.
56func GetNamespace() (string, error) {
57 ns, operErr := GetOperatorNamespace()
58 if operErr == nil {
59 return ns, nil
60 }
61 ns, watchErr := GetWatchNamespace()
62 if watchErr != nil {
63 return "", fmt.Errorf("failed to get current namespace: %s; %s", operErr, watchErr)
64 }
65 return ns, nil
66}

Callers 6

SetupWithManagerMethod · 0.92
SetupWithManagerMethod · 0.92
HandleRegistryAuthSecretFunction · 0.92
SetupControllerConfigFunction · 0.92
LoadControllerConfigFunction · 0.92

Calls 2

GetOperatorNamespaceFunction · 0.85
GetWatchNamespaceFunction · 0.85

Tested by

no test coverage detected