From 721ddab85d5bae1effff87af56f50765c32bce4e Mon Sep 17 00:00:00 2001 From: Rizwana777 Date: Wed, 15 May 2024 19:50:07 +0530 Subject: [PATCH 1/2] Add description label to ArgoCDSyncAlert Signed-off-by: Rizwana777 --- controllers/argocd_metrics_controller.go | 3 ++- .../sequential/1-005_validate_metrics/01-assert.yaml | 1 + .../sequential/1-041_validate_argocd_sync_alert/01-assert.yaml | 1 + .../sequential/1-041_validate_argocd_sync_alert/01-assert.yaml | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/controllers/argocd_metrics_controller.go b/controllers/argocd_metrics_controller.go index 5dd156a6d..9d02efa75 100644 --- a/controllers/argocd_metrics_controller.go +++ b/controllers/argocd_metrics_controller.go @@ -529,7 +529,8 @@ func newPrometheusRule(namespace string) *monitoringv1.PrometheusRule { }, For: "5m", Labels: map[string]string{ - "severity": "warning", + "severity": "warning", + "description": "ArgoCDSyncAlert is listed if Argo CD app is out of sync", }, }, }, diff --git a/test/openshift/e2e/ignore-tests/sequential/1-005_validate_metrics/01-assert.yaml b/test/openshift/e2e/ignore-tests/sequential/1-005_validate_metrics/01-assert.yaml index 6ca4b467b..fabcdb4e4 100644 --- a/test/openshift/e2e/ignore-tests/sequential/1-005_validate_metrics/01-assert.yaml +++ b/test/openshift/e2e/ignore-tests/sequential/1-005_validate_metrics/01-assert.yaml @@ -50,3 +50,4 @@ spec: expr: argocd_app_info{namespace="openshift-gitops",sync_status="OutOfSync"} > 0 labels: severity: warning + description: ArgoCDSyncAlert is listed if Argo CD app is out of sync diff --git a/test/openshift/e2e/ignore-tests/sequential/1-041_validate_argocd_sync_alert/01-assert.yaml b/test/openshift/e2e/ignore-tests/sequential/1-041_validate_argocd_sync_alert/01-assert.yaml index cdd2858ee..aaf9b2089 100644 --- a/test/openshift/e2e/ignore-tests/sequential/1-041_validate_argocd_sync_alert/01-assert.yaml +++ b/test/openshift/e2e/ignore-tests/sequential/1-041_validate_argocd_sync_alert/01-assert.yaml @@ -22,3 +22,4 @@ spec: for: 5m labels: severity: warning + description: ArgoCDSyncAlert is listed if Argo CD app is out of sync \ No newline at end of file diff --git a/test/openshift/e2e/sequential/1-041_validate_argocd_sync_alert/01-assert.yaml b/test/openshift/e2e/sequential/1-041_validate_argocd_sync_alert/01-assert.yaml index cdd2858ee..aaf9b2089 100644 --- a/test/openshift/e2e/sequential/1-041_validate_argocd_sync_alert/01-assert.yaml +++ b/test/openshift/e2e/sequential/1-041_validate_argocd_sync_alert/01-assert.yaml @@ -22,3 +22,4 @@ spec: for: 5m labels: severity: warning + description: ArgoCDSyncAlert is listed if Argo CD app is out of sync \ No newline at end of file From 39a30400be523c20d553e3d43269ff00bc882433 Mon Sep 17 00:00:00 2001 From: Rizwana777 Date: Mon, 20 May 2024 12:37:07 +0530 Subject: [PATCH 2/2] Move description to annotations and add summary Signed-off-by: Rizwana777 --- controllers/argocd_metrics_controller.go | 6 +++--- controllers/argocd_metrics_controller_test.go | 3 ++- .../sequential/1-005_validate_metrics/01-assert.yaml | 4 ++-- .../1-041_validate_argocd_sync_alert/01-assert.yaml | 4 ++-- .../1-041_validate_argocd_sync_alert/01-assert.yaml | 6 +++--- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/controllers/argocd_metrics_controller.go b/controllers/argocd_metrics_controller.go index 9d02efa75..ea0c9799b 100644 --- a/controllers/argocd_metrics_controller.go +++ b/controllers/argocd_metrics_controller.go @@ -521,7 +521,8 @@ func newPrometheusRule(namespace string) *monitoringv1.PrometheusRule { { Alert: "ArgoCDSyncAlert", Annotations: map[string]string{ - "message": "ArgoCD application {{ $labels.name }} is out of sync", + "summary": "Argo CD application is out of sync", + "description": "Argo CD application {{ $labels.name }} is out of sync. Check ArgoCDSyncAlert status, this alert is designed to notify that an application managed by Argo CD is out of sync.", }, Expr: intstr.IntOrString{ Type: intstr.String, @@ -529,8 +530,7 @@ func newPrometheusRule(namespace string) *monitoringv1.PrometheusRule { }, For: "5m", Labels: map[string]string{ - "severity": "warning", - "description": "ArgoCDSyncAlert is listed if Argo CD app is out of sync", + "severity": "warning", }, }, }, diff --git a/controllers/argocd_metrics_controller_test.go b/controllers/argocd_metrics_controller_test.go index fe9deee3b..57cee9976 100644 --- a/controllers/argocd_metrics_controller_test.go +++ b/controllers/argocd_metrics_controller_test.go @@ -283,7 +283,8 @@ func TestReconciler_add_prometheus_rule(t *testing.T) { assert.Equal(t, rule.OwnerReferences[0].Name, tc.instanceName) assert.Equal(t, rule.Spec.Groups[0].Rules[0].Alert, "ArgoCDSyncAlert") - assert.Assert(t, rule.Spec.Groups[0].Rules[0].Annotations["message"] != "") + assert.Assert(t, rule.Spec.Groups[0].Rules[0].Annotations["summary"] != "") + assert.Assert(t, rule.Spec.Groups[0].Rules[0].Annotations["description"] != "") assert.Assert(t, rule.Spec.Groups[0].Rules[0].Labels["severity"] != "") assert.Equal(t, rule.Spec.Groups[0].Rules[0].For, "5m") expr := fmt.Sprintf("argocd_app_info{namespace=\"%s\",sync_status=\"OutOfSync\"} > 0", tc.namespace) diff --git a/test/openshift/e2e/ignore-tests/sequential/1-005_validate_metrics/01-assert.yaml b/test/openshift/e2e/ignore-tests/sequential/1-005_validate_metrics/01-assert.yaml index fabcdb4e4..1b0dc4c31 100644 --- a/test/openshift/e2e/ignore-tests/sequential/1-005_validate_metrics/01-assert.yaml +++ b/test/openshift/e2e/ignore-tests/sequential/1-005_validate_metrics/01-assert.yaml @@ -46,8 +46,8 @@ spec: rules: - alert: ArgoCDSyncAlert annotations: - message: ArgoCD application {{ $labels.name }} is out of sync + summary: Argo CD application is out of sync + description: Argo CD application {{ $labels.name }} is out of sync. Check ArgoCDSyncAlert status, this alert is designed to notify that an application managed by Argo CD is out of sync. expr: argocd_app_info{namespace="openshift-gitops",sync_status="OutOfSync"} > 0 labels: severity: warning - description: ArgoCDSyncAlert is listed if Argo CD app is out of sync diff --git a/test/openshift/e2e/ignore-tests/sequential/1-041_validate_argocd_sync_alert/01-assert.yaml b/test/openshift/e2e/ignore-tests/sequential/1-041_validate_argocd_sync_alert/01-assert.yaml index aaf9b2089..2b89033e1 100644 --- a/test/openshift/e2e/ignore-tests/sequential/1-041_validate_argocd_sync_alert/01-assert.yaml +++ b/test/openshift/e2e/ignore-tests/sequential/1-041_validate_argocd_sync_alert/01-assert.yaml @@ -17,9 +17,9 @@ spec: rules: - alert: ArgoCDSyncAlert annotations: - message: ArgoCD application {{ $labels.name }} is out of sync + summary: Argo CD application is out of sync + description: Argo CD application {{ $labels.name }} is out of sync. Check ArgoCDSyncAlert status, this alert is designed to notify that an application managed by Argo CD is out of sync. expr: argocd_app_info{namespace="openshift-gitops",sync_status="OutOfSync"} > 0 for: 5m labels: severity: warning - description: ArgoCDSyncAlert is listed if Argo CD app is out of sync \ No newline at end of file diff --git a/test/openshift/e2e/sequential/1-041_validate_argocd_sync_alert/01-assert.yaml b/test/openshift/e2e/sequential/1-041_validate_argocd_sync_alert/01-assert.yaml index aaf9b2089..0257afc12 100644 --- a/test/openshift/e2e/sequential/1-041_validate_argocd_sync_alert/01-assert.yaml +++ b/test/openshift/e2e/sequential/1-041_validate_argocd_sync_alert/01-assert.yaml @@ -17,9 +17,9 @@ spec: rules: - alert: ArgoCDSyncAlert annotations: - message: ArgoCD application {{ $labels.name }} is out of sync + summary: Argo CD application is out of sync + description: Argo CD application {{ $labels.name }} is out of sync. Check ArgoCDSyncAlert status, this alert is designed to notify that an application managed by Argo CD is out of sync. expr: argocd_app_info{namespace="openshift-gitops",sync_status="OutOfSync"} > 0 for: 5m labels: - severity: warning - description: ArgoCDSyncAlert is listed if Argo CD app is out of sync \ No newline at end of file + severity: warning \ No newline at end of file