Extend labels for connection pool

This commit is contained in:
Dmitrii Dolgov 2020-03-05 10:32:20 +01:00
parent a38a5aa574
commit 07adaf28cc
1 changed files with 16 additions and 3 deletions

View File

@ -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,
}
}