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 Stacks API for Flex Consumption SKU #4104

Merged
merged 2 commits into from
May 10, 2024
Merged

Use Stacks API for Flex Consumption SKU #4104

merged 2 commits into from
May 10, 2024

Conversation

nturinski
Copy link
Member

There are some different requirements for the stack API when acquiring the runtimes

  1. Location is required as part of the endpoint URL. Due to this constraint, I moved the location step to be before the stacks step
  2. Stack is a required query parameter which is why I have the for loop of stacks
  3. If the stack has the Sku array under its LinuxRuntimeSettings, than it is flex compatible. All other runtimes have Sku as null.

@nturinski nturinski requested a review from a team as a code owner April 25, 2024 17:28
const getFlexStack = async (stack: string) => {
const result: AzExtPipelineResponse = await client.sendRequest(createPipelineRequest({
method: 'GET',
url: requestUtils.createRequestUrl(`providers/Microsoft.Web/locations/${location.name}/functionAppStacks`, {
Copy link
Member

Choose a reason for hiding this comment

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

so flex stacks are location dependent? That's crazy

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I can see it being helpful for this team since they have to deploy skus to regions individually (it seems like).

alexweininger
alexweininger previously approved these changes Apr 25, 2024

// TODO: Because we don't have the stack API, assume no stack means it's a flex app
context.site = stack ? await this.createFunctionApp(context, rgName, siteName, stack) : await this.createFlexFunctionApp(context, rgName, siteName);
context.site = !flexSku ?
Copy link
Member

Choose a reason for hiding this comment

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

I prefer avoiding negating this and flipping the ternary around.

Comment on lines 240 to +242
url: `https://management.azure.com/subscriptions/${context.subscriptionId}/resourceGroups/${rgName}/providers/Microsoft.Web/sites/${siteName}?api-version=2023-12-01`,
method: 'PUT',
body: JSON.stringify(await this.getNewFlexSite(context)) as unknown as RequestBodyType,
body: JSON.stringify(await this.getNewFlexSite(context, sku)) as unknown as RequestBodyType,
Copy link
Member

Choose a reason for hiding this comment

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

not for this PR, but this will eventually need to support sovereign clouds with different request urls

@nturinski nturinski merged commit 1884b23 into main May 10, 2024
1 of 2 checks passed
@nturinski nturinski deleted the nat/flexStackApi branch May 10, 2024 19:42
@nturinski nturinski added this to the 1.15.0 milestone May 21, 2024
@microsoft microsoft locked and limited conversation to collaborators Jun 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants