Skip to content

Commit

Permalink
add-extra-pint-validations (#1269)
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinBisson authored Jun 26, 2024
1 parent 68a393e commit ac4951b
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Renamed alert `DeploymentNotSatisfiedCrossplane` to `CrossplaneDeploymentNotSatisfied`
- Renamed alert `DeploymentNotSatisfiedExternalSecrets` to `ExternalSecretsDeploymentNotSatisfied`
- Renamed alert `DeploymentNotSatisfiedFlux` to `FluxDeploymentNotSatisfied`
- Add extra pint validations.

## [4.3.5] - 2024-06-24

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ spec:
expr: avg_over_time(aggregation:kubernetes:pod_resource_requests_cpu_cores{cluster_type="management_cluster"}[2d]) / on (cluster_id) group_left avg_over_time(aggregation:kubernetes:node_allocatable_cpu_cores_total{cluster_type="management_cluster"}[2d]) > 0.93
for: 1h
labels:
area: kass
area: kaas
cancel_if_outside_working_hours: "true"
severity: page
team: {{ include "providerTeam" . }}
Expand All @@ -54,7 +54,7 @@ spec:
expr: avg_over_time(aggregation:kubernetes:pod_resource_requests_memory_bytes{cluster_type="management_cluster"}[2d]) / on (cluster_id) group_left avg_over_time(aggregation:kubernetes:node_allocatable_memory_bytes{cluster_type="management_cluster"}[2d]) > 0.93
for: 1h
labels:
area: kass
area: kaas
cancel_if_outside_working_hours: "true"
severity: page
team: {{ include "providerTeam" . }}
Expand Down
9 changes: 8 additions & 1 deletion test/conf/pint/pint-all.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,20 @@ rule {
required = true
}

# Each alert must have a 'severity' annotation that's either 'page' or 'notify'.
# Each alert must have a 'severity' label that's either 'page' or 'notify'.
label "severity" {
severity = "bug"
value = "(page|notify)"
required = true
}

# Each alert must have an `area' label that's either 'kaas' or 'platform'.
label "area" {
severity = "bug"
value = "(kaas|platform)"
required = true
}

# Check how many times each alert would fire in the last 1d.
alerts {
range = "1d"
Expand Down
32 changes: 32 additions & 0 deletions test/conf/pint/pint-config.hcl
Original file line number Diff line number Diff line change
@@ -1,7 +1,39 @@
rule {
# Disallow spaces in label/annotation keys, they're only allowed in values.
reject ".* +.*" {
label_keys = true
annotation_keys = true
}

# Disallow URLs in labels, they should go to annotations.
reject "https?://.+" {
label_keys = true
label_values = true
}

# Ensure that all aggregations are preserving mandatory labels.
aggregate ".+" {
severity = "bug"
keep = ["cluster_id", "installation", "pipeline", "provider"]
}
}

rule {
# This block will apply to all alerting rules.
match {
kind = "alerting"
}

# Each alert must have a 'description' annotation.
annotation "description" {
severity = "bug"
required = true
}

# Check how many times each alert would fire in the last 1d.
alerts {
range = "1d"
step = "1m"
resolve = "5m"
}
}

0 comments on commit ac4951b

Please sign in to comment.