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.
()
| 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. |
| 56 | func 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 | } |
no test coverage detected