Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use BeforeResourceStartedEvent instead of AfterEndpointsAllocatedEvent when scheduling setup before resource creation #7243

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

danegsta
Copy link
Member

Description

We're using the AfterEndpointsAllocatedEvent in several places as a callback to do setup before resources are created. While it's true that historically AfterEndpointsAllocatedEvent has always been triggered before resources are created, that's mainly due to a limitation in the endpoints model (we don't currently support dynamically allocated host ports for un-proxied container endpoints).

The appropriate event to schedule additional model configuration before a resource is created is BeforeResourceStartedEvent which is sent just before the resource is created.

Fixes # (issue)

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

…t when scheduling setup before resource creation
@danegsta danegsta requested a review from davidfowl January 25, 2025 01:24
@danegsta
Copy link
Member Author

/AzurePipelines run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@davidfowl
Copy link
Member

I don't think this works because the UI is a singleton that works with all of the target resources of that type.

@JamesNK
Copy link
Member

JamesNK commented Jan 25, 2025

BeforeResourceStartedEvent is now called when a resource is restarted. Keep in mind for whether this is a good change.

@danegsta
Copy link
Member Author

BeforeResourceStartedEvent is now called when a resource is restarted. Keep in mind for whether this is a good change.

That depends on whether its consistently fired before the resource is created in the orchestrator. If so, it shouldn't cause any issues with these changes, we'd just do another pass of setup housekeeping before the new container gets created.

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.

3 participants