From 07adaf28cc8f570fa6e1a76d9602c455b766a028 Mon Sep 17 00:00:00 2001 From: Dmitrii Dolgov <9erthalion6@gmail.com> Date: Thu, 5 Mar 2020 10:32:20 +0100 Subject: [PATCH] Extend labels for connection pool --- pkg/cluster/util.go | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/pkg/cluster/util.go b/pkg/cluster/util.go index 269e94b17..2f10a1868 100644 --- a/pkg/cluster/util.go +++ b/pkg/cluster/util.go @@ -414,11 +414,24 @@ func (c *Cluster) labelsSelector() *metav1.LabelSelector { } } +// Return connection pool labels selector, which should from one point of view +// inherit most of the labels from the cluster itself, but at the same time +// have e.g. different `application` label, so that recreatePod operation will +// not interfere with it (it lists all the pods via labels, and if there would +// be no difference, it will recreate also pooler pods). func (c *Cluster) connPoolLabelsSelector() *metav1.LabelSelector { + labels := c.labelsSet(false) + connPoolLabels := map[string]string{ + "connection-pool": c.connPoolName(), + "application": "connection-pool", + } + + for k, v := range connPoolLabels { + labels[k] = v + } + return &metav1.LabelSelector{ - MatchLabels: map[string]string{ - "connection-pool": c.connPoolName(), - }, + MatchLabels: labels, MatchExpressions: nil, } }