Remove clean command and automate cleanup#387
Open
sisuresh wants to merge 3 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes the CLI clean command and replaces it with an automated “orphan sweep” that runs at mission startup to reap Kubernetes resources (and certain Helm releases) older than a fixed threshold, reducing the risk of concurrent runs destroying each other’s in-flight resources.
Changes:
- Added
StellarOrphanSweepand invoked it from mission startup to delete resources older than 7 days in the target namespace. - Removed the
cleanCLI verb and the supportingCleanNamespace/AddAllnamespace-wide cleanup plumbing. - Centralized external command execution into
ScriptUtils.RunShellCommandand reused it in PCv2 Helm workflows.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/FSLibrary/StellarOrphanSweep.fs | New module to delete old K8s resources and helm-uninstall stale PCv2 releases. |
| src/FSLibrary/StellarNamespaceContent.fs | Removes AddAll() used by the retired namespace-wide “clean everything” path. |
| src/FSLibrary/StellarFormation.fs | Removes CleanNamespace() entrypoint used by the retired clean verb. |
| src/FSLibrary/ScriptUtils.fs | Adds shared RunShellCommand helper for running external commands (e.g. helm). |
| src/FSLibrary/MissionHistoryPubnetParallelCatchupV2.fs | Switches Helm execution to RunShellCommand. |
| src/FSLibrary/FSLibrary.fsproj | Adds compilation of StellarOrphanSweep.fs. |
| src/App/Program.fs | Removes clean verb and runs orphan sweep before missions start. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Set KUBECONFIG before sweep so its helm uninstall targets the same cluster as the F# k8s client (previously it could fall back to ~/.kube/config). - Pass mission.ApiRateLimit through to StellarOrphanSweep.sweep and sleep before each list/delete, matching how NamespaceContent.Cleanup paces its API calls.
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.
Resolves #337
Mission startup now reaps any Service/ConfigMap/StatefulSet/Ingress/Job/DaemonSet/Deployment (plus matching PCv2 Helm releases) older than 7 days in the target namespace, replacing the old clean verb and its eight Jenkinsfile invocations as the orphan-recovery mechanism.