Skip to content

Commit

Permalink
Merge branch 'main' into ces-196-gate0-scaling-profile-services-fn
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-calabrese authored Oct 14, 2024
2 parents 1d6301d + 0c9f8da commit 6308674
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/domains/elt/_modules/function_apps/data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,9 @@ data "azurerm_storage_account" "function_elt_internal_storage" {
name = module.function_elt.storage_account_internal_function_name
resource_group_name = var.resource_group_name
}

# Citizen-auth domain Redis Common
data "azurerm_redis_cache" "ioauth_redis_common_itn" {
name = format("%s-itn-citizen-auth-redis-std-v6", var.project)
resource_group_name = format("%s-itn-citizen-auth-data-rg-01", var.project)
}
5 changes: 5 additions & 0 deletions src/domains/elt/_modules/function_apps/function_app_elt.tf
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ locals {
#

INTERNAL_TEST_FISCAL_CODES = module.tests.users.all

# REDIS CACHE CONFIG FOR PDV IDs
REDIS_URL = data.azurerm_redis_cache.ioauth_redis_common_itn.hostname
REDIS_PORT = data.azurerm_redis_cache.ioauth_redis_common_itn.ssl_port
REDIS_PASSWORD = data.azurerm_redis_cache.ioauth_redis_common_itn.primary_access_key
}
}
}
Expand Down
114 changes: 113 additions & 1 deletion src/domains/messages-app/10_function_messages_xl.tf
Original file line number Diff line number Diff line change
Expand Up @@ -617,11 +617,123 @@ resource "azurerm_monitor_autoscale_setting" "app_messages_function_xl" {
}
}

profile {
name = "wallet_gate0"

capacity {
minimum = 8
maximum = 30
default = 10
}

fixed_date {
timezone = "W. Europe Standard Time"
start = "2024-10-15T08:00:00.000Z"
end = "2024-10-15T23:30:00.000Z"
}

rule {
metric_trigger {
metric_name = "Requests"
metric_resource_id = module.app_messages_function_xl[count.index].id
metric_namespace = "microsoft.web/sites"
time_grain = "PT1M"
statistic = "Max"
time_window = "PT1M"
time_aggregation = "Maximum"
operator = "GreaterThan"
threshold = 3000
divide_by_instance_count = true
}

scale_action {
direction = "Increase"
type = "ChangeCount"
value = "2"
cooldown = "PT1M"
}
}

rule {
metric_trigger {
metric_name = "CpuPercentage"
metric_resource_id = module.app_messages_function_xl[count.index].app_service_plan_id
metric_namespace = "microsoft.web/serverfarms"
time_grain = "PT1M"
statistic = "Max"
time_window = "PT1M"
time_aggregation = "Maximum"
operator = "GreaterThan"
threshold = 40
divide_by_instance_count = false
}

scale_action {
direction = "Increase"
type = "ChangeCount"
value = "3"
cooldown = "PT2M"
}
}

rule {
metric_trigger {
metric_name = "Requests"
metric_resource_id = module.app_messages_function_xl[count.index].id
metric_namespace = "microsoft.web/sites"
time_grain = "PT1M"
statistic = "Average"
time_window = "PT5M"
time_aggregation = "Average"
operator = "LessThan"
threshold = 300
divide_by_instance_count = true
}

scale_action {
direction = "Decrease"
type = "ChangeCount"
value = "1"
cooldown = "PT1M"
}
}

rule {
metric_trigger {
metric_name = "CpuPercentage"
metric_resource_id = module.app_messages_function_xl[count.index].app_service_plan_id
metric_namespace = "microsoft.web/serverfarms"
time_grain = "PT1M"
statistic = "Average"
time_window = "PT5M"
time_aggregation = "Average"
operator = "LessThan"
threshold = 15
divide_by_instance_count = false
}

scale_action {
direction = "Decrease"
type = "ChangeCount"
value = "1"
cooldown = "PT2M"
}
}
}

# profile {
# name = "{\"name\":\"default\",\"for\":\"gate0\"}"

# capacity {

# }
# }

tags = var.tags
}

resource "azurerm_subnet_nat_gateway_association" "net_gateway_association_subnet_citizen_func_xl" {
count = var.app_messages_count
nat_gateway_id = data.azurerm_nat_gateway.nat_gateway.id
subnet_id = module.app_messages_snet_xl[count.index].id
}
}

0 comments on commit 6308674

Please sign in to comment.