fix(webhook): validate ConfigMap mount-path uniqueness #3140
All Vouch review confidence checks passed
Residual risk 0.27 = Change Risk (0.69) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.69 · 443 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.365
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.069
Real PR Conversation Timeline
1 comments
"Review active on #3140"
general
weight: 0.35
vara-bonthu
<!-- 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
spec.{driver,executor}.configMapsentries are validated for a repeatedname, but not for a repeatedpath. Two entries with different names and the same mount path pass admission today, and the mutating webhook then builds twovolumeMountswith an identicalmountPath, which the API server rejects at pod creation with a generic error that gives no hint theSparkApplicationspec is the cause. Conversely, mounting the same ConfigMap at two different paths — a legitimate configuration — was rejected outright by the duplicate-name check.Proposed changes:
namecheck invalidateConfigMapListwith a duplicate-pathcheck, so the webhook rejects the actual conflict (two mounts at the same path) instead of a configuration that is actually safe (the same ConfigMap mounted twice at different paths).addGeneralConfigMapsin the mutating webhook to build one pod volume per distinct ConfigMap and onevolumeMountper entry, instead of one volume per entry, so mounting the same ConfigMap at multiple paths no longer produces two pod volumes sharing a name.Change Category
Rationale
This closes out a known follow-up: the previously merged ConfigMap-reference validator (#3117) left an explicit comment noting that once the defaulter builds one volume per distinct ConfigMap, mount paths become the thing that needs to stay unique instead of names, and pointed at this issue. This PR makes that change.
Checklist
Additional Notes
Validation performed locally:
go test ./internal/webhook/..., including the ginkgo envtest suite (TestWebhooks), run withKUBEBUILDER_ASSETSpointed at themake setup-envtestbinaries — passes, including new/updated cases for the duplicate-path rejection, the same-ConfigMap-at-two-paths acceptance, and one-volume/two-volumeMounts pod shape.go test $(go list ./... | grep -v -e /drift -e /test/e2e)(full repo unit tests) — passes.make go-vet,make go-fmt(no diff produced),make go-lint(golangci-lint, 0 issues) — all pass clean.go mod tidy— no changes.upstream/mastertip; upstream's own Integration Test workflow is green on recentmasterruns.No documentation changes were needed beyond the code comments and tests; the CRD schema and field docs for
configMaps[].pathalready describe it as the mount path and are unaffected by this change.Fixes #3134