feat!: Add webhook namespace-selector for multi-tenant deployments #3217
All Vouch review confidence checks passed
Residual risk 0.30 = Change Risk (0.69) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.69 · 464 lines diff across 5 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.367
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.069
Real PR Conversation Timeline
1 comments
"Review active on #3217"
general
weight: 0.35
tariq-hasan
<!-- Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, check our contributor guidelines: https://www.kubeflow.org/docs/about/contributing
2. To know more about how to develop with the Spark operator, check the developer guide: https://spark.kubeflow.org/en/latest/contributor-guide/
3. If you want faster PR reviews, check how: https://git.k8s.io/community/contributors/guide/pull-requests.md#best-practices-for-faster-reviews
4. Please open an issue to discuss significant work before you start. We appreciate your contributions and don't want your efforts to go to waste!
-->
Purpose of this PR
Follow-up to #2943 / closes #2913. Completes webhook parity with the controller namespace selector from #2808 so multi-tenant Helm installs admit the same namespaces the controller reconciles.
Rebased onto current master and ported to typed
admission.Defaulter/admission.Validator(NewWebhookManagedBy(mgr, obj)).Proposed changes:
--namespace-selectorplus process-side filtering (NamespaceFilteringDefaulter/NamespaceFilteringValidator) so mutate/validate use the same namespace matcher as the controller.--label-selector-filterstays so existing webhook args still start.spark.jobNamespaceSelector:- Must be an object (
matchLabels/matchExpressions). The object drives admission webhooknamespaceSelectorand is converted to the--namespace-selectorflag string for the controller and webhook processes.- Breaking change: the previous string form (e.g.
"spark=enabled") is no longer accepted. Users must migrate tomatchLabels/matchExpressions. The install fails with a clear migration message if a string is supplied.jobNamespaceslist andjobNamespaceSelectorare set, each webhook is registered twice: one selector for the listed names, and one for the labels that excludes those names, so a namespace is admitted once. That matches the controller OR (listed namespaces or labeled namespaces).Change Category
<!-- Indicate the type of change by marking the applicable boxes. -->
Rationale
#2808 taught the controller to watch namespaces by label, but webhooks still used only a name-based
namespaceSelector. In shared clusters, jobs in label-selected namespaces can reconcile while admission is skipped.A single webhook
namespaceSelectorcannot express "listed namespaces OR labeled namespaces". Two registrations cover that union. The chart value is an object because the webhook needs aLabelSelector; Helm converts that object into the controller/webhook flag string. The reverse (an arbitrary selector string intomatchLabels/matchExpressions) is not reliable in Helm, so the string form is removed.Checklist
<!-- Before submitting your PR, please review the following: -->
Additional Notes
make helm-unittest,go test ./internal/webhook/ -count=1,go test ./test/kustomize/ -count=1.