using zlando postgres operator how to add custom labels and annotations to postgresql pod in kubernetes environment

225 Views Asked by At

In our kubernetes environment we deployed zlando postgres operator using helm chart and also deployed two postgres databases in two different namespaces. They are working fine without any issues.

Now we got a requirement to add custom labels and annotations to postgresql pod not for the operator. additional labels and annotations i'm trying to add are below ones.

kind: "postgresql"
apiVersion: "acid.zalan.do/v1"
metadata:
  name: "postgres-service1"
  annotations:
    ad.datadoghq.com/postgres.check_names: '["postgres"]'
    ad.datadoghq.com/postgres.init_configs: '[{}]'
    ad.datadoghq.com/postgres.instances: |
      [
        {
          "host": "%%host%%",
          "port": "5432",
          "password": "%%env_DATADOG_PASSWORD%%",
          "username": "datadog",
          "dbname": "service1"
        }
      ]
    ad.datadoghq.com/postgres.logs: |
      [
        {
          "source": "postgresql",
          "log_processing_rules": [{
            "type": "multi_line",
            "name": "log_start_with_date",
            "pattern": "\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}\\.\\d+ "
          }]
        }
      ]

  labels:
    tags.datadoghq.com/env: development
    tags.datadoghq.com/service: postgres-service1
    tags.datadoghq.com/version: "14"

the above example is for one service and we have another database for another service.

in the zalndo postgres-operator values.yaml file what values do i need to add so that the above labels and annotations will be added to postgresql pod?

in operator values.yaml file

labels - https://github.com/zalando/postgres-operator/blob/master/charts/postgres-operator/values.yaml#L104

annotations - https://github.com/zalando/postgres-operator/blob/master/charts/postgres-operator/values.yaml#L109

Also for each postgresql labels and annotations key can be same but the values will differ.

can you please let me know how to achieve this?

Thank you

0

There are 0 best solutions below