← Back to Pull requests

nmo-operator: add NHC lease blocked maintenance test on control-plane (RHWA-1255) #147

Open
gamado opened this pull request with 880 lines diff across 10 files
View on GitHub
gamado gamado commented on Nov 29, 2026 17:50 UTC
Author

Port of OCP-66800 test_nhc_node_lease_on_cp from ocp-edge-auto (RHWA-1255, control-plane variant of the merged OCP-65652 spec).

What it verifies

The NHC CR selects node-role.kubernetes.io/master. While NHC remediates a master (kubelet stopped over SSH), NHC holds the node's lease in medik8s-leases, and a NodeMaintenance CR created for that master must not complete -- it stays in Running phase with status.lastError reporting that the lease is held by a different owner (the NHC). The NodeMaintenance is created only after the NMO controller deployment is verified Ready, a check the Python reference performs in this variant alone. When kubelet is restarted, remediation ends, NHC returns to Enabled and releases the lease, and the same NodeMaintenance completes and NMO takes over the lease; deleting it leaves no lease in the namespace. That completion is the positive control proving NMO was functional throughout and only the lease blocked it.

The spec skips on topologies that cannot spare a control-plane node: a single-replica control plane, fewer than three control-plane nodes, an etcd quorum PodDisruptionBudget that cannot be assessed or does not tolerate exactly one disruption, or no eligible master after excluding the NMO controller's and the SSH bastion's nodes.

  • Test plan: OCP-66800

  • Jira: RHWA-1255

  • README entry added (pass criteria list every assertion).
  • Shared-helper refactor

    The lease interop helpers are parameterized for both variants (NHC selector key, scenario reason, maintenance and teardown budgets), with the worker variant's behavior preserved. Control-plane drains and teardown run on the ControlPlaneMaintenanceTimeout budget. The control-plane topology guards are shared with the control-plane quorum spec, and both variants' recovery deletes the NodeMaintenance before the NodeHealthCheck CR, closing the window in which the NHC deletion could release the lease under a still-existing blocked maintenance.

    Merge order (hard dependency): this PR depends on openshift/release#89450 (the e2e-interop CI lane that installs NHC + NMO together with the ssh-bastion step). It must merge only after that release PR is merged and the spec runs green there via /test 5.0-konflux-e2e-interop-aws. Until then the spec skips in every existing lane (no NHC installed). The same dependency applies to the sibling lease-interop PRs.

    Live-cluster verification (2026-11-29)

    Both lease interop specs executed and passed on a cluster-bot AWS cluster (OCP 5.0.3, NHC + NMO v5.8.0, 3 control-plane + 3 workers):

  • OCP-66800 (new, first live run): passed in 8m30s -- all quorum guards passed on a real 3-master cluster, NHC held the master's lease with holder identity exactly NodeHealthCheck-nhc-node-lease-test, the NodeMaintenance stayed blocked for the whole 180s window with lastError naming the NHC, and completed after kubelet restart with NMO taking the lease; no lease remained after deletion.

  • OCP-65652 (worker variant, re-validated after the refactor): passed in 6m18s.

  • Cluster state verified clean after the run: all nodes Ready, no NodeMaintenance/NodeHealthCheck/TestRemediation CRs, no leases in medik8s-leases.
  • 🤖 Generated with Claude Code

    Diff: 880 lines (+626 / -254) across 10 files Reviewer: mshitrit Review duration: 8565m
    All Vouch review confidence checks passed
    Residual risk 0.11 = Change Risk (0.56) × (1 − Review Confidence (0.80)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.56 · 880 lines diff across 10 files
    0.56
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.66 · 1 substantive comment(s)
    0.66
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    80%
    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.400
    Real PR Conversation Timeline
    1 comments
    tests/nmo-operator/tests/nmo_nhc_lease_blocked_cp.go
    "IIUC it should have labels.StabilityCandidate as a new test"
    test weight: 0.55
    Reviewers
    Assignees
    gamado gamado
    Labels
    risk: low confidence: 80.1% reviewed
    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: 56.2% (MEDIUM) · Higher = larger blast radius
    56.2%
    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: 80.1% · Lower = rushed or shallow review
    80.1%
    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: 11.2% · Safe to merge
    11.2%