Skip to content

Commit 4bf46cd

Browse files
feat(monitoring): add support for additional labels in PodMonitor configuration
Signed-off-by: Nelson Alfonso <[email protected]>
1 parent 37ff723 commit 4bf46cd

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

charts/cluster/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ refer to the [CloudNativePG Documentation](https://cloudnative-pg.io/documentat
169169
| cluster.monitoring.disableDefaultQueries | bool | `false` | Whether the default queries should be injected. Set it to true if you don't want to inject default queries into the cluster. |
170170
| cluster.monitoring.enabled | bool | `false` | Whether to enable monitoring |
171171
| cluster.monitoring.podMonitor.enabled | bool | `true` | Whether to enable the PodMonitor |
172+
| cluster.monitoring.podMonitor.labels | object | `{}` | Additional labels to set on the generated PodMonitor resource. Add labels your monitoring stack requires (for example `team-name`). |
172173
| cluster.monitoring.podMonitor.metricRelabelings | list | `[]` | The list of metric relabelings for the PodMonitor. Applied to samples before ingestion. |
173174
| cluster.monitoring.podMonitor.relabelings | list | `[]` | The list of relabelings for the PodMonitor. Applied to samples before scraping. |
174175
| cluster.monitoring.prometheusRule.enabled | bool | `true` | Whether to enable the PrometheusRule automated alerts |

charts/cluster/examples/pgbouncer.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ cluster:
77
enabled: true
88
podMonitor:
99
enabled: true
10+
# labels:
11+
# team-name: my-team
1012

1113
backups:
1214
enabled: false

charts/cluster/test/monitoring/01-monitoring_cluster-assert.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ apiVersion: monitoring.coreos.com/v1
3636
kind: PodMonitor
3737
metadata:
3838
name: monitoring-cluster
39+
labels:
40+
team-name: test-team
41+
environment: test
3942
spec:
4043
selector:
4144
matchLabels:

charts/cluster/test/monitoring/01-monitoring_cluster.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ cluster:
2121
usage: GAUGE
2222
description: "Cache hit ratio"
2323
podMonitor:
24+
labels:
25+
team-name: test-team
26+
environment: test
2427
relabelings:
2528
- targetLabel: environment
2629
replacement: test

0 commit comments

Comments
 (0)