← Back to Pull requests

fix(observability): do not fire KubePodNotReady for terminating pods #7287

Closed
unknown closed this pull request without merging on Oct 01, 2026 21:04 UTC
View on GitHub
unknown unknown commented on Oct 01, 2026 07:48 UTC
Author

Summary

KubePodNotReady fires on pods that are intentionally terminating during cluster teardown. The upstream expression keys on pod phase and does not exclude pods carrying a deletionTimestamp, so a gracefully-terminating HCP control-plane pod (e.g. kube-apiserver during deprovision) is treated like a genuinely stuck one.

This adds a deletion-timestamp exclusion to the expression:

... unless on(namespace, pod, cluster) kube_pod_deletion_timestamp

Genuinely stuck pods (no deletion timestamp) still alert, so serving-cluster coverage is unchanged.

Change scope

The alert rule is vendored/generated, so the only hand-edited rule source is the maintained .diff patch; every deployable artifact is regenerated through the observability Makefile (not hand-edited). The PR therefore spans:

  • observability/alerts/kubernetesControlPlane-prometheusRule.yaml.diff — maintained patch (only hand-edited rule source)

  • observability/alerts/kubernetesControlPlane-prometheusRule.yaml — regenerated rule

  • observability/alerts/kubernetesControlPlane-prometheusRule_test.yaml — new regression test (terminating pod silenced; non-terminating NotReady still fires, incl. cross-cluster isolation)

  • dev-infrastructure/modules/metrics/rules/generatedMsftPrometheusAlertingRules.bicep, generatedKustoOnlyServicePrometheusAlertingRules.bicep, generatedKustoOnlyHCPPrometheusAlertingRules.bicep — regenerated deployable Bicep (the artifacts the deployment modules import)

  • observability/alerts-msft-services.yaml, observability/alerts-kusto-services.yaml, observability/alerts-kusto-hcps.yaml — promote the rule from untestedRules to a tested config so the generator discovers and runs the new regression test

  • test/util/alertdiagnostics/testdata/zz_fixture_TestRepositoryCorpus.yaml — regenerated corpus fixture
  • Verification

  • Full alert generator run; regeneration is deterministic (a second run is byte-identical).

  • promtool validates all rules; the regression test runs and passes in all three consuming configs.

  • make fmt clean; relevant lint clean; working tree clean.
  • Tracking

    No separate tracking issue — this is a self-contained CI/observability fix identified during analysis of the KubePodNotReady alert firing on terminating HCP control-plane pods during cluster teardown.

    ---
    AI-generated. Review for accuracy.

    @machi1990 requested from Slack

    Diff: 303 lines (+227 / -76) across 3 files Reviewer: stevekuznetsov Review duration: 795m
    All Vouch review confidence checks passed
    Residual risk 0.25 = Change Risk (0.63) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.63 · 303 lines diff across 3 files
    0.63
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.342
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.063
    Real PR Conversation Timeline
    1 comments
    "Review active on #7287"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 63.3% (MEDIUM) · Higher = larger blast radius
    63.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 25% · Safe to merge
    25%
    Repository