← Back to Pull requests

fix(webhook): validate ConfigMap mount-path uniqueness #3140

Closed
unknown closed this pull request without merging on Sep 14, 2026 04:43 UTC
View on GitHub
unknown unknown commented on Sep 03, 2026 16:25 UTC
Author

<!-- 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}.configMaps entries are validated for a repeated name, but not for a repeated path. Two entries with different names and the same mount path pass admission today, and the mutating webhook then builds two volumeMounts with an identical mountPath, which the API server rejects at pod creation with a generic error that gives no hint the SparkApplication spec 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:

  • Replace the duplicate-name check in validateConfigMapList with a duplicate-path check, 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).

  • Update addGeneralConfigMaps in the mutating webhook to build one pod volume per distinct ConfigMap and one volumeMount per 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

  • Bugfix (non-breaking change which fixes an issue)

  • Feature (non-breaking change which adds functionality)

  • Breaking change (fix or feature that could affect existing functionality)

  • Documentation update
  • 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

  • I have conducted a self-review of my own code.

  • I have updated documentation accordingly.

  • I have added tests that prove my changes are effective or that my feature works.

  • Existing unit tests pass locally with my changes.
  • Additional Notes

    Validation performed locally:

  • go test ./internal/webhook/..., including the ginkgo envtest suite (TestWebhooks), run with KUBEBUILDER_ASSETS pointed at the make setup-envtest binaries — 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.

  • Branch is cut from upstream/master tip; upstream's own Integration Test workflow is green on recent master runs.
  • No documentation changes were needed beyond the code comments and tests; the CRD schema and field docs for configMaps[].path already describe it as the mount path and are unaffected by this change.

    Fixes #3134

    Diff: 443 lines (+332 / -111) across 5 files Reviewer: vara-bonthu Review duration: 15137m
    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
    0.69
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 68.5% (HIGH) · Higher = larger blast radius
    68.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 27.1% · Safe to merge
    27.1%