# Cannot update haproxy service parameters

**URL:** <https://forums.percona.com/t/cannot-update-haproxy-service-parameters/26841>\
**Category:** Percona Operator for MySQL\
**Created:** [November 28, 2023, 5:57pm UTC](https://forums.percona.com/t/cannot-update-haproxy-service-parameters/26841 "2023-11-28T17:57:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gmautner](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@gmautner](https://forums.percona.com/u/gmautner)\
**Post date:** [November 28, 2023, 5:57pm UTC](https://forums.percona.com/t/cannot-update-haproxy-service-parameters/26841/1 "2023-11-28T17:57:01Z")

</div>

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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![Agustin\_G](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/agustin_g/32/14111_2.png) [@Agustin\_G](https://forums.percona.com/u/Agustin_G)\
**Post date:** [December 7, 2023, 2:36am UTC](https://forums.percona.com/t/cannot-update-haproxy-service-parameters/26841/2 "2023-12-07T02:36:44Z")

</div>

Hi @gmautner,

Did you check what `spec.loadBalancerClass` value was assigned to it after you first created it? You could add that to your yaml, with the same value, and see if that helps clear out these errors.
