Skip to content

Commit

Permalink
Add alerts for TLS/DNS policies not targeting Gateways
Browse files Browse the repository at this point in the history
  • Loading branch information
david-martin committed Apr 2, 2024
1 parent 4f6a138 commit 606a52b
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions examples/alerts/prometheusrules_policies_missing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: policies-missing
namespace: monitoring
spec:
groups:
- name: policy-rules
rules:
- alert: GatewayWithoutDnsPolicy
expr: |
label_replace(gatewayapi_gateway_info, "gateway_name", "$1", "name", "(.*)") unless
(label_replace(gatewayapi_gateway_info, "gateway_name", "$1", "name", "(.*)")
* on(gateway_name) group_left
label_replace(gatewayapi_dnspolicy_target_info{target_kind="Gateway"}, "gateway_name", "$1", "target_name", "(.*)"))
for: 5m
labels:
severity: warning
annotations:
summary: "No DNSPolicy targeting Gateway '{{ $labels.gateway_name }}'"
description: "This alert fires if a gateway does not have an associated DNSPolicy."
- alert: GatewayWithoutTlsPolicy
expr: |
label_replace(gatewayapi_gateway_info, "gateway_name", "$1", "name", "(.*)") unless
(label_replace(gatewayapi_gateway_info, "gateway_name", "$1", "name", "(.*)")
* on(gateway_name) group_left
label_replace(gatewayapi_tlspolicy_target_info{target_kind="Gateway"}, "gateway_name", "$1", "target_name", "(.*)"))
for: 5m
labels:
severity: warning
annotations:
summary: "No TLSPolicy targeting Gateway '{{ $labels.gateway_name }}'"
description: "This alert fires if a gateway does not have an associated TLSPolicy."

0 comments on commit 606a52b

Please sign in to comment.