fix(bundler): clean up orphaned KAI and Kubeflow Trainer CRDs on undeploy#416
Merged
yuanchen8911 merged 2 commits intoNVIDIA:mainfrom Mar 16, 2026
Merged
Conversation
701bf14 to
5a48c98
Compare
mchmarny
reviewed
Mar 16, 2026
Member
mchmarny
left a comment
There was a problem hiding this comment.
Good fix — the orphaned CRD problem is real and the API group matching approach is the right design. Two inline comments: one on CRD deletion ordering relative to namespace teardown, one on grep precision. Clean change overall.
mchmarny
requested changes
Mar 16, 2026
Member
mchmarny
left a comment
There was a problem hiding this comment.
The CRD deletion ordering is the only real thing
…ploy KAI scheduler CRDs (configs, schedulingshards, topologies) are created by the KAI operator at runtime, not by the Helm chart. Kubeflow Trainer CRDs are installed by the validator during conformance/performance tests. Neither carries Helm labels, so the existing label-based CRD sweep in delete_release_cluster_resources misses them. - Add explicit CRD cleanup before namespace deletion (while controllers still run) with --wait=false to avoid finalizer hangs - Anchor grep patterns with $ to prevent false matches - Add orphaned CRD detection in undeploy post-flight verification - Add orphaned CRD warning in deploy pre-flight checks Signed-off-by: Yuan Chen <yuanchen97@gmail.com>
5a48c98 to
849a6f0
Compare
Contributor
Author
|
Thanks Mark — both addressed:
|
mchmarny
approved these changes
Mar 16, 2026
xdu31
pushed a commit
to xdu31/aicr
that referenced
this pull request
Mar 24, 2026
…ploy (NVIDIA#416) Signed-off-by: Yuan Chen <yuanchen97@gmail.com> Co-authored-by: Mark Chmarny <mchmarny@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix undeploy.sh to clean up orphaned CRDs from KAI scheduler and Kubeflow Trainer that survive Helm uninstall.
Motivation / Context
After
undeploy.shcompletes, 6 orphaned CRDs remain on the cluster:configs.kai.scheduler,schedulingshards.kai.scheduler,topologies.kai.scheduler— created by the KAI operator at runtime, not by the Helm charttrainjobs.trainer.kubeflow.org,trainingruntimes.trainer.kubeflow.org,clustertrainingruntimes.trainer.kubeflow.org— installed by the validator during conformance/performance testsNeither set carries Helm labels, so the existing
delete_release_cluster_resourceslabel-based sweep misses them.Fixes: N/A
Related: N/A
Type of Change
Component(s) Affected
pkg/bundler,pkg/component/*)Implementation Notes
undeploy.sh.tmplafter namespace deletion, targetingkai.schedulerandtrainer.kubeflow.orgAPI groupsTesting
Verified generated undeploy.sh includes the new cleanup steps.
Risk Assessment
Rollout notes: Existing bundles won't have the fix — only newly generated bundles. Users with stale CRDs can manually delete them with
kubectl delete crd <name>.Checklist
make testwith-race)make lint)git commit -S)