diff --git a/common/stock/namespace_sync.yaml.tmpl b/common/stock/namespace_sync.yaml.tmpl index aaeef07..f02f2ae 100644 --- a/common/stock/namespace_sync.yaml.tmpl +++ b/common/stock/namespace_sync.yaml.tmpl @@ -6,19 +6,22 @@ groups: rules: - alert: ArgoCDApplicationNotSynced expr: argocd_app_info{autosync_enabled="true",sync_status!="Synced"} == 1 + #expr: argocd_app_info * on (namespace) group_left(team) sum by (namespace, team) (label_replace(kube_namespace_labels{job!="opencost"}, "team", "$1", "label_uw_systems_owner", "(system|partner)")) for: 1h labels: - group: namespace_sync + alerttype: stock + alertgroup: namespace_sync annotations: summary: "Argo CD application {{$labels.name}} is not synced for last 1h" impact: "Some manifests won't be automatically deployed." action: "Check the web UI / logs for errors." link: https://argocd-system.$ENVIRONMENT.$PROVIDER.uw.systems/applications/{{$labels.namespace}}/{{$labels.name}} - alert: ArgoCDApplicationAutoSyncDisabled - expr: argocd_app_info{autosync_enabled="false"} == 1 + expr: (argocd_app_info{autosync_enabled="false"} == 1) * on (namespace) group_left(team) uw_namespace_team for: 1h labels: - group: namespace_sync + alerttype: stock + alertgroup: namespace_sync annotations: summary: "Auto Sync on Argo CD application {{$labels.name}} is disabled" impact: "New manifests won't be automatically deployed." diff --git a/common/stock/team_detection.yaml b/common/stock/team_detection.yaml index 5b5b6be..d4e9f29 100644 --- a/common/stock/team_detection.yaml +++ b/common/stock/team_detection.yaml @@ -3,5 +3,6 @@ groups: rules: - record: uw_namespace_owner expr: label_replace(kube_namespace_labels{job="kube-state-metrics"}, "team", "$1", "label_uw_systems_owner", "(system|partner)") + # used as: `metric_with_namespace * on (namespace) group_left (team) uw_namespace_team - record: uw_namespace_team expr: sum by (namespace, team) (label_replace(kube_namespace_labels{job="kube-state-metrics"}, "team", "$1", "label_uw_systems_owner", "(system)"))