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

feat(applications): add scalers for cpu and memory #1295

Merged
merged 5 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .azure/applications/graphql/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,31 @@ var probes = [
}
]

var scale = {
minReplicas: 2
maxReplicas: 10
rules: [
{
custom: {
type: 'cpu'
metricType: 'Utilization'
metadata: {
value: '70'
}
}
}
{
custom: {
type: 'memory'
metricType: 'Utilization'
metadata: {
value: '70'
}
}
}
]
}

resource environmentKeyVaultResource 'Microsoft.KeyVault/vaults@2023-07-01' existing = {
name: environmentKeyVaultName
}
Expand All @@ -126,6 +151,7 @@ module containerApp '../../modules/containerApp/main.bicep' = {
revisionSuffix: revisionSuffix
probes: probes
port: port
scale: scale
}
}

Expand Down
25 changes: 25 additions & 0 deletions .azure/applications/web-api-eu/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,30 @@ var containerAppEnvVars = [
}
]

var scale = {
minReplicas: 2
maxReplicas: 10
rules: [
{
custom: {
type: 'cpu'
metricType: 'Utilization'
metadata: {
value: '70'
}
}
}
{
custom: {
type: 'memory'
metricType: 'Utilization'
metadata: {
value: '70'
}
}
}
]
}
resource environmentKeyVaultResource 'Microsoft.KeyVault/vaults@2023-07-01' existing = {
name: environmentKeyVaultName
}
Expand Down Expand Up @@ -128,6 +152,7 @@ module containerApp '../../modules/containerApp/main.bicep' = {
resources: resources
probes: probes
revisionSuffix: revisionSuffix
scale: scale
arealmaas marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down
11 changes: 7 additions & 4 deletions .azure/modules/containerApp/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ param revisionSuffix string
@description('The probes for the container app')
param probes array = []

@description('The scaling configuration for the container app')
param scale object = {
minReplicas: 1
maxReplicas: 1 // temp disable scaling by default for outbox scheduling
}

// Container app revision name does not allow '.' character
var cleanedRevisionSuffix = replace(revisionSuffix, '.', '-')

Expand Down Expand Up @@ -63,10 +69,7 @@ resource containerApp 'Microsoft.App/containerApps@2024-03-01' = {
environmentId: containerAppEnvId
template: {
revisionSuffix: cleanedRevisionSuffix
scale: {
minReplicas: 1
maxReplicas: 1 // temp disable scaling for outbox scheduling
}
scale: scale
containers: [
{
name: name
Expand Down
Loading