feat: add destroy functionality with auto-delete option for TerraformLayer#770
feat: add destroy functionality with auto-delete option for TerraformLayer#770nerdeveloper wants to merge 3 commits into
Conversation
|
please @AlanLonguet and @corrieriluca PTAL and review, lmk what you think |
|
Thanks @nerdeveloper obviously we've talked but this will be great for us, b/c we manage TerraformLayers via ArgoCD, so right now when they get deleted they leave resources around. This will make it so TerraformLayers can clean up after themselves! This will be fantastic! |
8393988 to
6eab121
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #770 +/- ##
==========================================
- Coverage 39.79% 38.55% -1.25%
==========================================
Files 94 95 +1
Lines 5465 5711 +246
==========================================
+ Hits 2175 2202 +27
- Misses 3093 3309 +216
- Partials 197 200 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Hi @nerdeveloper @bradenwright Thanks for the PR. This is an important feature and we understand your use-case. However, after internal discussion there are a few points we'd like to discuss with you:
Happy to help with the design and with wording for the feature flag and finalizer approach 😄 |
…Layer This PR adds destroy functionality to Burrito, similar to ArgoCD's delete behavior where deleting an Application can also delete the underlying Kubernetes resources. Features: - Add destroy-now annotation to trigger infrastructure destruction - Add deleteAfterDestroy option in RemediationStrategy to auto-delete TerraformLayer after successful destroy (similar to ArgoCD cascade delete) - Add autoDestroy option to control automatic destroy apply - Add new layer states: DestroyNeeded and DestroyApplyNeeded - Add runner actions: plan-destroy and apply-destroy - Update UI to show "Deleted" state with purple badge
…st-forward bug The go-git library's Pull() function has a known issue (padok-team#358) where it returns 'non-fast-forward update' errors even when a fast-forward merge is possible. This happens when local branches don't have proper upstream tracking configured. This commit replaces Pull() with an explicit Fetch() + Hard Reset approach: 1. Fetch latest changes from remote with Force=true 2. Get the remote reference for the target branch 3. Hard reset the worktree to the remote ref 4. Update the local branch reference This approach: - Avoids the go-git Pull() bug entirely - Is more explicit about what we want (always match remote) - Handles force-push scenarios correctly - Works regardless of tracking configuration Fixes: go-git/go-git#358
6eab121 to
aca2c99
Compare
Summary
This PR adds destroy functionality to Burrito, similar to ArgoCD's delete behavior where deleting an Application can also delete the underlying Kubernetes resources. With the
deleteAfterDestroyoption enabled, when infrastructure is destroyed, the TerraformLayer resource is automatically cleaned up - keeping the Burrito state in sync with the actual infrastructure state.Features
destroy-nowannotation (api.terraform.padok.cloud/destroy-now) to trigger infrastructure destructiondeleteAfterDestroyoption in RemediationStrategy to auto-delete TerraformLayer after successful destroy (similar to ArgoCD's cascade delete)autoDestroyoption to control whether destroy apply runs automaticallyDestroyNeededandDestroyApplyNeededplan-destroyandapply-destroyTest plan
deleteAfterDestroy: trueapi.terraform.padok.cloud/destroy-nowannotation