From 92da5524c80d185bbfb80226a6f603ba534492db Mon Sep 17 00:00:00 2001 From: Daniel Fan Date: Thu, 21 Nov 2024 11:52:48 -0800 Subject: [PATCH] Add nodeAffinity for Postgres operator, and add new entry cloud-native-postgresql-v1.22 Signed-off-by: Daniel Fan --- controllers/constant/odlm_operatorconfig.go | 76 +++++++++++++++++++++ controllers/operatorconfig.go | 2 +- 2 files changed, 77 insertions(+), 1 deletion(-) diff --git a/controllers/constant/odlm_operatorconfig.go b/controllers/constant/odlm_operatorconfig.go index 86e7a16e8..f4ad73325 100644 --- a/controllers/constant/odlm_operatorconfig.go +++ b/controllers/constant/odlm_operatorconfig.go @@ -32,6 +32,16 @@ spec: - name: edb-keycloak replicas: placeholder-size affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/arch + operator: In + values: + - amd64 + - ppc64le + - s390x podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: - weight: 90 @@ -68,6 +78,16 @@ spec: - name: cloud-native-postgresql replicas: placeholder-size affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/arch + operator: In + values: + - amd64 + - ppc64le + - s390x podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: - weight: 90 @@ -104,6 +124,62 @@ spec: - name: common-service-postgresql replicas: placeholder-size affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/arch + operator: In + values: + - amd64 + - ppc64le + - s390x + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 90 + podAffinityTerm: + topologyKey: topology.kubernetes.io/zone + labelSelector: + matchExpressions: + - key: app.kubernetes.io/name + operator: In + values: + - cloud-native-postgresql + - weight: 50 + podAffinityTerm: + topologyKey: kubernetes.io/hostname + labelSelector: + matchExpressions: + - key: app.kubernetes.io/name + operator: In + values: + - cloud-native-postgresql + topologySpreadConstraints: + - maxSkew: 1 + topologyKey: topology.kubernetes.io/zone + whenUnsatisfiable: ScheduleAnyway + labelSelector: + matchLabels: + app.kubernetes.io/name: cloud-native-postgresql + - maxSkew: 1 + topologyKey: topology.kubernetes.io/region + whenUnsatisfiable: ScheduleAnyway + labelSelector: + matchLabels: + app.kubernetes.io/name: cloud-native-postgresql + - name: cloud-native-postgresql-v1.22 + replicas: placeholder-size + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/arch + operator: In + values: + - amd64 + - ppc64le + - s390x podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: - weight: 90 diff --git a/controllers/operatorconfig.go b/controllers/operatorconfig.go index 05b464cab..51fbebf2a 100644 --- a/controllers/operatorconfig.go +++ b/controllers/operatorconfig.go @@ -59,7 +59,7 @@ func (r *CommonServiceReconciler) updateOperatorConfig(ctx context.Context, conf Namespace: r.Bootstrap.CSData.ServicesNs, }, operatorConfig); err != nil { if !apierrors.IsNotFound(err) { - klog.Errorf("failed to get OperandConfig %s/%s: %v", operatorConfig.GetNamespace(), operatorConfig.GetName(), err) + klog.Errorf("failed to get OperatorConfig %s/%s: %v", operatorConfig.GetNamespace(), operatorConfig.GetName(), err) return true, err } }