fix: move MCPServer deletion check before validation and external API calls#4694
Closed
muratclk wants to merge 1 commit intostacklok:mainfrom
Closed
fix: move MCPServer deletion check before validation and external API calls#4694muratclk wants to merge 1 commit intostacklok:mainfrom
muratclk wants to merge 1 commit intostacklok:mainfrom
Conversation
… calls Move the deletion timestamp check and finalizer handling to run immediately after fetching the MCPServer resource, before any validation or external API calls. This prevents unnecessary work during deletion (group ref validation, CA bundle checks, tool/telemetry config fetches, image validation against registries) and ensures validation failures cannot block resource deletion. Fixes stacklok#4631 Co-Authored-By: Paperclip <noreply@paperclip.ing>
Collaborator
|
HI @muratclk this has been fixed now |
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.
Summary
Moves the
GetDeletionTimestamp()check and finalizer handling to run immediately after fetching the MCPServer resource, before any validation or external API calls.Fixes #4631
Problem
The MCPServer
Reconcilemethod performed 10+ operations including external API calls before checking if the resource was marked for deletion:handleRestartAnnotationvalidateGroupRef— fetches MCPGroupvalidateCABundleRef— validates CA bundlesvalidateStdioReplicaCap/validateSessionStorageForReplicasvalidateAndUpdatePodTemplateStatushandleToolConfig— fetches MCPToolConfighandleTelemetryConfig— fetches MCPTelemetryConfighandleExternalAuthConfig— fetches MCPExternalAuthConfighandleOIDCConfig— fetches MCPOIDCConfigThis caused unnecessary work during deletion and, critically, validation failures could block deletion entirely.
Fix
Reordered the reconciliation flow to:
The deletion check and finalizer logic now run right after the initial resource fetch, so none of the validation or external API calls are executed for resources being deleted.
Test plan