Skip to content

Commit

Permalink
chore: Add scale to service and webapi so (#1321)
Browse files Browse the repository at this point in the history
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Introduced dynamic scaling capabilities for Azure applications based
on CPU and memory utilization metrics.
- Added new parameters to enhance scaling configurations for both
container and web API applications.

These updates improve resource management and application performance
during varying load conditions.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
MagnusSandgren authored Oct 18, 2024
1 parent c3e8e8c commit f213d3d
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .azure/applications/service/main.bicep
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
targetScope = 'resourceGroup'

import { Scale } from '../../modules/containerApp/main.bicep'

@description('The tag of the image to be used')
@minLength(3)
param imageTag string
Expand Down Expand Up @@ -40,6 +42,34 @@ param appConfigurationName string
@minLength(3)
param environmentKeyVaultName string

@description('The scaling configuration for the container app')
param scale Scale = {
minReplicas: 2
maxReplicas: 10
rules: [
{
name: 'cpu'
custom: {
type: 'cpu'
metadata: {
type: 'Utilization'
value: '70'
}
}
}
{
name: 'memory'
custom: {
type: 'memory'
metadata: {
type: 'Utilization'
value: '70'
}
}
}
]
}

var namePrefix = 'dp-be-${environment}'
var baseImageUrl = 'ghcr.io/digdir/dialogporten-'
var tags = {
Expand Down Expand Up @@ -166,6 +196,7 @@ module containerApp '../../modules/containerApp/main.bicep' = {
port: port
revisionSuffix: revisionSuffix
userAssignedIdentityId: managedIdentity.id
scale: scale
// TODO: Once all container apps use user-assigned identities, remove this comment and ensure userAssignedIdentityId is always provided
}
dependsOn: [
Expand Down
31 changes: 31 additions & 0 deletions .azure/applications/web-api-so/main.bicep
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
targetScope = 'resourceGroup'

import { Scale } from '../../modules/containerApp/main.bicep'

@description('The tag of the image to be used')
@minLength(3)
param imageTag string
Expand Down Expand Up @@ -43,6 +45,34 @@ param appConfigurationName string
@secure()
param environmentKeyVaultName string

@description('The scaling configuration for the container app')
param scale Scale = {
minReplicas: 2
maxReplicas: 10
rules: [
{
name: 'cpu'
custom: {
type: 'cpu'
metadata: {
type: 'Utilization'
value: '70'
}
}
}
{
name: 'memory'
custom: {
type: 'memory'
metadata: {
type: 'Utilization'
value: '70'
}
}
}
]
}

var namePrefix = 'dp-be-${environment}'
var baseImageUrl = 'ghcr.io/digdir/dialogporten-'
var tags = {
Expand Down Expand Up @@ -129,6 +159,7 @@ module containerApp '../../modules/containerApp/main.bicep' = {
probes: probes
port: port
revisionSuffix: revisionSuffix
scale: scale
}
}

Expand Down

0 comments on commit f213d3d

Please sign in to comment.