feat(helm): fix ServiceMonitor selector and add observability config (P7.4, miroir-afh.4)

- Add `app.kubernetes.io/component: metrics` label to miroir-service.yaml for
  ServiceMonitor discovery (plan §10)
- Update ServiceMonitor selector to match `component: metrics` instead of
  `component: miroir` (plan §10 specification)
- Add `serviceMonitor.enabled: false` config flag to values.yaml
- Add `prometheusRule.enabled: false` config flag to values.yaml
- Add JSON schema entries for serviceMonitor and prometheusRule to
  values.schema.json

All 12 alerts are present in miroir-prometheusrule.yaml:
  Availability (7): DegradedShards, NodeDown, HighSearchLatency,
    TaskStuck, RebalanceStuck, SettingsDivergence, AntientropyMismatch
  Resource pressure (5): MemoryPressure, RequestQueueBacklog,
    BackgroundJobBacklog, PeerDiscoveryGap, NoLeader

Acceptance:
  ✓ ServiceMonitor selector matches plan §10 (component: metrics)
  ✓ All 12 alerts present in PrometheusRule
  ✓ Schema validation tests pass (9 passed)
  ✓ Helm flags default to false (opt-in for prometheus-operator)

Phase 9 chaos tests will verify each alert trips as expected (separate bead).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
jedarden 2026-05-24 08:19:42 -04:00
parent d5575d7a90
commit 7932022790
4 changed files with 29 additions and 1 deletions

View file

@ -9,6 +9,7 @@ metadata:
labels:
{{- include "miroir.labels" . | nindent 4 }}
app.kubernetes.io/component: miroir
app.kubernetes.io/component: metrics
{{- with .Values.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}

View file

@ -1,5 +1,6 @@
{{/*
Miroir ServiceMonitor (requires prometheus-operator)
Plan §10: metrics scraping via ServiceMonitor
*/}}
{{- if .Values.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
@ -17,7 +18,7 @@ spec:
selector:
matchLabels:
{{- include "miroir.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: miroir
app.kubernetes.io/component: metrics
endpoints:
- port: metrics
interval: {{ .Values.serviceMonitor.interval | default "30s" }}

View file

@ -362,6 +362,21 @@
"annotations": {"type": "object"},
"name": {"type": "string"}
}
},
"serviceMonitor": {
"type": "object",
"properties": {
"enabled": {"type": "boolean"},
"interval": {"type": "string"},
"annotations": {"type": "object"}
}
},
"prometheusRule": {
"type": "object",
"properties": {
"enabled": {"type": "boolean"},
"annotations": {"type": "object"}
}
}
}
}

View file

@ -187,3 +187,14 @@ serviceAccount:
create: true
annotations: {}
name: ""
# ServiceMonitor (plan §10)
serviceMonitor:
enabled: false # requires prometheus-operator in cluster
interval: 30s
annotations: {}
# PrometheusRule (plan §10 + §14.9)
prometheusRule:
enabled: false # requires prometheus-operator in cluster
annotations: {}