fix(module): preserve legacy Deployment selector labels for 3.5→3.6 upgrade #212
All Vouch review confidence checks passed
Residual risk 0.30 = Change Risk (0.75) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.75 · 650 lines diff across 8 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.388
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.075
Real PR Conversation Timeline
1 comments
"Review active on #212"
general
weight: 0.35
RobuRishabh
Summary
Fixes RHAI-10913: Spark Operator deployment selector immutable field error during RHOAI 3.5.x → 3.6 upgrades.
Updated approach based on @RobuRishabh's review feedback - uses surgical JSON6902 patches instead of
includeSelectors: trueto avoid breaking Spark job networking.Problem
RHOAI 3.5.0 created
spark-operator-controllerandspark-operator-webhookDeployments with 6 selector labels. RHOAI 3.6.0 tries to apply only 4 labels. Since Kubernetes deployment selectors are immutable, the upgrade fails with:Root Cause
kustomize.WithLabel()which addedapp.kubernetes.io/part-ofandapp.opendatahub.io/sparkoperatorto deployment selectorsincludeSelectors: false, which excluded these labels from selectorsSolution
Use JSON6902 patches to surgically add legacy labels to:
1.
spec.selector.matchLabels- fixes upgrade (selector immutability)2.
spec.template.metadata.labels- satisfies Kubernetes requirement (pod labels must be superset of selector)Why NOT
includeSelectors: true?The initial fix used
includeSelectors: true, but @RobuRishabh identified a critical flaw:Problem:
includeSelectors: trueadds labels to ALL selectors, including NetworkPolicypodSelector:Impact:
sparkoperator.k8s.io/launched-by-spark-operatorThe Correct Fix: JSON6902 Patches
This targets only Deployments, leaving NetworkPolicy untouched.
Testing
Regression Tests Added
New test file:
test/kustomize/overlay_selector_labels_test.goThree test functions:
1.
TestRHOAIOverlayPreserves35SelectorLabels- validates 6-label selectors AND pod labels2.
TestODHOverlayPreserves2xSelectorLabels- validates 6-label selectors AND pod labels3.
TestNetworkPolicySelectorsNotPolluted- prevents theincludeSelectors: trueregressionAll tests pass:
Manual Validation
Tested with the reproduction scripts from the bug report:
kubectl kustomize)Changes
Modified Files
config/overlays/rhoai/kustomization.yaml- JSON6902 patches for RHOAIconfig/overlays/odh/kustomization.yaml- JSON6902 patches for ODHtest/kustomize/overlay_selector_labels_test.go- regression tests (new file)Diff Summary
RHOAI overlay:
Related Issues
- KubeRay: opendatahub-io/kuberay#247
- TrustyAI: trustyai-explainability/trustyai-service-operator#1041
Release Notes
🤖 Generated with Claude Code
[RHAI-10913]: https://redhat.atlassian.net/browse/RHAI-10913?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ