Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1806640: fix potential errors in Prometheus alerts #414

Merged
merged 1 commit into from
May 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ spec:
annotations:
message: The pod disruption budget is preventing further disruption to pods because it is at the minimum allowed level.
expr: |
kube_poddisruptionbudget_status_expected_pods == on(namespace, poddisruptionbudget, service) kube_poddisruptionbudget_status_desired_healthy
max by(namespace, poddisruptionbudget) (kube_poddisruptionbudget_status_expected_pods == kube_poddisruptionbudget_status_desired_healthy)
simonpasquier marked this conversation as resolved.
Show resolved Hide resolved
for: 15m
labels:
severity: warning
- alert: PodDisruptionBudgetLimit
annotations:
message: The pod disruption budget is below the minimum number allowed pods.
expr: |
kube_poddisruptionbudget_status_expected_pods < on(namespace, poddisruptionbudget, service) kube_poddisruptionbudget_status_desired_healthy
max by (namespace, poddisruptionbudget) (kube_poddisruptionbudget_status_expected_pods < kube_poddisruptionbudget_status_desired_healthy)
for: 15m
labels:
severity: critical
2 changes: 1 addition & 1 deletion test/e2e/operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func TestPodDisruptionBudgetAtLimitAlert(t *testing.T) {
// Note: prometheus/client_golang Alerts method only works with the deprecated prometheus-k8s route.
// Our helper uses the thanos-querier route. Because of this, have to pass the entire alert as a query.
// The thanos behavior is to error on partial response.
query := fmt.Sprintf("ALERTS{alertname=\"PodDisruptionBudgetAtLimit\",alertstate=\"pending\",namespace=\"%s\",poddisruptionbudget=\"%s\",prometheus=\"openshift-monitoring/k8s\",service=\"kube-state-metrics\",severity=\"warning\"}==1", name, name)
query := fmt.Sprintf("ALERTS{alertname=\"PodDisruptionBudgetAtLimit\",alertstate=\"pending\",namespace=\"%s\",poddisruptionbudget=\"%s\",prometheus=\"openshift-monitoring/k8s\",severity=\"warning\"}==1", name, name)
err = wait.PollImmediate(time.Second*3, testTimeout, func() (bool, error) {
response, _, err = prometheusClient.Query(context.Background(), query, time.Now())
if err != nil {
Expand Down