Repository navigation
Support orphan cleanup in the Kubernetes backend - #4455
Merged
Merged
Conversation
…es_orphan_cleanup # Conflicts: # src/dstack/_internal/core/backends/kubernetes/compute.py
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.
Adds orphan cleanup support to the
kubernetesbackend, part of #3453.k8s.dstack.ai/provider-ref.list_resource_groups()lists labeled pods, services, and secrets in each cluster's namespace and groups them by job pod (app.kubernetes.io/instance), so each provisioning attempt is a separate group. Finished pods are listed, while pods being deleted are skipped and their services and secrets are listed without them.delete_resource_group()deletes the pod and the service and secret named after it, liketerminate_instance(), in one step.liston services and secrets. If listing them is forbidden, the cleanup logs a warning and skips them instead of failing the cluster: pods still delete their services and secrets by name, and only those left without pods are missed. The docs note thatliston secrets exposes all secrets in the namespace, andORPHAN-CLEANUP.mddocuments the exception.list_all_objects()helper, which raises instead of returning a partial list after 1000 pages.kubernetes/features/resource_groups.py, and the label and object naming helpers it shares withcompute.pymoved toresources.py.