Skip to content

fix(kopiur): use upstream PrometheusRules - #4177

Merged
Tanguille merged 1 commit into
mainfrom
fix/kopiur-upstream-alerts
Jul 25, 2026
Merged

fix(kopiur): use upstream PrometheusRules#4177
Tanguille merged 1 commit into
mainfrom
fix/kopiur-upstream-alerts

Conversation

@Tanguille

@Tanguille Tanguille commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • enable Kopiur chart-provided PrometheusRules
  • remove the repository-owned duplicate alert rules
  • remove the deleted rule from the Kustomization

This lets the upgraded Kopiur chart provide its recovery-aware snapshot alert behavior.

Summary by CodeRabbit

  • New Features

    • Enabled Prometheus monitoring rule resources for Kopiur.
    • Kopiur monitoring and alerting are now managed through the application chart.
  • Bug Fixes

    • Consolidated monitoring configuration to prevent duplicate or conflicting alert definitions.
    • Preserved the surrounding Prometheus configuration while simplifying deployment-managed alerting.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7a94a008-0690-49c6-b491-1473958f646e

📥 Commits

Reviewing files that changed from the base of the PR and between 6538c1e and 5d9c606.

📒 Files selected for processing (3)
  • kubernetes/apps/kopiur-system/kopiur/app/helmrelease.yaml
  • kubernetes/apps/kopiur-system/kopiur/app/kustomization.yaml
  • kubernetes/apps/kopiur-system/kopiur/app/prometheusrule.yaml
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • Tanguille/LLMKube (auto-detected)
💤 Files with no reviewable changes (2)
  • kubernetes/apps/kopiur-system/kopiur/app/prometheusrule.yaml
  • kubernetes/apps/kopiur-system/kopiur/app/kustomization.yaml

📝 Walkthrough

Walkthrough

Kopiur monitoring switches PrometheusRule generation on in the HelmRelease and removes the separately maintained PrometheusRule manifest from the kustomization resources.

Changes

PrometheusRule ownership update

Layer / File(s) Summary
Enable chart-managed PrometheusRule
kubernetes/apps/kopiur-system/kopiur/app/helmrelease.yaml, kubernetes/apps/kopiur-system/kopiur/app/kustomization.yaml, kubernetes/apps/kopiur-system/kopiur/app/prometheusrule.yaml
The HelmRelease enables chart-provided PrometheusRule resources, while the kustomization no longer includes the standalone alert manifest, which is removed.

Estimated code review effort: 2 (Simple) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: switching Kopiur to use the chart's upstream PrometheusRules instead of the repo-owned rule file.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/kopiur-upstream-alerts

Comment @coderabbitai help to get the list of available commands.

@tanguille-cluster

Copy link
Copy Markdown
@@ spec.values.monitoring.prometheusRule.enabled @@
# helm.toolkit.fluxcd.io/v2/HelmRelease/kopiur-system/kopiur
! ± value change
- false
+ true

@@ (root level) @@
# monitoring.coreos.com/v1/PrometheusRule/kopiur-system/kopiur-controller
! - one document removed:
- apiVersion: monitoring.coreos.com/v1
- kind: PrometheusRule
- metadata:
-   name: kopiur-controller
-   namespace: kopiur-system
-   labels:
-     kustomize.toolkit.fluxcd.io/name: kopiur
-     kustomize.toolkit.fluxcd.io/namespace: kopiur-system
- spec:
-   groups:
-   - name: kopiur.rules
-     rules:
-     - alert: KopiurBackupConsecutiveFailures
-       annotations:
-         description: "{{ $value }} consecutive backup failures (>=3) for SnapshotPolicy {{ $labels.namespace }}/{{ $labels.name }}."
-         summary: "Backups for {{ $labels.namespace }}/{{ $labels.name }} are failing"
-       expr: "kopiur_snapshot_consecutive_failures >= 3"
-       for: 15m
-       labels:
-         severity: warning
-     - alert: KopiurBackupStale
-       annotations:
-         description: "Either the last successful backup was over 24h ago, or SnapshotPolicy {{ $labels.namespace }}/{{ $labels.policy }} has never succeeded (or its Succeeded Snapshot CRs were all deleted) and is currently failing."
-         summary: "No recent successful backup for {{ $labels.namespace }}/{{ $labels.policy }}"
-       expr: |
-         (
-         
-           time() - kopiur_policy_last_backup_success_timestamp_seconds > 86400
-         ) or (
-         
-           label_replace(kopiur_snapshot_consecutive_failures, "policy", "$1", "name", "(.*)") > 0
-           unless on (namespace, policy) kopiur_policy_last_backup_success_timestamp_seconds
-         )
-       for: 30m
-       labels:
-         severity: warning
-     - alert: KopiurRepositoryNotReady
-       annotations:
-         description: "A kopiur repository has been Degraded/Failed for 15m; backups to it will not run."
-         summary: "Repository {{ $labels.namespace }}/{{ $labels.name }} is {{ $labels.phase }}"
-       expr: "max by (namespace, name) (kopiur_resource_phase{kind=~\"Repository|ClusterRepository\", phase=~\"Degraded|Failed\"}) == 1"
-       for: 15m
-       labels:
-         severity: critical
-     - alert: KopiurSnapshotFailed
-       annotations:
-         description: "SnapshotPolicy {{ $labels.exported_namespace }}/{{ $labels.policy }} has a Snapshot CR in phase=Failed for 10m."
-         summary: "Snapshots for {{ $labels.exported_namespace }}/{{ $labels.policy }} are failing"
-       expr: "max by (exported_namespace, policy) (kopiur_resource_phase{kind=\"Snapshot\", phase=\"Failed\"}) == 1"
-       for: 10m
-       labels:
-         severity: warning
-     - alert: KopiurRestoreFailed
-       annotations:
-         description: "A Restore CR has been in phase=Failed for 10m."
-         summary: "Restore {{ $labels.namespace }}/{{ $labels.name }} failed"
-       expr: "max by (namespace, name) (kopiur_resource_phase{kind=\"Restore\", phase=\"Failed\"}) == 1"
-       for: 10m
-       labels:
-         severity: warning
-     - alert: KopiurReconcileErrorsHigh
-       annotations:
-         description: "kopiur controller is erroring on {{ $labels.kind }} reconciles (>0.2/s over 10m)."
-         summary: "High reconcile error rate for {{ $labels.kind }}"
-       expr: "sum by (kind) (rate(kopiur_controller_reconcile_errors_total[10m])) > 0.2"
-       for: 15m
-       labels:
-         severity: warning

@tanguille-cluster

Copy link
Copy Markdown
@@ (root level) @@
# monitoring.coreos.com/v1/PrometheusRule/kopiur-system/kopiur-controller
! + one document added:
+ apiVersion: monitoring.coreos.com/v1
+ kind: PrometheusRule
+ metadata:
+   name: kopiur-controller
+   namespace: kopiur-system
+   labels:
+     app.kubernetes.io/component: controller
+     app.kubernetes.io/instance: kopiur
+     app.kubernetes.io/managed-by: Helm
+     app.kubernetes.io/name: kopiur
+     app.kubernetes.io/part-of: kopiur
+     helm.toolkit.fluxcd.io/name: kopiur
+     helm.toolkit.fluxcd.io/namespace: kopiur-system
+ spec:
+   groups:
+   - name: kopiur.rules
+     rules:
+     - alert: KopiurBackupConsecutiveFailures
+       annotations:
+         description: "{{ $value }} consecutive backup failures (>=3) for SnapshotPolicy {{ $labels.namespace }}/{{ $labels.name }}."
+         summary: "Backups for {{ $labels.namespace }}/{{ $labels.name }} are failing"
+       expr: "kopiur_snapshot_consecutive_failures >= 3"
+       for: 15m
+       labels:
+         severity: warning
+     - alert: KopiurBackupStale
+       annotations:
+         description: "Either the last successful backup was over 48h ago, or SnapshotPolicy {{ $labels.namespace }}/{{ $labels.policy }} has never succeeded (or its Succeeded Snapshot CRs were all deleted) and is currently failing."
+         summary: "No recent successful backup for {{ $labels.namespace }}/{{ $labels.policy }}"
+       expr: |
+         (
+           time() - kopiur_policy_last_backup_success_timestamp_seconds > 172800
+         ) or (
+           label_replace(kopiur_snapshot_consecutive_failures, "policy", "$1", "name", "(.*)") > 0
+           unless on (namespace, policy) kopiur_policy_last_backup_success_timestamp_seconds
+         )
+       for: 30m
+       labels:
+         severity: warning
+     - alert: KopiurLastBackupFailed
+       annotations:
+         description: "The most recent completed backup for SnapshotPolicy {{ $labels.namespace }}/{{ $labels.policy }} failed. Resolves automatically once a newer backup succeeds."
+         summary: "Latest backup for {{ $labels.namespace }}/{{ $labels.policy }} failed"
+       expr: "min by (namespace, policy) (kopiur_snapshotpolicy_last_backup_success) == 0"
+       for: 10m
+       labels:
+         severity: warning
+     - alert: KopiurRepositoryNotReady
+       annotations:
+         description: "A kopiur repository has been Degraded/Failed for 15m; backups to it will not run."
+         summary: "Repository {{ $labels.namespace }}/{{ $labels.name }} is {{ $labels.phase }}"
+       expr: "max by (namespace, name) (kopiur_resource_phase{kind=~\"Repository|ClusterRepository\", phase=~\"Degraded|Failed\"}) == 1"
+       for: 15m
+       labels:
+         severity: critical
+     - alert: KopiurSnapshotFailed
+       annotations:
+         description: "Snapshot {{ $labels.namespace }}/{{ $labels.name }} is Failed and its policy has not completed a newer successful backup."
+         summary: "Snapshot {{ $labels.namespace }}/{{ $labels.name }} failed"
+       expr: "max by (namespace, name, policy) (kopiur_resource_phase{kind=\"Snapshot\", phase=\"Failed\"}) == 1 unless on (namespace, policy) (min by (namespace, policy) (kopiur_snapshotpolicy_last_backup_success) == 1)"
+       for: 10m
+       labels:
+         severity: warning
+     - alert: KopiurRestoreFailed
+       annotations:
+         description: "A Restore CR has been in phase=Failed for 10m."
+         summary: "Restore {{ $labels.namespace }}/{{ $labels.name }} failed"
+       expr: "max by (namespace, name) (kopiur_resource_phase{kind=\"Restore\", phase=\"Failed\"}) == 1"
+       for: 10m
+       labels:
+         severity: warning
+     - alert: KopiurReconcileErrorsHigh
+       annotations:
+         description: "kopiur controller is erroring on {{ $labels.kind }} reconciles (>0.2/s over 10m)."
+         summary: "High reconcile error rate for {{ $labels.kind }}"
+       expr: "sum by (kind) (rate(kopiur_controller_reconcile_errors_total[10m])) > 0.2"
+       for: 15m
+       labels:
+         severity: warning

@Tanguille
Tanguille merged commit 3166668 into main Jul 25, 2026
17 of 18 checks passed
@Tanguille
Tanguille deleted the fix/kopiur-upstream-alerts branch July 25, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant