Repository navigation
Conversation
…rceClaim delete The ResourceClaim delete handler referenced the local variable service_access_config instead of the serviceaccessconfig module, which raised UnboundLocalError and left the ServiceAccessConfig to be removed later by its own 60s timer. Import the module inside the handler to avoid a circular import with serviceaccessconfig. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Problem
When a shared ResourceClaim is deleted, service-access-manager's delete handler (
resourceclaim.py) crashes:It references the local variable
service_access_config, which this same statement is assigning, instead of theserviceaccessconfigmodule. The module also wasn't imported. This raisesUnboundLocalError, which theexcept k8sApiExceptiondoesn't catch.Impact
Low. The ServiceAccessConfig's own 60s timer notices the ResourceClaim is gone and deletes itself, along with its Role, RoleBinding and ServiceAccess objects. In practice the bug causes:
Fix
Use
serviceaccessconfig.ServiceAccessConfig.fetch(...), importing the module inside the handler.The import has to be inside the function, not at the top of the file.
operator.pyimportsresourceclaimfirst, andserviceaccessconfigdoesfrom resourceclaim import ResourceClaim. A top-level import would fail at startup with a circularImportError. I checked both variants by importing the modules inoperator.py's order with stubbed dependencies: the function-level import loads cleanly, and the top-level one fails.Testing
🤖 Generated with Claude Code