Skip to content

Commit a661eea

Browse files
authored
feat: Allow configuring cluster_autoscaling for safer cluster variants (#1407)
* feat: Allow configuring cluster_autoscaling for safer cluster variants * regen
1 parent b8fd9c7 commit a661eea

File tree

8 files changed

+74
-0
lines changed

8 files changed

+74
-0
lines changed

Diff for: autogen/safer-cluster/main.tf.tmpl

+2
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ module "gke" {
9494

9595
node_pools_oauth_scopes = var.node_pools_oauth_scopes
9696

97+
cluster_autoscaling = var.cluster_autoscaling
98+
9799
stub_domains = var.stub_domains
98100
upstream_nameservers = var.upstream_nameservers
99101

Diff for: autogen/safer-cluster/variables.tf.tmpl

+22
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,28 @@ variable "node_pools_oauth_scopes" {
202202
}
203203
}
204204

205+
variable "cluster_autoscaling" {
206+
type = object({
207+
enabled = bool
208+
autoscaling_profile = string
209+
min_cpu_cores = number
210+
max_cpu_cores = number
211+
min_memory_gb = number
212+
max_memory_gb = number
213+
gpu_resources = list(object({ resource_type = string, minimum = number, maximum = number }))
214+
})
215+
default = {
216+
enabled = false
217+
autoscaling_profile = "BALANCED"
218+
max_cpu_cores = 0
219+
min_cpu_cores = 0
220+
max_memory_gb = 0
221+
min_memory_gb = 0
222+
gpu_resources = []
223+
}
224+
description = "Cluster autoscaling configuration. See [more details](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters#clusterautoscaling)"
225+
}
226+
205227
variable "stub_domains" {
206228
type = map(list(string))
207229
description = "Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server"

Diff for: modules/safer-cluster-update-variant/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ For simplicity, we suggest using `roles/container.admin` and
204204
| add\_cluster\_firewall\_rules | Create additional firewall rules | `bool` | `false` | no |
205205
| authenticator\_security\_group | The name of the RBAC security group for use with Google security groups in Kubernetes RBAC. Group name must be in format gke-security-groups@yourdomain.com | `string` | `null` | no |
206206
| cloudrun | (Beta) Enable CloudRun addon | `bool` | `false` | no |
207+
| cluster\_autoscaling | Cluster autoscaling configuration. See [more details](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters#clusterautoscaling) | <pre>object({<br> enabled = bool<br> autoscaling_profile = string<br> min_cpu_cores = number<br> max_cpu_cores = number<br> min_memory_gb = number<br> max_memory_gb = number<br> gpu_resources = list(object({ resource_type = string, minimum = number, maximum = number }))<br> })</pre> | <pre>{<br> "autoscaling_profile": "BALANCED",<br> "enabled": false,<br> "gpu_resources": [],<br> "max_cpu_cores": 0,<br> "max_memory_gb": 0,<br> "min_cpu_cores": 0,<br> "min_memory_gb": 0<br>}</pre> | no |
207208
| cluster\_dns\_domain | The suffix used for all cluster service records. | `string` | `""` | no |
208209
| cluster\_dns\_provider | Which in-cluster DNS provider should be used. PROVIDER\_UNSPECIFIED (default) or PLATFORM\_DEFAULT or CLOUD\_DNS. | `string` | `"PROVIDER_UNSPECIFIED"` | no |
209210
| cluster\_dns\_scope | The scope of access to cluster DNS records. DNS\_SCOPE\_UNSPECIFIED (default) or CLUSTER\_SCOPE or VPC\_SCOPE. | `string` | `"DNS_SCOPE_UNSPECIFIED"` | no |

Diff for: modules/safer-cluster-update-variant/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ module "gke" {
9090

9191
node_pools_oauth_scopes = var.node_pools_oauth_scopes
9292

93+
cluster_autoscaling = var.cluster_autoscaling
94+
9395
stub_domains = var.stub_domains
9496
upstream_nameservers = var.upstream_nameservers
9597

Diff for: modules/safer-cluster-update-variant/variables.tf

+22
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,28 @@ variable "node_pools_oauth_scopes" {
202202
}
203203
}
204204

205+
variable "cluster_autoscaling" {
206+
type = object({
207+
enabled = bool
208+
autoscaling_profile = string
209+
min_cpu_cores = number
210+
max_cpu_cores = number
211+
min_memory_gb = number
212+
max_memory_gb = number
213+
gpu_resources = list(object({ resource_type = string, minimum = number, maximum = number }))
214+
})
215+
default = {
216+
enabled = false
217+
autoscaling_profile = "BALANCED"
218+
max_cpu_cores = 0
219+
min_cpu_cores = 0
220+
max_memory_gb = 0
221+
min_memory_gb = 0
222+
gpu_resources = []
223+
}
224+
description = "Cluster autoscaling configuration. See [more details](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters#clusterautoscaling)"
225+
}
226+
205227
variable "stub_domains" {
206228
type = map(list(string))
207229
description = "Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server"

Diff for: modules/safer-cluster/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ For simplicity, we suggest using `roles/container.admin` and
204204
| add\_cluster\_firewall\_rules | Create additional firewall rules | `bool` | `false` | no |
205205
| authenticator\_security\_group | The name of the RBAC security group for use with Google security groups in Kubernetes RBAC. Group name must be in format gke-security-groups@yourdomain.com | `string` | `null` | no |
206206
| cloudrun | (Beta) Enable CloudRun addon | `bool` | `false` | no |
207+
| cluster\_autoscaling | Cluster autoscaling configuration. See [more details](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters#clusterautoscaling) | <pre>object({<br> enabled = bool<br> autoscaling_profile = string<br> min_cpu_cores = number<br> max_cpu_cores = number<br> min_memory_gb = number<br> max_memory_gb = number<br> gpu_resources = list(object({ resource_type = string, minimum = number, maximum = number }))<br> })</pre> | <pre>{<br> "autoscaling_profile": "BALANCED",<br> "enabled": false,<br> "gpu_resources": [],<br> "max_cpu_cores": 0,<br> "max_memory_gb": 0,<br> "min_cpu_cores": 0,<br> "min_memory_gb": 0<br>}</pre> | no |
207208
| cluster\_dns\_domain | The suffix used for all cluster service records. | `string` | `""` | no |
208209
| cluster\_dns\_provider | Which in-cluster DNS provider should be used. PROVIDER\_UNSPECIFIED (default) or PLATFORM\_DEFAULT or CLOUD\_DNS. | `string` | `"PROVIDER_UNSPECIFIED"` | no |
209210
| cluster\_dns\_scope | The scope of access to cluster DNS records. DNS\_SCOPE\_UNSPECIFIED (default) or CLUSTER\_SCOPE or VPC\_SCOPE. | `string` | `"DNS_SCOPE_UNSPECIFIED"` | no |

Diff for: modules/safer-cluster/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ module "gke" {
9090

9191
node_pools_oauth_scopes = var.node_pools_oauth_scopes
9292

93+
cluster_autoscaling = var.cluster_autoscaling
94+
9395
stub_domains = var.stub_domains
9496
upstream_nameservers = var.upstream_nameservers
9597

Diff for: modules/safer-cluster/variables.tf

+22
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,28 @@ variable "node_pools_oauth_scopes" {
202202
}
203203
}
204204

205+
variable "cluster_autoscaling" {
206+
type = object({
207+
enabled = bool
208+
autoscaling_profile = string
209+
min_cpu_cores = number
210+
max_cpu_cores = number
211+
min_memory_gb = number
212+
max_memory_gb = number
213+
gpu_resources = list(object({ resource_type = string, minimum = number, maximum = number }))
214+
})
215+
default = {
216+
enabled = false
217+
autoscaling_profile = "BALANCED"
218+
max_cpu_cores = 0
219+
min_cpu_cores = 0
220+
max_memory_gb = 0
221+
min_memory_gb = 0
222+
gpu_resources = []
223+
}
224+
description = "Cluster autoscaling configuration. See [more details](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters#clusterautoscaling)"
225+
}
226+
205227
variable "stub_domains" {
206228
type = map(list(string))
207229
description = "Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server"

0 commit comments

Comments
 (0)