32 lines
1.4 KiB
YAML
32 lines
1.4 KiB
YAML
|
|
# Prometheus scrape config for the Forgejo Postgres cluster (CNPG).
|
||
|
|
#
|
||
|
|
# Hand-written on purpose. CNPG's `spec.monitoring.enablePodMonitor: true` still
|
||
|
|
# works on operator 1.30 but is deprecated upstream (CloudNativePG 1.27 release
|
||
|
|
# notes: "we strongly recommend you remove or set enablePodMonitor to false and
|
||
|
|
# manually create a PodMonitor"), because the operator-owned PodMonitor gives no
|
||
|
|
# control over labels — and labels are exactly what this stack needs:
|
||
|
|
# Prometheus here keeps the chart defaults
|
||
|
|
# (`podMonitorSelectorNilUsesHelmValues: true`), so it only honours PodMonitors
|
||
|
|
# carrying `release: kube-prometheus-stack`. The Cilium ServiceMonitors in
|
||
|
|
# kube-system land for the same reason. Owning the PodMonitor in git makes that
|
||
|
|
# selector contract explicit instead of depending on what the operator decides
|
||
|
|
# to stamp on the object.
|
||
|
|
#
|
||
|
|
# One PodMonitor per cluster, in the cluster's own namespace: the PodMonitor
|
||
|
|
# namespaceSelector is empty on the Prometheus CRD, so any namespace is honoured.
|
||
|
|
apiVersion: monitoring.coreos.com/v1
|
||
|
|
kind: PodMonitor
|
||
|
|
metadata:
|
||
|
|
name: cnpg-pg
|
||
|
|
namespace: forgejo
|
||
|
|
labels:
|
||
|
|
release: kube-prometheus-stack
|
||
|
|
spec:
|
||
|
|
selector:
|
||
|
|
matchLabels:
|
||
|
|
cnpg.io/cluster: pg
|
||
|
|
podMetricsEndpoints:
|
||
|
|
- port: metrics
|
||
|
|
interval: 30s
|
||
|
|
# The instance manager serves /metrics on 9187 for the primary; replicas
|
||
|
|
# serve it too, so a future `instances: 2` needs no change here.
|