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

Generate ACA app infrastructure #2965

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

davidfowl
Copy link
Member

@davidfowl davidfowl commented Mar 17, 2024

Making progress on Azure/azure-dev#3292

Microsoft Reviewers: Open in CodeFlow

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-codeflow for labeling automated codeflow. intentionally a different color! label Mar 17, 2024
var resourceToken = uniqueString(resourceGroup().id)

resource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2022-10-01' = {
name: 'law-${resourceToken}'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For these "global" resources I wonder if we need some concept of the app name which we can then use when generating these resource names.

// REVIEW: Is this correct?
var anyHttp2 = http.Any(e => e.Transport == "http2") || https.Any(e => e.Transport == "http2");
var external = http.Any(e => e.IsExternal) || https.Any(e => e.IsExternal);
var containerPort = resource is ProjectResource ? 8080 : 80;
Copy link
Member

@DamianEdwards DamianEdwards Mar 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts on how we'd support <ContainerPort>? https://learn.microsoft.com/en-us/dotnet/core/docker/publish-as-container?pivots=dotnet-8-0#containerport

Is that something AZD will need to check for when it runs MSBuild or should our targets be injecting that value in to the assembly so we can get at it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this will need some thought. It can either be passed into the app or declared on the endpoint (which is probably cleaner but duplicative).

// ACA can't handle > 5 additional ports so throw if that's the case here
if (endpointsByContainerPort.Count > 5)
{
throw new NotSupportedException("More than 5 additional ports are not supported. See https://learn.microsoft.com/en-us/azure/container-apps/ingress-overview#tcp for more details.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
throw new NotSupportedException("More than 5 additional ports are not supported. See https://learn.microsoft.com/en-us/azure/container-apps/ingress-overview#tcp for more details.");
throw new NotSupportedException("More than 5 additional ports are not supported. See https://learn.microsoft.com/azure/container-apps/ingress-overview#tcp for more details.");

}

// Add additional ports
// https://learn.microsoft.com/en-us/azure/container-apps/ingress-how-to?pivots=azure-cli#use-additional-tcp-ports
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// https://learn.microsoft.com/en-us/azure/container-apps/ingress-how-to?pivots=azure-cli#use-additional-tcp-ports
// https://learn.microsoft.com/azure/container-apps/ingress-how-to?pivots=azure-cli#use-additional-tcp-ports

@davidfowl davidfowl force-pushed the davidfowl/gen-compute-infra branch 2 times, most recently from 1f2a174 to bcd43f6 Compare March 24, 2024 04:52
if (executionContext.IsPublishMode)
{
// TODO: Let the user pick what this is, for now just hard code azure container apps
await new AzureContainerAppsInfastructure(executionContext).GenerateAdditionalInfrastructureAsync(appModel, cancellationToken).ConfigureAwait(false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking that we'll want a model where we can choose per app/resource. This is fine for a x.1 release though. Just pointing to the horizon from here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need to enable that for functions, for sure, but that can't be the default mode.

@@ -9,6 +9,9 @@ param keyVaultName string
@description('')
param principalId string

@description('')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to regen your manifests after my merge of #3135

@davidfowl davidfowl force-pushed the davidfowl/gen-compute-infra branch 2 times, most recently from e54bb3b to 54b2c7c Compare March 31, 2024 04:51
@davidfowl davidfowl force-pushed the davidfowl/gen-compute-infra branch from 6c8ebbd to cdae1db Compare April 6, 2024 22:42
Regen manifest

Prep for multiple tcp ports

PR feedback

Rules?

Fixes

Moar fixes

Made the endpoint mapping more robust
- Added container app context that has a reference to all of the processing contexts. It will handle caching processing contexts.
- Resovle host and port based on endpoint mappings

Fix bug with additional mapping

Move everything to the contexts
- Rename ProcessingContext to ContainerAppContext. Make everything private

Fixed the formatting

More gen

Better formatting

Full bicep gen

Better parameter names

More gen

Updates

Fix formatting

Pick the first one

Don't throw if there are more than 5 additional endpoints

Do port allocation in the bicep generation

Fixes

Order by group index.

Fix and skip a test

Fixed test

Added target port resolution

Fix AI resource

Fixed AppInsights issues, deleted old files
@davidfowl davidfowl force-pushed the davidfowl/gen-compute-infra branch from 9298ebb to 39c458c Compare May 4, 2024 05:59
- Bring to parity with azd logic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-codeflow for labeling automated codeflow. intentionally a different color!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants