generated from giantswarm/template-app
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add InhibitionClusterWithoutWorkerNodes for CAPA (#1397)
Co-authored-by: Herve Nicol <[email protected]> Co-authored-by: Quentin Bisson <[email protected]>
- Loading branch information
1 parent
d5568d2
commit c3d9f2a
Showing
3 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
helm/prometheus-rules/templates/kaas/phoenix/alerting-rules/capa.inhibition.rules.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{{- if eq .Values.managementCluster.provider.kind "capa" }} | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: PrometheusRule | ||
metadata: | ||
creationTimestamp: null | ||
labels: | ||
{{- include "labels.common" . | nindent 4 }} | ||
cluster_type: "management_cluster" | ||
name: capa.inhibitions.rules | ||
namespace: {{ .Values.namespace }} | ||
spec: | ||
groups: | ||
- name: capa.inhibitions | ||
rules: | ||
- alert: InhibitionClusterWithoutWorkerNodes | ||
annotations: | ||
description: '{{`Cluster ({{ $labels.cluster_id }}) has no worker nodes.`}}' | ||
expr: |- | ||
label_replace( | ||
capi_cluster_status_condition{type="ControlPlaneReady", status="True"}, | ||
"cluster_id", | ||
"$1", | ||
"name", | ||
"(.*)" | ||
) == 1 | ||
unless on (cluster_id) ( | ||
sum(capi_machinepool_spec_replicas{} > 0) by (cluster_id) | ||
) | ||
labels: | ||
area: kaas | ||
has_worker_nodes: "false" | ||
team: phoenix | ||
topic: status | ||
{{- end }} |
47 changes: 47 additions & 0 deletions
47
...ests/providers/capi/capa-mimir/kaas/phoenix/alerting-rules/capa.inhibition.rules.test.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
rule_files: | ||
- capa.inhibition.rules.yml | ||
|
||
tests: | ||
# Tests for `InhibitionClusterWithoutWorkerNodes` inhibition alert | ||
- interval: 1m | ||
input_series: | ||
- series: 'capi_cluster_status_condition{cluster_id="golem", cluster_type="management_cluster", name="golem", pipeline="testing", status="True", type="ControlPlaneReady"}' | ||
values: "1+0x300" | ||
- series: 'capi_machinepool_spec_replicas{cluster_id="golem", cluster_name="golem", cluster_type="management_cluster", customer="giantswarm", installation="golem", organization="giantswarm", pipeline="testing", provider="capa"}' | ||
values: "_x60 0x60 3x60" | ||
alert_rule_test: | ||
- alertname: InhibitionClusterWithoutWorkerNodes | ||
eval_time: 30m | ||
exp_alerts: | ||
- exp_labels: | ||
area: kaas | ||
cluster_id: "golem" | ||
cluster_type: "management_cluster" | ||
has_worker_nodes: "false" | ||
name: "golem" | ||
pipeline: "testing" | ||
status: "True" | ||
team: "phoenix" | ||
topic: "status" | ||
type: "ControlPlaneReady" | ||
exp_annotations: | ||
description: "Cluster (golem) has no worker nodes." | ||
- alertname: InhibitionClusterWithoutWorkerNodes | ||
eval_time: 90m | ||
exp_alerts: | ||
- exp_labels: | ||
area: kaas | ||
cluster_id: "golem" | ||
cluster_type: "management_cluster" | ||
has_worker_nodes: "false" | ||
name: "golem" | ||
pipeline: "testing" | ||
status: "True" | ||
team: "phoenix" | ||
topic: "status" | ||
type: "ControlPlaneReady" | ||
exp_annotations: | ||
description: "Cluster (golem) has no worker nodes." | ||
- alertname: InhibitionClusterWithoutWorkerNodes | ||
eval_time: 150m |