# ProxySQL service annotations not getting applied to proxysql service using operator

**URL:** <https://forums.percona.com/t/proxysql-service-annotations-not-getting-applied-to-proxysql-service-using-operator/9533>\
**Category:** Percona Operator for MySQL\
**Tags:** percona\
**Created:** [March 4, 2021, 12:36am UTC](https://forums.percona.com/t/proxysql-service-annotations-not-getting-applied-to-proxysql-service-using-operator/9533 "2021-03-04T00:36:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lreyes](https://avatars.discourse-cdn.com/v4/letter/l/5e9695/32.png) [@lreyes](https://forums.percona.com/u/lreyes)\
**Post date:** [March 4, 2021, 12:36am UTC](https://forums.percona.com/t/proxysql-service-annotations-not-getting-applied-to-proxysql-service-using-operator/9533/1 "2021-03-04T00:36:56Z")

</div>

I am trying to configure the ProxySQL service in Kubernetes in Google cloud to setup a a load balancer with an Internal IP address. However, in order for Google to use an internal IP, I need to add an annotation to the ProxySQL service.

I tried modifying cr.yaml with the following:

```
  proxysql:
    enabled: true
    size: 3
    image: percona/percona-xtradb-cluster-operator:1.7.0-proxysql
    imagePullPolicy: Always
  ...
    annotations:
      cloud.google.com/load-balancer-type: Internal
    loadBalancerSourceRanges:
      - 10.0.0.0/8

```

I applied the configuration using:

```
bash$ kubectl -f cr.yaml

```

And verify with the command:

```
bash$ kubectl describe service cluster1-proxysql

```

And I don’t see the annotation:

```
Name: cluster1-proxysql
Namespace: default
Labels: app.kubernetes.io/instance=cluster1
                      app.kubernetes.io/name=percona-xtradb-cluster
Selector: app.kubernetes.io/component=proxysql,app.kubernetes.io/instance=cluster1,app.kubernetes.io/name=percona-xtradb-cluster

```

I can only see the annotation after editing the service manually.

```
Name: cluster1-proxysql
Namespace: rldb-replica
Labels: app.kubernetes.io/instance=cluster1
                      app.kubernetes.io/name=percona-xtradb-cluster
Annotations: cloud.google.com/load-balancer-type: Internal
Selector: app.kubernetes.io/component=proxysql,app.kubernetes.io/instance=cluster1,app.kubernetes.io/name=percona-xtradb-cluster

```

The parameter **loadBalancerSourceRanges** did not get applied either.

I tried searching the forum and the bug list but did not find anything related to this. Has anybody encountered this issue or know if this is a bug?

I also tried to use **serviceAnnotations** but got the same result.

I also saw this [commit](https://github.com/percona/percona-xtradb-cluster-operator/pull/535/commits/9b91d1a2a9a6ba27756c9f20dfcf532deeda43e1) to fix the annotation for the pods but did not find one for the service. Is it possible that this also needs to be fixed in the service deployments?

In addition to the above, is there a way to set a **static** IP address by setting the **loadBalancerIP** so that the IP will not change if I modify the service? I did not find it in the [documentation](https://www.percona.com/doc/kubernetes-operator-for-pxc/operator.html).

---

<div class="post-metadata">

**Author:** ![Sergey\_Pronin](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/sergey_pronin/32/14887_2.png) [@Sergey\_Pronin](https://forums.percona.com/u/Sergey_Pronin)\
**Post date:** [March 4, 2021, 8:50am UTC](https://forums.percona.com/t/proxysql-service-annotations-not-getting-applied-to-proxysql-service-using-operator/9533/2 "2021-03-04T08:50:33Z")

</div>

Hello @lreyes ,

thank you for submitting this.

The flag you are looking for is **serviceAnnotations**. It will work if you create the cluster from scratch and have this annotation in the cr.yaml.

But unfortunately we have a bug, which is described here: [[K8SPXC-614] serviceAnnotations is not applied on cr.yaml change - Percona JIRA](https://jira.percona.com/browse/K8SPXC-614)

This bug is exactly about not being able to change the annotation for the Service object on Kubernetes through cr.yaml for already running cluster. It will be fixed in the next Operator release.

---

<div class="post-metadata">

**Author:** ![lreyes](https://avatars.discourse-cdn.com/v4/letter/l/5e9695/32.png) [@lreyes](https://forums.percona.com/u/lreyes)\
**Post date:** [March 4, 2021, 5:24pm UTC](https://forums.percona.com/t/proxysql-service-annotations-not-getting-applied-to-proxysql-service-using-operator/9533/3 "2021-03-04T17:24:19Z")

</div>

Thank for the information @Sergey_Pronin .

Can you also confirm if it’s the same case with setting the **loadBalancerSourceRanges** and **loadBalancerIP**?

---

<div class="post-metadata">

**Author:** ![Sergey\_Pronin](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/sergey_pronin/32/14887_2.png) [@Sergey\_Pronin](https://forums.percona.com/u/Sergey_Pronin)\
**Post date:** [March 4, 2021, 8:58pm UTC](https://forums.percona.com/t/proxysql-service-annotations-not-getting-applied-to-proxysql-service-using-operator/9533/4 "2021-03-04T20:58:12Z")

</div>

Yes, @lreyes, I can confirm. It also affects both **loadBalancerSourceRanges** and **loadBalancerIP**.  
Both parametrs can be set on the start of the cluster, but you can’t change or add them after the cluster is up and running.

I have updated the case in JIRA with this info. Thank you for catching it.
