-
Notifications
You must be signed in to change notification settings - Fork 409
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Container-App - Add logic to disable ingress entirely (#2723)
## Description Adds the ability to completely disable ingress traffic for the container apps. Closes #2205 ## Pipeline Reference <!-- Insert your Pipeline Status Badge below --> | Pipeline | | -------- | | [](https://github.com/oZakari/bicep-registry-modules/actions/workflows/avm.res.app.container-app.yml) | ## Type of Change <!-- Use the checkboxes [x] on the options that are relevant. --> - [ ] Update to CI Environment or utilities (Non-module affecting changes) - [x] Azure Verified Module updates: - [ ] Bugfix containing backwards-compatible bug fixes, and I have NOT bumped the MAJOR or MINOR version in `version.json`: - [ ] Someone has opened a bug report issue, and I have included "Closes #{bug_report_issue_number}" in the PR description. - [ ] The bug was found by the module author, and no one has opened an issue to report it yet. - [x] Feature update backwards compatible feature updates, and I have bumped the MINOR version in `version.json`. - [ ] Breaking changes and I have bumped the MAJOR version in `version.json`. - [ ] Update to documentation ## Checklist - [x] I'm sure there are no other open Pull Requests for the same update/change - [x] I have run `Set-AVMModule` locally to generate the supporting module files. - [ ] My corresponding pipelines / checks run clean and green without any errors or warnings <!-- Please keep up to date with the contribution guide at https://aka.ms/avm/contribute/bicep --> --------- Co-authored-by: Alexander Sehr <[email protected]>
- Loading branch information
1 parent
59c21dc
commit c4f07b4
Showing
6 changed files
with
192 additions
and
29 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
14 changes: 14 additions & 0 deletions
14
avm/res/app/container-app/tests/e2e/disable-ingress/dependencies.bicep
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
@description('Required. The location to deploy resources to.') | ||
param location string = resourceGroup().location | ||
|
||
@description('Required. The name of the Managed Environment to create.') | ||
param managedEnvironmentName string | ||
|
||
resource managedEnvironment 'Microsoft.App/managedEnvironments@2023-05-01' = { | ||
name: managedEnvironmentName | ||
location: location | ||
properties: {} | ||
} | ||
|
||
@description('The resource ID of the created Managed Environment.') | ||
output managedEnvironmentResourceId string = managedEnvironment.id |
70 changes: 70 additions & 0 deletions
70
avm/res/app/container-app/tests/e2e/disable-ingress/main.test.bicep
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
targetScope = 'subscription' | ||
|
||
metadata name = 'Without ingress enabled' | ||
metadata description = 'This instance deploys the module with ingress traffic completely disabled.' | ||
|
||
// ========== // | ||
// Parameters // | ||
// ========== // | ||
|
||
@description('Optional. The name of the resource group to deploy for testing purposes.') | ||
@maxLength(90) | ||
param resourceGroupName string = 'dep-${namePrefix}-app.containerApps-${serviceShort}-rg' | ||
|
||
@description('Optional. The location to deploy resources to.') | ||
param resourceLocation string = deployment().location | ||
|
||
@description('Optional. A short identifier for the kind of deployment. Should be kept short to not run into resource-name length-constraints.') | ||
param serviceShort string = 'acapriv' | ||
|
||
@description('Optional. A token to inject into the name of each resource.') | ||
param namePrefix string = '#_namePrefix_#' | ||
|
||
// =========== // | ||
// Deployments // | ||
// =========== // | ||
|
||
// General resources | ||
// ================= | ||
resource resourceGroup 'Microsoft.Resources/resourceGroups@2023-07-01' = { | ||
name: resourceGroupName | ||
location: resourceLocation | ||
} | ||
|
||
module nestedDependencies 'dependencies.bicep' = { | ||
scope: resourceGroup | ||
name: '${uniqueString(deployment().name, resourceLocation)}-paramNested' | ||
params: { | ||
location: resourceLocation | ||
managedEnvironmentName: 'dep-${namePrefix}-menv-${serviceShort}' | ||
} | ||
} | ||
|
||
// ============== // | ||
// Test Execution // | ||
// ============== // | ||
|
||
@batchSize(1) | ||
module testDeployment '../../../main.bicep' = [ | ||
for iteration in ['init', 'idem']: { | ||
scope: resourceGroup | ||
name: '${uniqueString(deployment().name, resourceLocation)}-test-${serviceShort}-${iteration}' | ||
params: { | ||
name: '${namePrefix}${serviceShort}001' | ||
environmentId: nestedDependencies.outputs.managedEnvironmentResourceId | ||
location: resourceLocation | ||
disableIngress: true | ||
containers: [ | ||
{ | ||
name: 'simple-hello-world-container' | ||
image: 'mcr.microsoft.com/azuredocs/containerapps-helloworld:latest' | ||
resources: { | ||
// workaround as 'float' values are not supported in Bicep, yet the resource providers expects them. Related issue: https://github.com/Azure/bicep/issues/1386 | ||
cpu: json('0.25') | ||
memory: '0.5Gi' | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] |
This file contains 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