Skip to content

Commit e40da65

Browse files
authored
chore: set CPU and memory limits for cloud run (#93)
* chore: set CPU and mempoy limits for cloud run
1 parent 0f0972d commit e40da65

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

modules/services/cloud-connector/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,11 @@ No modules.
7272
| <a name="input_bucket_config_name"></a> [bucket\_config\_name](#input\_bucket\_config\_name) | Google Cloud Storage Bucket where the configuration will be saved | `string` | `"cloud-connector-config"` | no |
7373
| <a name="input_config_content"></a> [config\_content](#input\_config\_content) | Contents of the configuration file to be saved in the bucket | `string` | `null` | no |
7474
| <a name="input_config_source"></a> [config\_source](#input\_config\_source) | Path to a file that contains the contents of the configuration file to be saved in the bucket | `string` | `null` | no |
75+
| <a name="input_cpu"></a> [cpu](#input\_cpu) | Amount of CPU to reserve for cloud-connector cloud run service | `string` | `"1"` | no |
7576
| <a name="input_extra_envs"></a> [extra\_envs](#input\_extra\_envs) | Extra environment variables for the Cloud Connector instance | `map(string)` | `{}` | no |
7677
| <a name="input_image_name"></a> [image\_name](#input\_image\_name) | Cloud Connector image to deploy | `string` | `"gcr.io/mateo-burillo-ns/cloud-connector:latest"` | no |
7778
| <a name="input_max_instances"></a> [max\_instances](#input\_max\_instances) | Max number of instances for the Cloud Connector | `number` | `1` | no |
79+
| <a name="input_memory"></a> [memory](#input\_memory) | Amount of memory to reserve for cloud-connector cloud run service | `string` | `"500Mi"` | no |
7880
| <a name="input_name"></a> [name](#input\_name) | Name to be assigned to all child resources. A suffix may be added internally when required. Use default value unless you need to install multiple instances | `string` | `"sfc-cloudconnector"` | no |
7981
| <a name="input_verify_ssl"></a> [verify\_ssl](#input\_verify\_ssl) | Verify the SSL certificate of the Secure endpoint | `bool` | `true` | no |
8082

modules/services/cloud-connector/cloud_run.tf

+8
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ locals {
3737
)
3838
}
3939

40+
4041
resource "google_cloud_run_service" "cloud_connector" {
4142
location = data.google_client_config.current.region
4243
name = var.name
@@ -69,6 +70,13 @@ resource "google_cloud_run_service" "cloud_connector" {
6970
containers {
7071
image = var.image_name
7172

73+
resources {
74+
limits = {
75+
cpu = var.cpu,
76+
memory = var.memory,
77+
}
78+
}
79+
7280
ports {
7381
container_port = 5000
7482
}

modules/services/cloud-connector/variables.tf

+12
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,15 @@ variable "config_source" {
8181
type = string
8282
description = "Path to a file that contains the contents of the configuration file to be saved in the bucket"
8383
}
84+
85+
variable "cpu" {
86+
type = string
87+
default = "1"
88+
description = "Amount of CPU to reserve for cloud-connector cloud run service"
89+
}
90+
91+
variable "memory" {
92+
type = string
93+
default = "500Mi"
94+
description = "Amount of memory to reserve for cloud-connector cloud run service"
95+
}

0 commit comments

Comments
 (0)