Skip to content

Bug Report: Duplicate webhook patch in config/crd/kustomization.yaml #2819

@RobuRishabh

Description

@RobuRishabh

What happened?

The file config/crd/kustomization.yaml contains two issues:

  1. Duplicate webhook patch entry: The patch patches/webhook_in_sparkapplications.yaml is listed twice, which appears to be a copy-paste error.

  2. Missing patch files for ScheduledSparkApplication: The CA injection section references patches/cainjection_in_scheduledsparkapplications.yaml but this file doesn't exist. Similarly, there's no webhook_in_scheduledsparkapplications.yaml for the ScheduledSparkApplication CRD.

Affected file: https://github.com/kubeflow/spark-operator/blob/master/config/crd/kustomization.yaml

patches:
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
# patches here are for enabling the conversion webhook for each CRD
- path: patches/webhook_in_sparkapplications.yaml
- path: patches/webhook_in_sparkapplications.yaml  # <-- Duplicate (should be webhook_in_scheduledsparkapplications.yaml)
# +kubebuilder:scaffold:crdkustomizewebhookpatch

# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix.
# patches here are for enabling the CA injection for each CRD
#- path: patches/cainjection_in_scheduledsparkapplications.yaml  # <-- File doesn't exist
#- path: patches/cainjection_in_sparkapplications.yaml
# +kubebuilder:scaffold:crdkustomizecainjectionpatch

Reproduction Code

  1. Clone the spark-operator repository:

    git clone https://github.com/kubeflow/spark-operator.git
    cd spark-operator
  2. Check the contents of config/crd/kustomization.yaml:

    cat config/crd/kustomization.yaml
  3. Observe lines 12-13 have the same patch entry:

    - path: patches/webhook_in_sparkapplications.yaml
    - path: patches/webhook_in_sparkapplications.yaml
  4. List the available patch files in config/crd/patches/:

    ls config/crd/patches/

    Output shows only patches for SparkApplication exist:

    cainjection_in_sparkapplications.yaml
    webhook_in_sparkapplications.yaml
    

    Missing files:

    • webhook_in_scheduledsparkapplications.yaml
    • cainjection_in_scheduledsparkapplications.yaml

Expected behavior

The patches section should have entries for each CRD with corresponding patch files:

patches:
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
# patches here are for enabling the conversion webhook for each CRD
- path: patches/webhook_in_sparkapplications.yaml
- path: patches/webhook_in_scheduledsparkapplications.yaml
# +kubebuilder:scaffold:crdkustomizewebhookpatch

# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix.
# patches here are for enabling the CA injection for each CRD
#- path: patches/cainjection_in_scheduledsparkapplications.yaml
#- path: patches/cainjection_in_sparkapplications.yaml
# +kubebuilder:scaffold:crdkustomizecainjectionpatch

And the config/crd/patches/ directory should contain:

cainjection_in_scheduledsparkapplications.yaml  # NEW
cainjection_in_sparkapplications.yaml
webhook_in_scheduledsparkapplications.yaml      # NEW
webhook_in_sparkapplications.yaml

Actual behavior

The same patch file patches/webhook_in_sparkapplications.yaml is referenced twice, and cainjection_in_scheduledsparkapplications.yaml is referenced but doesn't exist:

patches:
- path: patches/webhook_in_sparkapplications.yaml
- path: patches/webhook_in_sparkapplications.yaml  # Duplicate entry

While this doesn't cause a functional issue (Kustomize applies the patch twice idempotently), it:

  1. Indicates an oversight where patches for ScheduledSparkApplication CRD are missing
  2. Would cause an error if the CA injection section is uncommented (file not found)
  3. Creates confusion about whether this was intentional
  4. Should be cleaned up for code clarity and completeness

Environment & Versions

  • Kubernetes Version:
  • Spark Operator Version:
  • Apache Spark Version:

Additional context

No response

Impacted by this bug?

Give it a 👍 We prioritize the issues with most 👍

Metadata

Metadata

Assignees

Labels

kind/bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions