Commit fa5a1032 authored by Mark Fletcher's avatar Mark Fletcher 🔴

Convert missed SLO label application policy to use severity labels

parent 0ab10554
......@@ -9,23 +9,23 @@ resource_rules:
forbidden_labels:
- missed-SLO
ruby: |
priority_regex = /^priority::[12]$/
severity_regex = /^severity::[12]$/
priority_slo_map = {
"priority::1": 30,
"priority::2": 60
severity_slo_map = {
"severity::1": 30,
"severity::2": 60
}
if resource[:labels].grep(priority_regex).present? && labels_chronologically.present?
priority_label = labels_chronologically.reverse_each.find do |label|
label.name.match?(priority_regex)
if resource[:labels].grep(severity_regex).present? && labels_chronologically.present?
severity_label = labels_chronologically.reverse_each.find do |label|
label.name.match?(severity_regex)
end
return false unless priority_label
return false unless severity_label
slo = priority_slo_map[priority_label.name.to_sym]
slo = severity_slo_map[severity_label.name.to_sym]
priority_label.added_at < slo.days.ago
severity_label.added_at < slo.days.ago
end
actions:
labels:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment