Skip to content

Commit ea3bfdb

Browse files
committed
Fix labelSelector for podAntiAffinity rule
right now the pod template specifies these labels and affinity labelSelector. ~~~ template: metadata: creationTimestamp: null labels: app: galera cr: galera-openstack-cell1 galera/name: openstack-cell1 galera/namespace: openstack galera/uid: a14e79ce-ef87-41eb-9e05-ddbaeccb82af owner: mariadb-operator spec: affinity: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: - podAffinityTerm: labelSelector: matchExpressions: - key: service operator: In values: - openstack-cell1-galera topologyKey: kubernetes.io/hostname weight: 1 ~~~ Which means that the podAntiAffinity would never bump the weight for the galera pods. This adds a label with the common service selector. Related: https://issues.redhat.com/browse/OSPRH-8870 Signed-off-by: Martin Schuppert <[email protected]>
1 parent 8b86dae commit ea3bfdb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pkg/mariadb/utils.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package mariadb
22

33
import (
4+
common "github.com/openstack-k8s-operators/lib-common/modules/common"
45
labels "github.com/openstack-k8s-operators/lib-common/modules/common/labels"
56
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
67
)
@@ -31,9 +32,10 @@ func LabelSelectors(database metav1.Object, dbType string) map[string]string {
3132
func StatefulSetLabels(database metav1.Object) map[string]string {
3233
name := database.GetName()
3334
return labels.GetLabels(database, "galera", map[string]string{
34-
"owner": "mariadb-operator",
35-
"app": "galera",
36-
"cr": "galera-" + name,
35+
"owner": "mariadb-operator",
36+
"app": "galera",
37+
"cr": "galera-" + name,
38+
common.AppSelector: StatefulSetName(name),
3739
})
3840
}
3941

0 commit comments

Comments
 (0)