AUTOSCALE-947: feat: migrate EC2NodeClass controller from HyperShift #43
All Vouch review confidence checks passed
Residual risk 0.25 = Change Risk (0.63) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.63 · 283 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.338
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.063
Real PR Conversation Timeline
1 comments
"Review active on #43"
general
weight: 0.35
maxcao13
Related hypershift PR: https://github.com/openshift/hypershift/pull/9746
Reconcile OpenshiftEC2NodeClasses in the hosted cluster into EC2NodeClasses, consuming the user data Secrets and AMI labels produced by the HyperShift Karpenter adapter. The finalizer, VAP and karpenter-subnets ConfigMap names match HyperShift so clusters can switch from the embedded operator.
The operator now owns the OpenshiftEC2NodeClass CRD, generated from api/karpenter and installed only in management-cluster mode on AWS.
Platforms expose hosted control plane NodeClass support through CloudProvider.HCPNodeClassProvider.
Bump github.com/openshift/hypershift/api for the AWS resource tag override policy types.
I also ran
go fixon the package to modernize the code but otherwise made no changes to make the review and diff smaller.IMO the code should be refactored in a follow up.
AI also found a bug in the HCP predicate (see the separate commit).
Changes of the EC2 controller related files
Excluding the changes from
go fix:struct { name string }- add constructor and
Name() stringfunc for the interface so that the generic controller setup can create this one for AWS and Azure- remove CRD reconciliation as the CRD controller is doing that
- KO's default client is for the mgmt cluster not the hosted cluster -> update the watches etc.
- ownership handling is done via
controllerutil.SetControllerReferenceinstead of the custom helper in hypershift go- use
controllerutil.CreateOrUpdatedirectly instead of the hypershift helper- extract a few userdata specific functions, see below
- Added
TestReconcileandTestReconcileStatusPreservesIgnitionOwnedFieldstest- table tests using a
map[string]struct{...}- extract duplicate labels or selectors we also use in the default nodeclass controller
- extract
TestGetUserDataSecretandTestAMISelectorTermsFromUserDataSecretfrom theec2_nodeclass_controller_test.go