Files
Vitaliy ChefanovandClaude Opus 5.5 1df5d3559a v0.7.1: render alert rules on DKP without operator-prometheus-crd
helm_lib_prometheus_rules only renders when "operator-prometheus-crd" is
an enabled module; on DKP 1.76 that module doesn't exist (the CRDs come
with operator-prometheus), so the two alerts were silently dropped on a
live install. Gate on the PrometheusRule API instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-23 21:47:20 +03:00

37 lines
1.3 KiB
YAML

{{- if (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1/PodMonitor") }}
---
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: cluster-map
namespace: d8-cluster-map
{{- include "helm_lib_module_labels" (list . (dict "app" "cluster-map" "prometheus" "main")) | nindent 2 }}
spec:
selector:
matchLabels:
app: cluster-map
podMetricsEndpoints:
- port: metrics
scheme: http
path: /metrics
relabelings:
- regex: endpoint|namespace|pod|service
action: labeldrop
- targetLabel: job
replacement: cluster-map
- sourceLabels: [__meta_kubernetes_pod_node_name]
targetLabel: node
- targetLabel: tier
replacement: cluster
- sourceLabels: [__meta_kubernetes_pod_ready]
regex: "true"
action: keep
{{- end }}
{{- /* helm_lib_prometheus_rules only renders when "operator-prometheus-crd"
is among enabled modules; on DKP 1.76 the CRDs ship with
operator-prometheus and that module name no longer exists, so the
rules were silently dropped. Gate on the API itself instead. */}}
{{- if (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1/PrometheusRule") }}
{{- include "helm_lib_prometheus_rules_recursion" (list . "d8-cluster-map" "monitoring/prometheus-rules") }}
{{- end }}