From c79b6ad49a499dcc25b8fcaf79dd0bc50ab0e77c Mon Sep 17 00:00:00 2001 From: Natalia Marukovich Date: Tue, 7 Jan 2025 13:04:02 +0100 Subject: [PATCH] K8SPXC-1538 fix loadBalancerSourceRanges for replicas --- pkg/apis/pxc/v1/pxc_types.go | 2 +- pkg/pxc/service.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/apis/pxc/v1/pxc_types.go b/pkg/apis/pxc/v1/pxc_types.go index 160e62b39..5f36b75b5 100644 --- a/pkg/apis/pxc/v1/pxc_types.go +++ b/pkg/apis/pxc/v1/pxc_types.go @@ -550,7 +550,7 @@ type HAProxySpec struct { // Deprecated: Use ExposeReplica.Enabled instead ReplicasServiceEnabled *bool `json:"replicasServiceEnabled,omitempty"` - // Deprecated: Use ExposeReplica.LoadBalancerSourceRanges instead + // Deprecated: Use ExposeReplicas.LoadBalancerSourceRanges instead ReplicasLoadBalancerSourceRanges []string `json:"replicasLoadBalancerSourceRanges,omitempty"` // Deprecated: Use ExposeReplica.LoadBalancerIP instead ReplicasLoadBalancerIP string `json:"replicasLoadBalancerIP,omitempty"` diff --git a/pkg/pxc/service.go b/pkg/pxc/service.go index fbba05b38..89374f605 100644 --- a/pkg/pxc/service.go +++ b/pkg/pxc/service.go @@ -429,7 +429,7 @@ func NewServiceHAProxyReplicas(cr *api.PerconaXtraDBCluster) *corev1.Service { if cr.CompareVersionWith("1.14.0") >= 0 { if cr.Spec.HAProxy.ExposeReplicas.ServiceExpose.LoadBalancerSourceRanges != nil { loadBalancerSourceRanges = cr.Spec.HAProxy.ExposeReplicas.ServiceExpose.LoadBalancerSourceRanges - } else { + } else if cr.Spec.HAProxy.ExposeReplicas.ServiceExpose.LoadBalancerSourceRanges == nil && cr.Spec.HAProxy.ExposeReplicas.Enabled && cr.Spec.HAProxy.ExposeReplicas.Type == corev1.ServiceTypeLoadBalancer { loadBalancerSourceRanges = cr.Spec.HAProxy.ExposePrimary.LoadBalancerSourceRanges } loadBalancerIP = cr.Spec.HAProxy.ExposeReplicas.ServiceExpose.LoadBalancerIP