Skip to content

Commit

Permalink
fix everything
Browse files Browse the repository at this point in the history
  • Loading branch information
Krusty93 committed Oct 14, 2024
1 parent 034c9c3 commit 074140c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 402 deletions.
242 changes: 9 additions & 233 deletions src/domains/citizen-auth-app/04_function_lollipop.tf
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ module "function_lollipop_staging_slot_itn" {
}

resource "azurerm_monitor_autoscale_setting" "function_lollipop_itn" {
name = "${replace(module.function_lollipop_itn.name, "-fn-", "-as-")}-01"
name = replace(module.function_lollipop_itn.name, "-fn-", "-as-")
resource_group_name = azurerm_resource_group.lollipop_rg_itn.name
location = local.itn_location
target_resource_id = module.function_lollipop_itn.app_service_plan_id
Expand All @@ -191,7 +191,7 @@ resource "azurerm_monitor_autoscale_setting" "function_lollipop_itn" {

capacity {
default = 10
minimum = 5
minimum = 4
maximum = 20
}

Expand Down Expand Up @@ -299,119 +299,6 @@ resource "azurerm_monitor_autoscale_setting" "function_lollipop_itn" {
}
}

profile {
name = "night"

capacity {
default = 10
minimum = 3
maximum = 15
}

recurrence {
timezone = "W. Europe Standard Time"
hours = [23]
minutes = [0]
days = [
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
"Sunday"
]
}

rule {
metric_trigger {
metric_name = "Requests"
metric_resource_id = module.function_lollipop_itn.id
metric_namespace = "microsoft.web/sites"
time_grain = "PT1M"
statistic = "Max"
time_window = "PT1M"
time_aggregation = "Maximum"
operator = "GreaterThan"
threshold = 3200
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.function_lollipop_itn.app_service_plan_id
metric_namespace = "microsoft.web/serverfarms"
time_grain = "PT1M"
statistic = "Max"
time_window = "PT1M"
time_aggregation = "Maximum"
operator = "GreaterThan"
threshold = 45
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.function_lollipop_itn.id
metric_namespace = "microsoft.web/sites"
time_grain = "PT1M"
statistic = "Average"
time_window = "PT5M"
time_aggregation = "Average"
operator = "LessThan"
threshold = 500
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.function_lollipop_itn.app_service_plan_id
metric_namespace = "microsoft.web/serverfarms"
time_grain = "PT1M"
statistic = "Average"
time_window = "PT5M"
time_aggregation = "Average"
operator = "LessThan"
threshold = 20
divide_by_instance_count = false
}

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

profile {
name = "{\"name\":\"default\",\"for\":\"evening\"}"

Expand Down Expand Up @@ -526,26 +413,17 @@ resource "azurerm_monitor_autoscale_setting" "function_lollipop_itn" {
}

profile {
name = "{\"name\":\"default\",\"for\":\"night\"}"
name = "wallet_gate0"

recurrence {
fixed_date {
timezone = "W. Europe Standard Time"
hours = [5]
minutes = [0]
days = [
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
"Sunday"
]
start = "2024-10-15T08:00:00.000Z"
end = "2024-10-15T23:30:00.000Z"
}

capacity {
default = 10
minimum = 3
default = 20
minimum = 15
maximum = 30
}

Expand Down Expand Up @@ -638,109 +516,7 @@ resource "azurerm_monitor_autoscale_setting" "function_lollipop_itn" {
}
}

profile {
name = "auth_gate0"

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

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.function_lollipop_itn.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.function_lollipop_itn.app_service_plan_id
metric_namespace = "microsoft.web/serverfarms"
time_grain = "PT1M"
statistic = "Max"
time_window = "PT1M"
time_aggregation = "Maximum"
operator = "GreaterThan"
threshold = 35
divide_by_instance_count = false
}

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

rule {
metric_trigger {
metric_name = "Requests"
metric_resource_id = module.function_lollipop_itn.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.function_lollipop_itn.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"
}
}
}
tags = var.tags
}

# ---------------------------------
Expand Down
26 changes: 0 additions & 26 deletions src/domains/citizen-auth-app/07_function_fast_login.tf
Original file line number Diff line number Diff line change
Expand Up @@ -201,36 +201,10 @@ module "function_fast_login_itn_autoscale" {
minutes = 59
}
},
low_load = {
name = "night"
minimum = 3
default = 10
start = {
hour = 23
minutes = 00
}
end = {
hour = 05
minutes = 00
}
},
normal_load = {
minimum = 3
default = 10
},
gate0 = {
name = "auth_gate0"
minimum = 20
default = 10
start = {
hour = 8
minutes = 00
}
end = {
hour = 23
minutes = 30
}
},
maximum = 30
}

Expand Down
Loading

0 comments on commit 074140c

Please sign in to comment.