(namespaceFromEnvironment, namespaceFromConfigMap string)
| 494 | } |
| 495 | |
| 496 | func (c *Controller) getEffectiveNamespace(namespaceFromEnvironment, namespaceFromConfigMap string) string { |
| 497 | |
| 498 | namespace := util.Coalesce(namespaceFromEnvironment, util.Coalesce(namespaceFromConfigMap, spec.GetOperatorNamespace())) |
| 499 | |
| 500 | if namespace == "*" { |
| 501 | |
| 502 | namespace = v1.NamespaceAll |
| 503 | c.logger.Infof("Listening to all namespaces") |
| 504 | |
| 505 | } else { |
| 506 | |
| 507 | if _, err := c.KubeClient.Namespaces().Get(context.TODO(), namespace, metav1.GetOptions{}); err != nil { |
| 508 | c.logger.Fatalf("Could not find the watched namespace %q", namespace) |
| 509 | } else { |
| 510 | c.logger.Infof("Listenting to the specific namespace %q", namespace) |
| 511 | } |
| 512 | |
| 513 | } |
| 514 | |
| 515 | return namespace |
| 516 | } |
| 517 | |
| 518 | // GetReference of Postgres CR object |
| 519 | // i.e. required to emit events to this resource |
no test coverage detected