Skip to content

fix: deletion defects and resource orphans - #17

Merged
Herbaert merged 17 commits into
mainfrom
fix/deletion-defects
Sep 16, 2026
Merged

Herbaert merged 17 commits into
mainfrom
fix/deletion-defects

Conversation

@Herbaert

@Herbaert Herbaert commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes deletion defects in the cluster and machine reconcilers where deletion could
hang and leave STACKIT resources orphaned.

Fixes #8

Changes

  • StackitCluster keeps its finalizer and requeues while Machines for the
    cluster still exist, so those machines can still resolve credentials and delete
    their servers. The cluster reconciler's RBAC gains get;list;watch on machines.
  • StackitMachine deletion resolves the server by tags when
    status.instanceID is empty, instead of treating an empty status as proof that
    no VM exists.
  • Finalizers are persisted before the first cloud call, so a crash in between
    cannot leave a running server or load balancer behind an object that carries no
    finalizer to clean it up.
  • StackitMachine deletion finalizes with a CleanupSkipped warning event
    when the credentials Secret is gone, matching what the cluster reconciler
    already does.
  • The StackitClusterStackitMachine watch resolves the owning Cluster
    before matching Machine.spec.clusterName, and label-selects server-side.
    Matching against the StackitCluster name breaks for ClusterClass-generated
    infrastructure refs, where the two names always differ.
  • Invalid credentials requeue after one minute, so a corrected Secret takes
    effect without another event.
  • Reconciler-internal variables renamed for readability (no behavior change); the
    README compatibility table corrected to the v1beta2 contract, which is what
    metadata.yaml, the CRD labels and every import already declare.

Notes

  • Breaking changes: none. No API or CRD changes. RBAC gains read access to
    machines.
  • Migration: none.
  • Tests: an envtest regression test was added for each fix, and every one was
    verified to fail when its fix is reverted. go build ./..., go test ./... and
    golangci-lint run ./... pass; make manifests produces no diff. The e2e suite
    was not run.

@Herbaert
Herbaert requested a review from tuunit August 20, 2026 11:05
@Herbaert Herbaert self-assigned this Aug 20, 2026
@Herbaert Herbaert added the bug Something isn't working label Aug 20, 2026
@tuunit tuunit changed the title Fix/deletion defects fix: deletion defects and resource orphans Aug 20, 2026
Comment thread controller/controller_test_helpers_test.go
Comment thread cmd/manager/main.go Outdated
Comment thread cmd/manager/main.go Outdated
Comment thread controller/constants.go Outdated
Comment thread controller/controller_test_helpers_test.go Outdated
Comment thread controller/stackitcluster_bastion.go
Comment thread controller/stackitcluster_controller.go Outdated
Comment thread controller/stackitcluster_controller_test.go Outdated
Comment thread controller/stackitcluster_infrastructure.go
Comment thread controller/stackitmachine_controller.go Outdated
Comment thread controller/stackitmachine_infrastructure.go Outdated
Comment thread cloud/fake/client.go Outdated
Comment thread cmd/manager/main.go Outdated
Comment thread cmd/manager/main.go Outdated
Comment thread cmd/manager/main_test.go Outdated
Comment thread controller/stackitcluster_controller.go Outdated
Comment thread controller/stackitcluster_controller.go Outdated
Comment thread controller/stackitcluster_controller.go Outdated
@tuunit
tuunit force-pushed the fix/deletion-defects branch from 6fab208 to 5524458 Compare September 15, 2026 08:45
tuunit
tuunit previously approved these changes Sep 15, 2026
@tuunit

tuunit commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

LGTM feel free to merge :)

@Herbaert
Herbaert merged commit a644f1a into main Sep 16, 2026
2 checks passed
@Herbaert
Herbaert deleted the fix/deletion-defects branch September 16, 2026 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Guard Machine deletion / orphans on Cluster level

2 participants