← Back to Pull requests

AUTOSCALE-873: fix: apply OpenShift Karpenter CRD adjustments #33

Closed
unknown closed this pull request without merging on Sep 11, 2026 17:23 UTC
View on GitHub
unknown unknown commented on Sep 10, 2026 14:53 UTC
Author

Standalone Karpenter now owns EC2NodeClass CRD installation, so it must apply the same OpenShift schema relaxations as HyperShift.

I and my good friend pi went ahead and removed the following rules:

  • don't patch required to [] anymore, it seems we set all fields as shown below
  • <details>
    <summary>Evidence for keeping required</summary>

    - Upstream CRD requires:
      - `amiSelectorTerms`
      - `securityGroupSelectorTerms`
      - `subnetSelectorTerms`
    
      `../karpenter-operator/vendor/.../karpenter.k8s.aws_ec2nodeclasses.yaml:726-730`
    
    - Adapter calls `CreateOrUpdate` with `reconcileEC2NodeClass` callback:
    
      `karpenter-operator/controllers/nodeclass/ec2_nodeclass_controller.go:200-204`
    
    - Callback assigns:
    
      - AMI selectors: lines **285-302**
      - subnet selectors/default: lines **323-341**
      - security-group selectors/default: lines **343-361**
    
    AMI generation errors if architecture labels or AMI labels are missing, so it does not silently persist an empty AMI list.
    
    Caveat: explicitly supplied empty subnet/security-group slices take the copy path and remain empty. The API then rejects them via CRD validation. Defaults are non-empty.
    
    So precise statement:
    
    > On every successful adapter reconciliation, all three required selector fields are assigned before persistence. Default paths produce non-empty values. Explicit empty source slices are rejected during API persistence.
    

    </details>

    We also fixed the amiSelectorTerms patch so that the matrix now looks like this:

    | Selector term | Previous | Fixed | Result |
    |---|---:|---:|---|
    | {} | Accepted | Rejected | Fixed invalid input |
    | {id: "ami-..."} | Accepted | Accepted | Valid input remains accepted |
    | {ssmParameter: "..."} | Accepted | Rejected | Fixed invalid input |
    | {id: "...", ssmParameter: "..."} | Accepted | Rejected | Fixed invalid input |

    Origin of the script: https://github.com/openshift/hypershift/blob/main/karpenter-operator/hack/adjust-cel.sh

    Changes:

  • Inline CRD adjustments into manifest generation workflow

  • Regenerate AWS EC2NodeClass CRD asset

  • Document adjusted CRD ownership
  • Diff: 270 lines (+202 / -68) across 3 files Reviewer: maxcao13 Review duration: 1590m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.39) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 270 lines diff across 3 files
    0.39
    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.335
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #33"
    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: 39.4% (MEDIUM) · Higher = larger blast radius
    39.4%
    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: 15.6% · Safe to merge
    15.6%