← Back to Pull requests

OCPNODE-3747: Disable Swap mode in Kubelet and enable drop-in directory #5294

Closed
unknown closed this pull request without merging on Oct 08, 2025 03:37 UTC
View on GitHub
unknown unknown commented on Sep 22, 2025 11:44 UTC
Author

<!--
If this is a bug fix, make sure your description includes "Fixes: #xxxx", or
"Closes: #xxxx"

Please provide the following information:
-->
Fixes: https://issues.redhat.com/browse/OCPNODE-3747
Context:
With the release of 1.34 version of Kubernetes swap feature in Kubelet is GAed. This means that, customer can set FailSwapOn to false and SwapBehavior to LimitedSwap. OpenShift 4.21 is currently planned to adopt 1.34 version of Kubernetes. Hence users of OpenShift 4.21 and above are impacted by this upstream release of swap feature.

- What I did
1. Ensure that FailSwapOn and MemorySwap.SwapBehavior cannot be set by users of OpenShift
2. Ensure that FailSwapOn is set to false on worker nodes and true on all other types of nodes. MemorySwap.SwapBehavior is always set to "NoSwap"
3. Ensure that drop-in directory is enabled on the worker node kubelet so that CNV team can use it to set swapBehavior (won't be documented for external users)

- How to verify it

  • Created a cluster in clusterBot with this PR and ensured that failSwapOn and swapBehavior is set

  • Worker Nodes:
      - All 3 worker nodes: failSwapOn: false, swapBehavior: "NoSwap"
    
      Control Plane Nodes:
      - All 3 master nodes: failSwapOn: true, swapBehavior: "NoSwap"
    
      The worker nodes have swap failure disabled (failSwapOn: false) while control plane nodes have it enabled (failSwapOn: true). All nodes have swapBehavior
      set to "NoSwap".
    

    While this was tested the following PR was also required: https://github.com/openshift/api/pull/2494 (Merged already)

    The cluster bot command was:

    launch 4.21,openshift/machine-config-operator#5294,openshift/api#2494 gcp
    

  • Then created a drop-in file

  • apiVersion: kubelet.config.k8s.io/v1beta1
    kind: KubeletConfiguration
    memorySwap:
      swapBehavior: LimitedSwap
    

    Checked the output of configz
    oc get --raw "/api/v1/nodes/ci-ln-sptb06t-72292-d64jj-worker-a-4zrm5/proxy/configz" | \
    jq '.kubeletconfig.memorySwap.swapBehavior'
    "LimitedSwap"
    

    Note to reviewer
    Unit tests are included. The end-to-end (E2E) tests will be added to the origin repository, as defined by the work items in the Epic: OCPNODE-3646.

    I've chosen the origin repository to ensure maintain consistency with other node features (ex: image volume).

    - Description for the changelog
    <!--
    Write a short (one line) summary that describes the changes in this
    pull request for inclusion in the changelog:
    -->
    Disables openshift users to use swap mode on the Kubelet

    Diff: 324 lines (+243 / -81) across 4 files Reviewer: fabiand Review duration: 22552m
    All Vouch review confidence checks passed
    Residual risk 0.26 = Change Risk (0.65) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.65 · 324 lines diff across 4 files
    0.65
    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.346
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.065
    Real PR Conversation Timeline
    1 comments
    "Review active on #5294"
    general weight: 0.35
    Reviewers
    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: 65.2% (HIGH) · Higher = larger blast radius
    65.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: 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.7% · Safe to merge
    25.7%