Skip to content

Move MCPServer deletion check before validation and external API calls#4650

Open
qorexdev wants to merge 1 commit intostacklok:mainfrom
qorexdev:fix/deletion-check-order
Open

Move MCPServer deletion check before validation and external API calls#4650
qorexdev wants to merge 1 commit intostacklok:mainfrom
qorexdev:fix/deletion-check-order

Conversation

@qorexdev
Copy link
Copy Markdown
Contributor

@qorexdev qorexdev commented Apr 7, 2026

Summary

During deletion the MCPServer reconciler runs 10+ validation steps including external API calls (image validation, config fetches, group validation) before checking GetDeletionTimestamp(). This means validation failures can block deletion entirely and unnecessary work slows down garbage collection.

Moved the deletion timestamp check and finalizer logic right after fetching the resource, before any validation or config handling. The new flow is: fetch → check deletion → add finalizer → validate → reconcile.

Fixes #4631

Type of change

  • Bug fix

Test plan

  • Unit tests (task test)
  • Linting (task lint-fix)

No Go toolchain on this machine, relying on CI. The change is a pure code move with no logic modifications.

Does this introduce a user-facing change?

No

During deletion the controller was running 10+ validation steps and external
API calls before checking GetDeletionTimestamp(). This meant validation
failures could block deletion entirely and unnecessary work was done.

Moved the deletion timestamp check and finalizer logic right after fetching
the MCPServer resource, before any validation or config handling.

Closes stacklok#4631
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.

Move MCPServer deletion check before validation and external API calls

1 participant