← Back to Pull requests

fix(janitor-provider): skip generic reboot when the node boot ID has changed #2110

Closed
unknown closed this pull request without merging on Oct 23, 2026 11:37 UTC
View on GitHub
unknown unknown commented on Oct 22, 2026 20:06 UTC
Author

Summary

Fixes #2077.

With CSP=generic, one reboot request can reboot a node twice. The reboot kills the reboot pod before the kubelet reports a terminal status. After boot, the kubelet starts the same pod again, and that pod reboots the node a second time. restartPolicy: Never and backoffLimit: 0 do not prevent this, and cleanupRebootJob races with the kubelet.

This change makes each reboot Job valid only for the boot that created it:

  • SendRebootSignal passes the pre-reboot boot ID to the container in the PRE_REBOOT_BOOT_ID env var.

  • All four reboot commands (default, syslog, SysRq, SysRq with syslog) now run through sh -c and start with a boot ID check. The check compares /proc/sys/kernel/random/boot_id with PRE_REBOOT_BOOT_ID before any other action:

  • - IDs match: write the optional syslog entry, then reboot. The reboot runs last, so a failed reboot exits non-zero.
    - IDs differ: the node already rebooted. Log skipping reboot and exit 0, with no reboot and no syslog entry.
    - Either ID missing or unreadable: exit 1 and do not reboot (fail closed).
  • The boot ID is passed only through the env var, never interpolated into the script, so a malformed value cannot inject shell commands.

  • The check uses if/then instead of the issue's check && reboot || echo. With &&/||, a failed reboot prints "skipping" and exits 0, and an empty env var with an unreadable file reboots the node.
  • No change to Helm values, protobufs, CRDs, labels or metrics. Jobs created by the previous version keep their old command until they finish.

    Behaviour note for operators: the default reboot command changes from chroot /host reboot to a sh -c script. The reboot image must include sh and cat. The default busybox image has both. If a custom image has no sh, the container does not start and the node does not reboot.

    Type of Change


  • 🐛 Bug fix

  • ✨ New feature

  • 💥 Breaking change

  • 📚 Documentation

  • 🔧 Refactoring

  • 🔨 Build/CI
  • Component(s) Affected


  • Health Monitor

  • Core Service

  • Fault Management

  • Janitor

  • Deployment/Config

  • API/Interface

  • Preflight

  • Plugins

  • Documentation/CI

  • New Component

  • Multiple Components

  • Other
  • Testing


  • Tests pass locally

  • Manual testing completed

  • No breaking changes (or documented)
  • Cluster test on the dev cluster where #2077 was reproduced (CSP=generic, default reboot command, CRI-O, node 10.0.10.194). In both runs janitor-provider was on the rebooted node, so cleanup could not run before the kubelet restarted the reboot pod.

    | Run | Path | Boot ID | Kubelet re-ran reboot pod | Second run output | Result |
    |---|---|---|---|---|---|
    | 1 | RebootNode CR | 77d320c9… → 25a1e7b8… | Yes, 19 s before Job cleanup | boot ID changed … skipping reboot, exit 0 | One reboot, stable 7 min |
    | 2 | MaintenanceRequest (RESTART_VM) | 25a1e7b8… → 59a165d3… | Yes, 20 s before Job cleanup | boot ID changed … skipping reboot, exit 0 | One reboot, stable 5 min; node uncordoned after the MaintenanceRequest was deleted |

    Checklist


  • Self-review completed

  • Documentation updated (if needed)

  • Ready for review
  • <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    New Features
    Reboot jobs now check the node’s boot ID before taking action. If the node has already rebooted, the job skips another reboot; if the boot ID cannot be read, it stops without rebooting.
    Documentation
    Updated provider guidance to clarify reboot image requirements and explain how reboot jobs behave after a node restarts.

    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 475 lines (+356 / -119) across 5 files Reviewer: jtschelling Review duration: 931m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.46) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.46 · 475 lines diff across 5 files
    0.46
    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.369
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #2110"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% 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: 45.7% (MEDIUM) · Higher = larger blast radius
    45.7%
    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: 18.1% · Safe to merge
    18.1%