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

Function GetOperatorNamespace

pkg/infrastructure/namespace.go:31–41  ·  view source on GitHub ↗

GetOperatorNamespace returns the namespace the operator should be running in. This function was ported over from Operator SDK 0.17.0 and modified.

()

Source from the content-addressed store, hash-verified

29//
30// This function was ported over from Operator SDK 0.17.0 and modified.
31func GetOperatorNamespace() (string, error) {
32 nsBytes, err := os.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace")
33 if err != nil {
34 if os.IsNotExist(err) {
35 return "", fmt.Errorf("could not read namespace from mounted serviceaccount info")
36 }
37 return "", err
38 }
39 ns := strings.TrimSpace(string(nsBytes))
40 return ns, nil
41}
42
43// GetWatchNamespace returns the namespace the operator should be watching for changes
44//

Callers 4

SetupWebhooksFunction · 0.92
ConfigureFunction · 0.92
controllerSAUIDFunction · 0.92
GetNamespaceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected