Prevent original labels from update

This commit is contained in:
Dmitrii Dolgov
2020-03-05 14:36:13 +01:00
parent f1646c8204
commit e645ca5c23
2 changed files with 31 additions and 19 deletions
+7 -7
View File
@@ -420,18 +420,18 @@ func (c *Cluster) labelsSelector() *metav1.LabelSelector {
// 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{
connPoolLabels := labels.Set(map[string]string{})
extraLabels := labels.Set(map[string]string{
"connection-pool": c.connPoolName(),
"application": "connection-pool",
}
})
for k, v := range connPoolLabels {
labels[k] = v
}
connPoolLabels = labels.Merge(connPoolLabels, c.labelsSet(false))
connPoolLabels = labels.Merge(connPoolLabels, extraLabels)
return &metav1.LabelSelector{
MatchLabels: labels,
MatchLabels: connPoolLabels,
MatchExpressions: nil,
}
}