Skip to content

Commit d87f82d

Browse files
authored
feat(prober,recorder): Set CPU idle on regional basis (#1162)
- chainguard-dev/internal-dev#20110
1 parent f8b3adf commit d87f82d

File tree

6 files changed

+18
-1
lines changed

6 files changed

+18
-1
lines changed

modules/cloudevent-recorder/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ No requirements.
134134
| <a name="input_broker"></a> [broker](#input\_broker) | A map from each of the input region names to the name of the Broker topic in that region. | `map(string)` | n/a | yes |
135135
| <a name="input_cloud_storage_config_max_bytes"></a> [cloud\_storage\_config\_max\_bytes](#input\_cloud\_storage\_config\_max\_bytes) | The maximum bytes that can be written to a Cloud Storage file before a new file is created. Min 1 KB, max 10 GiB. | `number` | `1000000000` | no |
136136
| <a name="input_cloud_storage_config_max_duration"></a> [cloud\_storage\_config\_max\_duration](#input\_cloud\_storage\_config\_max\_duration) | The maximum duration that can elapse before a new Cloud Storage file is created. Min 1 minute, max 10 minutes, default 5 minutes. | `number` | `300` | no |
137+
| <a name="input_cpu_idle"></a> [cpu\_idle](#input\_cpu\_idle) | A map of region names to cpu\_idle settings. When true, CPU is throttled when no requests are being processed. | `map(bool)` | `{}` | no |
137138
| <a name="input_deletion_protection"></a> [deletion\_protection](#input\_deletion\_protection) | Whether to enable deletion protection on data resources. | `bool` | `true` | no |
138139
| <a name="input_enable_profiler"></a> [enable\_profiler](#input\_enable\_profiler) | Enable cloud profiler. | `bool` | `false` | no |
139140
| <a name="input_flush_interval"></a> [flush\_interval](#input\_flush\_interval) | Flush interval for logrotate, as a duration string. | `string` | `""` | no |

modules/cloudevent-recorder/recorder.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ module "this" {
6060
resources = {
6161
limits = var.limits
6262
}
63+
regional-cpu-idle = var.cpu_idle
6364
}
6465
"logrotate" = {
6566
source = {
@@ -75,6 +76,7 @@ module "this" {
7576
name = "logs"
7677
mount_path = "/logs"
7778
}]
79+
regional-cpu-idle = var.cpu_idle
7880
}
7981
}
8082
volumes = [{

modules/cloudevent-recorder/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@ variable "limits" {
116116
default = null
117117
}
118118

119+
variable "cpu_idle" {
120+
default = {}
121+
description = "A map of region names to cpu_idle settings. When true, CPU is throttled when no requests are being processed."
122+
type = map(bool)
123+
}
124+
119125
variable "scaling" {
120126
description = "The scaling configuration for the service."
121127
type = object({

modules/prober/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ No requirements.
100100
| <a name="input_alert_description"></a> [alert\_description](#input\_alert\_description) | Alert documentation. Use this to link to playbooks or give additional context. | `string` | `"An uptime check has failed."` | no |
101101
| <a name="input_base_image"></a> [base\_image](#input\_base\_image) | The base image to use for the prober. | `string` | `null` | no |
102102
| <a name="input_cpu"></a> [cpu](#input\_cpu) | The CPU limit for the prober. | `string` | `"1000m"` | no |
103+
| <a name="input_cpu_idle"></a> [cpu\_idle](#input\_cpu\_idle) | A map of region names to cpu\_idle settings. When true, CPU is throttled when no requests are being processed. | `map(bool)` | `{}` | no |
103104
| <a name="input_deletion_protection"></a> [deletion\_protection](#input\_deletion\_protection) | Whether to enable delete protection for the service. | `bool` | `true` | no |
104105
| <a name="input_dns_zone"></a> [dns\_zone](#input\_dns\_zone) | The managed DNS zone in which to create prober record sets (required for multiple locations). | `string` | `""` | no |
105106
| <a name="input_domain"></a> [domain](#input\_domain) | The domain of the environment to probe (required for multiple locations). | `string` | `""` | no |

modules/prober/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ module "this" {
6868
}
6969
}
7070
])
71-
regional-env = var.regional-env
71+
regional-env = var.regional-env
72+
regional-cpu-idle = var.cpu_idle
7273
resources = {
7374
limits = {
7475
cpu = var.cpu

modules/prober/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ variable "regional-env" {
7474
}))
7575
}
7676

77+
variable "cpu_idle" {
78+
default = {}
79+
description = "A map of region names to cpu_idle settings. When true, CPU is throttled when no requests are being processed."
80+
type = map(bool)
81+
}
82+
7783
variable "secret_env" {
7884
default = {}
7985
description = "A map of secrets to mount as environment variables from Google Secrets Manager (e.g. secret_key=secret_name)"

0 commit comments

Comments
 (0)