Skip to content

Remove clean command and automate cleanup#387

Open
sisuresh wants to merge 3 commits into
stellar:mainfrom
sisuresh:clean
Open

Remove clean command and automate cleanup#387
sisuresh wants to merge 3 commits into
stellar:mainfrom
sisuresh:clean

Conversation

@sisuresh
Copy link
Copy Markdown
Contributor

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.

Copilot AI review requested due to automatic review settings May 12, 2026 01:14
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 StellarOrphanSweep and invoked it from mission startup to delete resources older than 7 days in the target namespace.
  • Removed the clean CLI verb and the supporting CleanNamespace/AddAll namespace-wide cleanup plumbing.
  • Centralized external command execution into ScriptUtils.RunShellCommand and 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.

Comment thread src/FSLibrary/ScriptUtils.fs
Comment thread src/App/Program.fs
Comment thread src/FSLibrary/StellarOrphanSweep.fs Outdated
Comment thread src/FSLibrary/StellarOrphanSweep.fs
- 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.
@sisuresh sisuresh requested review from jacekn and jayz22 May 12, 2026 16:26
Copy link
Copy Markdown
Contributor

@jacekn jacekn left a comment

Choose a reason for hiding this comment

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

Great idea to make this improvement!
I'll let @jayz22 review the code more closely but it's fine from my perspective.

@sisuresh sisuresh requested a review from bboston7 May 12, 2026 21:57
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.

Clean command improvements

3 participants