Skip to content

feat: handle CRD lifecycle in helm backend chart#591

Open
alokkumardalei-wq wants to merge 1 commit into
kbind-dev:mainfrom
alokkumardalei-wq:feature/crd-lifecycle-404
Open

feat: handle CRD lifecycle in helm backend chart#591
alokkumardalei-wq wants to merge 1 commit into
kbind-dev:mainfrom
alokkumardalei-wq:feature/crd-lifecycle-404

Conversation

@alokkumardalei-wq

@alokkumardalei-wq alokkumardalei-wq commented Jul 14, 2026

Copy link
Copy Markdown

Description

Fixes #404.

Currently, CRDs are placed in the crds/ folder of the backend chart, meaning they are only applied on helm install and ignored during helm upgrade. This PR shifts CRDs to the templates/ folder to enable a proper lifecycle and allow users to upgrade CRDs seamlessly alongside backend updates.

Changes:

  • Moved generated CRDs from crds/ to templates/crds/.
  • Wrapped CRDs with a {{- if .Values.crds.install }} Helm conditional.
  • Set crds.install: true as the default in values.yaml.
  • Updated hack/update-codegen.sh to automatically wrap generated CRD outputs with these conditionals for future development.

Warning

Because CRDs are now managed as standard templates, running helm uninstall on this chart will delete the CRDs and subsequently delete all instances of those Custom Resources in the cluster.

Testing & Verification:

  • Generated new CRDs via hack/update-codegen.sh and verified the correct output paths and template bindings.
alokkumardalei@Aloks-MacBook-Air kbind % make codegen
go mod download
./hack/update-codegen.sh
Applying kube-bind.io_apiconversions.yaml-patch
Applying kube-bind.io_apiservicebindings.yaml-patch
Applying kube-bind.io_apiserviceexportrequests.yaml-patch
Applying kube-bind.io_apiserviceexports.yaml-patch
Applying kube-bind.io_apiservicenamespaces.yaml-patch
Applying kube-bind.io_boundschemas.yaml-patch
Applying kube-bind.io_clusterbindings.yaml-patch
./hack/update-kcp-codegen.sh
INFO[0000] Loading CustomResourceDefinitions from deploy/crd  logger=apigen
INFO[0000] Loaded CustomResourceDefinition for apiconversions.kube-bind.io from deploy/crd/kube-bind.io_apiconversions.yaml  logger=apigen
INFO[0000] Loaded CustomResourceDefinition for apiservicebindingbundles.kube-bind.io from deploy/crd/kube-bind.io_apiservicebindingbundles.yaml  logger=apigen
INFO[0000] Loaded CustomResourceDefinition for apiservicebindings.kube-bind.io from deploy/crd/kube-bind.io_apiservicebindings.yaml  logger=apigen
INFO[0000] Loaded CustomResourceDefinition for apiserviceexportrequests.kube-bind.io from deploy/crd/kube-bind.io_apiserviceexportrequests.yaml  logger=apigen
INFO[0000] Loaded CustomResourceDefinition for apiserviceexports.kube-bind.io from deploy/crd/kube-bind.io_apiserviceexports.yaml  logger=apigen
INFO[0000] Loaded CustomResourceDefinition for apiserviceexporttemplates.kube-bind.io from deploy/crd/kube-bind.io_apiserviceexporttemplates.yaml  logger=apigen
INFO[0000] Loaded CustomResourceDefinition for apiservicenamespaces.kube-bind.io from deploy/crd/kube-bind.io_apiservicenamespaces.yaml  logger=apigen
INFO[0000] Loaded CustomResourceDefinition for bindableresourcesrequests.kube-bind.io from deploy/crd/kube-bind.io_bindableresourcesrequests.yaml  logger=apigen
INFO[0000] Loaded CustomResourceDefinition for boundschemas.kube-bind.io from deploy/crd/kube-bind.io_boundschemas.yaml  logger=apigen
INFO[0000] Loaded CustomResourceDefinition for clusterbindings.kube-bind.io from deploy/crd/kube-bind.io_clusterbindings.yaml  logger=apigen
INFO[0000] Loaded CustomResourceDefinition for clusters.kube-bind.io from deploy/crd/kube-bind.io_clusters.yaml  logger=apigen
INFO[0000] Loaded CustomResourceDefinition for collections.kube-bind.io from deploy/crd/kube-bind.io_collections.yaml  logger=apigen
INFO[0000] Loaded 12 CustomResourceDefinitions           logger=apigen
INFO[0000] Loading APIResourceSchemas from contrib/kcp/deploy/resources  logger=apigen
INFO[0000] Loaded APIResourceSchema for apiconversions.kube-bind.io from contrib/kcp/deploy/resources/apiresourceschema-apiconversions.kube-bind.io.yaml  logger=apigen
INFO[0000] Loaded APIResourceSchema for apiservicebindingbundles.kube-bind.io from contrib/kcp/deploy/resources/apiresourceschema-apiservicebindingbundles.kube-bind.io.yaml  logger=apigen
INFO[0000] Loaded APIResourceSchema for apiservicebindings.kube-bind.io from contrib/kcp/deploy/resources/apiresourceschema-apiservicebindings.kube-bind.io.yaml  logger=apigen
INFO[0000] Loaded APIResourceSchema for apiserviceexportrequests.kube-bind.io from contrib/kcp/deploy/resources/apiresourceschema-apiserviceexportrequests.kube-bind.io.yaml  logger=apigen
INFO[0000] Loaded APIResourceSchema for apiserviceexports.kube-bind.io from contrib/kcp/deploy/resources/apiresourceschema-apiserviceexports.kube-bind.io.yaml  logger=apigen
INFO[0000] Loaded APIResourceSchema for apiserviceexporttemplates.kube-bind.io from contrib/kcp/deploy/resources/apiresourceschema-apiserviceexporttemplates.kube-bind.io.yaml  logger=apigen
INFO[0000] Loaded APIResourceSchema for apiservicenamespaces.kube-bind.io from contrib/kcp/deploy/resources/apiresourceschema-apiservicenamespaces.kube-bind.io.yaml  logger=apigen
INFO[0000] Loaded APIResourceSchema for bindableresourcesrequests.kube-bind.io from contrib/kcp/deploy/resources/apiresourceschema-bindableresourcesrequests.kube-bind.io.yaml  logger=apigen
INFO[0000] Loaded APIResourceSchema for boundschemas.kube-bind.io from contrib/kcp/deploy/resources/apiresourceschema-boundschemas.kube-bind.io.yaml  logger=apigen
INFO[0000] Loaded APIResourceSchema for clusterbindings.kube-bind.io from contrib/kcp/deploy/resources/apiresourceschema-clusterbindings.kube-bind.io.yaml  logger=apigen
INFO[0000] Loaded APIResourceSchema for clusters.kube-bind.io from contrib/kcp/deploy/resources/apiresourceschema-clusters.kube-bind.io.yaml  logger=apigen
INFO[0000] Loaded APIResourceSchema for collections.kube-bind.io from contrib/kcp/deploy/resources/apiresourceschema-collections.kube-bind.io.yaml  logger=apigen
INFO[0000] Loaded 12 APIResourceSchemas                  logger=apigen
INFO[0000] Using previous APIResourceSchema for clusters.kube-bind.io, as no changes were detected.  logger=apigen
INFO[0000] Using previous APIResourceSchema for apiservicebindingbundles.kube-bind.io, as no changes were detected.  logger=apigen
INFO[0000] Using previous APIResourceSchema for apiserviceexports.kube-bind.io, as no changes were detected.  logger=apigen
INFO[0000] Using previous APIResourceSchema for apiserviceexporttemplates.kube-bind.io, as no changes were detected.  logger=apigen
INFO[0000] Using previous APIResourceSchema for clusterbindings.kube-bind.io, as no changes were detected.  logger=apigen
INFO[0000] Using previous APIResourceSchema for collections.kube-bind.io, as no changes were detected.  logger=apigen
INFO[0000] Using previous APIResourceSchema for apiconversions.kube-bind.io, as no changes were detected.  logger=apigen
INFO[0000] Using previous APIResourceSchema for apiservicebindings.kube-bind.io, as no changes were detected.  logger=apigen
INFO[0000] Using previous APIResourceSchema for apiservicenamespaces.kube-bind.io, as no changes were detected.  logger=apigen
INFO[0000] Using previous APIResourceSchema for apiserviceexportrequests.kube-bind.io, as no changes were detected.  logger=apigen
INFO[0000] Using previous APIResourceSchema for bindableresourcesrequests.kube-bind.io, as no changes were detected.  logger=apigen
INFO[0000] Using previous APIResourceSchema for boundschemas.kube-bind.io, as no changes were detected.  logger=apigen
INFO[0000] Writing 13 manifests to contrib/kcp/deploy/resources  logger=apigen
INFO[0000] Wrote APIExport kube-bind.io to contrib/kcp/deploy/resources/apiexport-kube-bind.io.yaml  logger=apigen
INFO[0000] Wrote APIResourceSchema clusters.kube-bind.io to contrib/kcp/deploy/resources/apiresourceschema-clusters.kube-bind.io.yaml  logger=apigen
INFO[0000] Wrote APIResourceSchema apiservicebindingbundles.kube-bind.io to contrib/kcp/deploy/resources/apiresourceschema-apiservicebindingbundles.kube-bind.io.yaml  logger=apigen
INFO[0000] Wrote APIResourceSchema collections.kube-bind.io to contrib/kcp/deploy/resources/apiresourceschema-collections.kube-bind.io.yaml  logger=apigen
INFO[0000] Wrote APIResourceSchema apiconversions.kube-bind.io to contrib/kcp/deploy/resources/apiresourceschema-apiconversions.kube-bind.io.yaml  logger=apigen
INFO[0000] Wrote APIResourceSchema apiservicenamespaces.kube-bind.io to contrib/kcp/deploy/resources/apiresourceschema-apiservicenamespaces.kube-bind.io.yaml  logger=apigen
INFO[0000] Wrote APIResourceSchema apiserviceexportrequests.kube-bind.io to contrib/kcp/deploy/resources/apiresourceschema-apiserviceexportrequests.kube-bind.io.yaml  logger=apigen
INFO[0000] Wrote APIResourceSchema bindableresourcesrequests.kube-bind.io to contrib/kcp/deploy/resources/apiresourceschema-bindableresourcesrequests.kube-bind.io.yaml  logger=apigen
INFO[0000] Wrote APIResourceSchema apiserviceexports.kube-bind.io to contrib/kcp/deploy/resources/apiresourceschema-apiserviceexports.kube-bind.io.yaml  logger=apigen
INFO[0000] Wrote APIResourceSchema apiserviceexporttemplates.kube-bind.io to contrib/kcp/deploy/resources/apiresourceschema-apiserviceexporttemplates.kube-bind.io.yaml  logger=apigen
INFO[0000] Wrote APIResourceSchema clusterbindings.kube-bind.io to contrib/kcp/deploy/resources/apiresourceschema-clusterbindings.kube-bind.io.yaml  logger=apigen
INFO[0000] Wrote APIResourceSchema apiservicebindings.kube-bind.io to contrib/kcp/deploy/resources/apiresourceschema-apiservicebindings.kube-bind.io.yaml  logger=apigen
INFO[0000] Wrote APIResourceSchema boundschemas.kube-bind.io to contrib/kcp/deploy/resources/apiresourceschema-boundschemas.kube-bind.io.yaml  logger=apigen
INFO[0000] Pruning output directory.                     logger=apigen
./hack/update-codegen-clients.sh
~/Desktop/kbind/kbind/sdk ~/Desktop/kbind/kbind
Generating deepcopy code for 3 targets
Generating client code for 2 targets
Generating lister code for 2 targets
Generating informer code for 2 targets
~/Desktop/kbind/kbind
/Library/Developer/CommandLineTools/usr/bin/make imports
hack/verify-go-versions.sh
Verifying minimum Go version: 1.26.2
Verifying build Go version: 1.26.2
  • Ran make helm-build-local successfully to ensure the chart parses and packages without syntax errors.
Building Helm charts (appVersion: 0.0.0-1a35a03, chartVersion: 0.0.0-1a35a03)...
Processing chart: backend
Successfully packaged chart and saved it to: bin/backend-0.0.0-1a35a03.tgz
Packaged: ./bin/backend-0.0.0-1a35a03.tgz
Helm charts built successfully in ./bin/

@cnvergence

Copy link
Copy Markdown
Member

hey @alokkumardalei-wq, need to fix CI, thanks!

Fixes kbind-dev#404 by moving CRDs to templates and guarding with crds.install flag.

Signed-off-by: alokkumardalei-wq <alokkumardalei2@gmail.com>
@alokkumardalei-wq
alokkumardalei-wq force-pushed the feature/crd-lifecycle-404 branch from c7a0716 to 1a35a03 Compare July 16, 2026 01:45
@mjudeikis

Copy link
Copy Markdown
Contributor

@alokkumardalei-wq let's take these PRs one by one, as it's a bit overwhelming when we have so many :) Most of these will need to be tested manually too. Do you have any local test evidence just to make sure everything works?

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.

feature: CRD lifecycle

3 participants