NO-JIRA: fix: require EBS in block device mappings #47
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
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
linkvt
Related review thread: https://github.com/openshift/karpenter-operator/pull/43#discussion_r4093207596
TLDR
User submits:
1. OpenShift validation accepts it:
ebsis optional. Snapshot/size rule doesn’t run whenebsis absent.2. Go decoding: omitted
ebsbecomes zero-valuedBlockDevice.3. Our conversion helper: always allocates upstream EBS object. All converted fields are nil, so it serializes as:
4. Upstream validation rejects it:
ebsis now present, so its rule runs and requiressnapshotIDorvolumeSize.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