I’m using the Percona Operator for MySQL based on Percona XtraDB Cluster and I expose the haproxy using the cluster resource.
I am able to set up the service fine with the following configuration:
haproxy:
serviceType: LoadBalancer
replicasServiceType: LoadBalancer
serviceAnnotations:
# primeiras duas annotations são tentativa de consertar bug quando source range é modificado
# e controlador não permite porque recebe loadBalancerClass null
service.beta.kubernetes.io/aws-load-balancer-scheme: internet-facing
replicasServiceAnnotations:
service.beta.kubernetes.io/aws-load-balancer-scheme: internet-facing
loadBalancerSourceRanges:
- 190.0.0.0/8
- 189.0.0.0/8
- 187.0.0.0/8
- 186.0.0.0/8
- 10.0.0.0/8
- 200.234.208.6/32
replicasLoadBalancerSourceRanges:
- 190.0.0.0/8
- 189.0.0.0/8
- 187.0.0.0/8
- 186.0.0.0/8
- 10.0.0.0/8
- 200.234.208.6/32
externalTrafficPolicy: Local # para preservar Source IP e não causar drop na Network Policy
replicasExternalTrafficPolicy: Local
This works fine at first install. However, if I later try to modify the service, for example altering the loadBalancerSourceRanges, the pxc operator logs the error: "error": "cluster4-haproxy upgrade error: Service \"cluster4-haproxy\" is invalid: spec.loadBalancerClass: Invalid value: \"null\": may not change once set"
Any way to work around this issue? I noticed that I can delete the Service and it eventually gets recreated, but I would like a solution that works without needing the extra step.