Skip to content

[SPARK-56115] Support crds.install in Helm Chart#641

Open
TQJADE wants to merge 3 commits intoapache:mainfrom
TQJADE:crd
Open

[SPARK-56115] Support crds.install in Helm Chart#641
TQJADE wants to merge 3 commits intoapache:mainfrom
TQJADE:crd

Conversation

@TQJADE
Copy link
Copy Markdown
Contributor

@TQJADE TQJADE commented Apr 22, 2026

What changes were proposed in this pull request?

This PR introduces a crds.install configuration option to the Helm chart. CRD files are moved from the crds/ directory
(unconditionally installed by Helm) to templates/crds/ with a {{- if .Values.crds.install }} guard, allowing users to
disable CRD installation by setting crds.install: false. Similar to:
https://github.com/argoproj/argo-helm/blob/f7aee451eb788abd682d187fb055668bbfe28091/charts/argo-cd/values.yaml#L31-L40

Why are the changes needed?

In environments where CRDs are managed separately, users need the ability to skip CRD installation at the chart level. Previously the only option was the helm install --skip-crds flag, which is not declarative and cannot be expressed in a values file.

Does this PR introduce any user-facing change?

Yes.

  • crds.install (default: true) — Controls whether CRDs are installed with the chart. Set to false when CRDs are managed externally or when deploying a second operator instance.
  • crds.annotations (default: {"helm.sh/resource-policy": "keep"}) — Annotations applied to CRD resources. The default prevents CRDs from being deleted on helm uninstall.
  • Migration note: Users running multiple operator releases in different namespaces must set crds.install: false on
    releases.

How was this patch tested?

helm template --set crds.install=true renders both CRDs
helm template --set crds.install=false renders no CRDs                                                                    

Was this patch authored or co-authored using generative AI tooling?

Generated-by: Claude Opus 4.7

@TQJADE TQJADE changed the title Introduce crds.install to Helm Chart [SPARK-56115] Introduce crds.install to Helm Chart Apr 22, 2026
@dongjoon-hyun dongjoon-hyun changed the title [SPARK-56115] Introduce crds.install to Helm Chart [SPARK-56115] Support crds.install in Helm Chart Apr 22, 2026
Copy link
Copy Markdown
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this PR is safe because templates/crds seems to be not protected during uninstallation. Could you double-check the CRD remains in the system during helm uninstall operation like before?

Does this PR introduce any user-facing change?

No

doLast {
def generatedCRDFileBase = "$currentPath/build/resources/main/"
def stagedCRDFileBase = "$currentPath/../build-tools/helm/spark-kubernetes-operator/crds/"
def stagedCRDFileBase = "$currentPath/../build-tools/helm/spark-kubernetes-operator/templates/crds/"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this safe?

@dongjoon-hyun
Copy link
Copy Markdown
Member

Why do we need to change spark-operator-api/build.gradle in this PR which adds crds.install?

@TQJADE
Copy link
Copy Markdown
Contributor Author

TQJADE commented Apr 23, 2026

I'm not sure if this PR is safe because templates/crds seems to be not protected during uninstallation. Could you double-check the CRD remains in the system during helm uninstall operation like before?

Does this PR introduce any user-facing change?

No

Thanks for catching this! The move from crds/ to templates/crds/ did lose Helm's built-in uninstall protection. I've addressed this by adding a configurable crds.annotations value, defaulting to "helm.sh/resource-policy": keep, which tells Helm to skip deleting CRDs on uninstall.

@TQJADE
Copy link
Copy Markdown
Contributor Author

TQJADE commented Apr 23, 2026

Why do we need to change spark-operator-api/build.gradle in this PR which adds crds.install?

  1. The compared base file path change: The CRD files were moved from crds/ to templates/crds/
  2. Crd contents contains the {{- if .Values.crds.install }} etc, yq cmd will failed with sed

@TQJADE TQJADE requested a review from dongjoon-hyun April 23, 2026 16:32
@dongjoon-hyun
Copy link
Copy Markdown
Member

dongjoon-hyun commented Apr 24, 2026

Could you check the CI failures because it fails 3 times consistently in our CI? Does it pass locally?

Screenshot 2026-04-24 at 15 40 59

@TQJADE
Copy link
Copy Markdown
Contributor Author

TQJADE commented Apr 25, 2026

Could you check the CI failures because it fails 3 times consistently in our CI? Does it pass locally?

Screenshot 2026-04-24 at 15 40 59

Fix by commit: 4bfbb74

Copy link
Copy Markdown
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if you verify helm upgrade manually, too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants