Bug #109866 no effect On InnoDBCluster K8s Spec for podAnnotations & podLabels
Submitted: 1 Feb 2023 0:45 Modified: 2 Feb 2023 11:57
Reporter: Raouf HADDADA Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Operator Severity:S3 (Non-critical)
Version:8.0.32-2.0.8 OS:Any
Assigned to: CPU Architecture:Any

[1 Feb 2023 0:45] Raouf HADDADA
Description:
There is no effect at all when adding podAnnotations & podLabels To InnoDB Cluster Spec

even when creating cluster from scratch

Respecting documentation

https://dev.mysql.com/doc/mysql-operator/en/mysql-operator-properties.html#mysql-operator-...

How to repeat:
There is no effect at all when adding podAnnotations & podLabels To InnoDB Cluster Spec

even when creating cluster from scratch

Respecting documentation

https://dev.mysql.com/doc/mysql-operator/en/mysql-operator-properties.html#mysql-operator-...
[2 Feb 2023 11:57] MySQL Verification Team
Hi

Thank you for the report.
[8 Feb 2023 13:20] Andrey Hristov
Posted by developer:
 
Hi,
I cannot reproduce it using the documentation.

What I did
kubectl apply -f https://raw.githubusercontent.com/mysql/mysql-operator/trunk/deploy/deploy-crds.yaml
kubectl apply -f https://raw.githubusercontent.com/mysql/mysql-operator/trunk/deploy/deploy-operator.yaml
kubectl create namespace mine
kubectl -n mine create secret generic mypwds \
        --from-literal=rootUser=root \
        --from-literal=rootHost=% \
        --from-literal=rootPassword="sakila"

I apply the following manifest:
apiVersion: mysql.oracle.com/v2
kind: InnoDBCluster
metadata:
  name: mycluster
spec:
  secretName: mypwds
  tlsUseSelfSigned: true
  instances: 3

  podLabels: 
    server.example.com/iclabel1: iclabel1-value
    server.example.com/iclabel2: iclabel2-value
  podAnnotations: 
    server.example.com/icannot1: icannot1-value
    server.example.com/icannot2: icannot2-value

  router:
    instances: 1
    podLabels: 
      router.example.com/iclabel1: rtr-iclabel1-value
      router.example.com/iclabel2: rtr-iclabel2-value  
    podAnnotations: 
      router.example.com/icannot1: rtr-icannot1-value
      router.example.com/icannot2: rtr-icannot2-value
---

The cluster is created and after that I query the server and router pods:
k8s@box:~$ kubectl -n mine get pod mycluster-0 -o json  | jq ".metadata.labels"
{
  ...
  "server.example.com/iclabel1": "iclabel1-value",
  "server.example.com/iclabel2": "iclabel2-value",
  "statefulset.kubernetes.io/pod-name": "mycluster-0",
   ...
}

k8s@box:~$ kubectl -n mine get pod mycluster-0 -o json  | jq ".metadata.annotations"
{
  ....
  "server.example.com/icannot1": "icannot1-value",
  "server.example.com/icannot2": "icannot2-value"
}

k8s@box:~$ kubectl -n mine get pod mycluster-router-569cbbdc89-2hlcn -o json  | jq ".metadata.annotations"
{
  "router.example.com/icannot1": "rtr-icannot1-value",
  "router.example.com/icannot2": "rtr-icannot2-value"
}

k8s@box:~$ kubectl -n mine get pod mycluster-router-569cbbdc89-2hlcn -o json  | jq ".metadata.labels"
{
  ...
  "router.example.com/iclabel1": "rtr-iclabel1-value",
  "router.example.com/iclabel2": "rtr-iclabel2-value",
  ...
}