MCPcopy Index your code
hub / github.com/zalando/postgres-operator / getEffectiveNamespace

Method getEffectiveNamespace

pkg/controller/controller.go:496–516  ·  view source on GitHub ↗
(namespaceFromEnvironment, namespaceFromConfigMap string)

Source from the content-addressed store, hash-verified

494}
495
496func (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

Callers 1

Calls 3

CoalesceFunction · 0.92
GetOperatorNamespaceFunction · 0.92
GetMethod · 0.65

Tested by

no test coverage detected