← Back to Pull requests

NO-JIRA: fix: require EBS in block device mappings #47

Closed
unknown closed this pull request without merging on Oct 07, 2026 10:29 UTC
View on GitHub
unknown unknown commented on Oct 05, 2026 09:04 UTC
Author

Related review thread: https://github.com/openshift/karpenter-operator/pull/43#discussion_r4093207596

TLDR

User submits:

blockDeviceMappings:
- deviceName: /dev/xvda
  # ebs omitted

1. OpenShift validation accepts it: ebs is optional. Snapshot/size rule doesn’t run when ebs is absent.
2. Go decoding: omitted ebs becomes zero-valued BlockDevice.
3. Our conversion helper: always allocates upstream EBS object. All converted fields are nil, so it serializes as:

   blockDeviceMappings:
   - deviceName: /dev/xvda
     ebs: {}
   

4. Upstream validation rejects it: ebs is now present, so its rule runs and requires snapshotID or volumeSize.

Result: reconciliation error. Invalid upstream object never gets stored.

Solution


Require EBS on every explicit mapping to reject these configurations at admission. Serialize zero-valued EBS so typed clients also trigger the existing content validation. Keep blockDeviceMappings optional so callers can still use the default mappings.

The API exposes no alternative volume configuration. If one is added, the EBS requirement can be relaxed alongside serialization and controller support for that alternative.

Explanation

OpenshiftEC2NodeClass accepts mappings containing only deviceName or rootVolume because EBS is optional. The snapshotID-or-volumeSizeGiB validation applies only when EBS is present, so these mappings pass admission without specifying a volume.
Source: https://github.com/openshift/karpenter-operator/blob/0cf238e01a6b74c2b77066625c16cb0707ef4eb9/api/karpenter/v1/karpenter_types.go#L394-L397

The controller always converts each mapping into an upstream EBS object. When EBS is omitted, this produces an empty object.
Source: https://github.com/openshift/karpenter-operator/blob/98c510f322acbc9c16dda2e490c3a076dcb7ef6e/pkg/controllers/nodeclass/ec2/karpenter_util.go#L25
https://github.com/openshift/karpenter-operator/blob/98c510f322acbc9c16dda2e490c3a076dcb7ef6e/pkg/controllers/nodeclass/ec2/karpenter_util.go#L109-L110

The upstream EC2NodeClass schema rejects this because it requires snapshotID or volumeSize. Reconciliation then repeatedly fails for input our API accepted.
Source: https://github.com/openshift/karpenter-operator/blob/0cf238e01a6b74c2b77066625c16cb0707ef4eb9/vendor/github.com/aws/karpenter-provider-aws/pkg/apis/v1/ec2nodeclass.go#L446-L450

Diff: 308 lines (+231 / -77) across 3 files Reviewer: linkvt Review duration: 2965m
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 308 lines diff across 3 files
0.40
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.343
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #47"
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: 40.2% (MEDIUM) · Higher = larger blast radius
40.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: 15.9% · Safe to merge
15.9%