-
Notifications
You must be signed in to change notification settings - Fork 707
Add hosting integration for Azure Container Registry #9059
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
Conversation
aec9cd9 to
3a9fcb1
Compare
src/Aspire.Hosting.Azure.ContainerRegistry/AzureContainerRegistryExtensions.cs
Show resolved
Hide resolved
src/Aspire.Hosting.Azure.ContainerRegistry/AzureContainerRegistryExtensions.cs
Show resolved
Hide resolved
af22d03 to
32d4cc8
Compare
* Add hosting integration for Azure Container Registry * Revert IComputeResource changes * Add support for WithRoleAssignments * Only add ACR resource during publish mode
| ContainerRegistryInfo = caes.FirstOrDefault(), | ||
| ComputeEnvironment = environment as IComputeEnvironmentResource // will be null if azd | ||
| ContainerRegistry = caes.FirstOrDefault(), | ||
| ComputeEnvironment = environment as IComputeEnvironmentResource |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the removal of the comment?
| // Capture information about the container registry used by the | ||
| // container app environment in the deployment target information | ||
| // associated with each compute resource that needs an image | ||
| #pragma warning disable ASPIRECOMPUTE001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can go away now that we are suppressing on the whole file.
| <PropertyGroup> | ||
| <TargetFramework>$(DefaultTargetFramework)</TargetFramework> | ||
| <IsPackable>true</IsPackable> | ||
| <PackageTags>aspire integration hosting azure containerregistry</PackageTags> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be
container registry or containerregistry?
https://www.nuget.org/packages/Azure.Containers.ContainerRegistry has them split apart.
| /// Initializes a new instance of the <see cref="ContainerRegistryReferenceAnnotation"/> class. | ||
| /// </remarks> | ||
| /// <param name="registry">The container registry resource.</param> | ||
| public class ContainerRegistryReferenceAnnotation(IContainerRegistry registry) : IResourceAnnotation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be in the same place IContainerRegistry is defined? (i.e. Aspire.Hosting)
| /// <summary> | ||
| /// The endpoint of the Azure Container Registry. | ||
| /// </summary> | ||
| public BicepOutputReference RegistryEndpoint => new("loginServer", this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really want the bicep output to be named loginServer?
| /// Represents an Azure Container Registry resource. | ||
| /// </summary> | ||
| public class AzureContainerRegistryResource(string name, Action<AzureResourceInfrastructure> configureInfrastructure) | ||
| : AzureProvisioningResource(name, configureInfrastructure), IContainerRegistry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want IResourceWithConnectionString?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to avoid this until we had the chance to figure out what it means to WithReference a container registry from a non-environment resource. Does IResourceWithConnectionString influence anything else outside of references?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree we should avoid it for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should remove the WithRoleAssignments API then? I don't think there is a scenario for it if we aren't allowing references to the container registry.
| /// <summary> | ||
| /// The name of the Azure Container Registry. | ||
| /// </summary> | ||
| public BicepOutputReference RegistryName => new("name", this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these need to be prefixed with Registry?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought so otherwise it would conflict with the Name property on Resource.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NameOutputReference is what we call it for keyvault.
Description
This PR introduces first-class Azure Container Registry (ACR) support to Aspire. You can now provision a new registry or wire up an existing one and have it automatically injected into every compute resource by linking it to a compute environment via the
WithAzureContainerRegistryAPI.Part of #9005
Checklist
<remarks />and<code />elements on your triple slash comments?