From 9390ae36300f966a2f457c70394b3bde0566596b Mon Sep 17 00:00:00 2001 From: Felix Kunde Date: Fri, 6 Mar 2020 17:18:28 +0100 Subject: [PATCH] reflect code review --- cmd/main.go | 1 - docs/administrator.md | 2 +- pkg/controller/postgresql.go | 8 ++------ 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index 2372ad2e0..7fadd611a 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -19,7 +19,6 @@ var ( outOfCluster bool version string config spec.ControllerConfig - controllerID string ) func mustParseDuration(d string) time.Duration { diff --git a/docs/administrator.md b/docs/administrator.md index 5f56c8be5..a3a0f70cc 100644 --- a/docs/administrator.md +++ b/docs/administrator.md @@ -95,7 +95,7 @@ lacks access rights to any of them (except K8s system namespaces like 'list pods' execute at the cluster scope and fail at the first violation of access rights. -## Operators with defined ownership on certain Postgres clusters +## Operators with defined ownership of certain Postgres clusters By default, multiple operators can only run together in one K8s cluster when isolated into their [own namespaces](administrator.md#specify-the-namespace-to-watch). diff --git a/pkg/controller/postgresql.go b/pkg/controller/postgresql.go index c5c2e6983..5d48bac39 100644 --- a/pkg/controller/postgresql.go +++ b/pkg/controller/postgresql.go @@ -51,13 +51,9 @@ func (c *Controller) listClusters(options metav1.ListOptions) (*acidv1.Postgresq c.logger.Debugf("watch only clusters with controllerID %q", c.controllerID) } for _, pg := range list.Items { - if pg.Error != "" { - continue + if pg.Error == "" && c.hasOwnership(&pg) { + pgList.Items = append(pgList.Items, pg) } - if !c.hasOwnership(&pg) { - continue - } - pgList.Items = append(pgList.Items, pg) } return &pgList, err