Skip to content

Commit

Permalink
feature: add gpu node autoscaling support (terraform-google-modules#807)
Browse files Browse the repository at this point in the history
* add gpu node autoscaling support for top level module

* add gpu node autoscaling support for beta-private-cluster module
  • Loading branch information
James Timms committed Jun 30, 2021
1 parent a9be73c commit 129116c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ locals {

release_channel = var.release_channel != null ? [{ channel : var.release_channel }] : []

autoscaling_resource_limits = var.cluster_autoscaling.enabled ? [{
autoscaling_resource_limits = var.cluster_autoscaling.enabled ? concat([{
resource_type = "cpu"
minimum = var.cluster_autoscaling.min_cpu_cores
maximum = var.cluster_autoscaling.max_cpu_cores
}, {
resource_type = "memory"
minimum = var.cluster_autoscaling.min_memory_gb
maximum = var.cluster_autoscaling.max_memory_gb
}] : []
}], var.cluster_autoscaling.gpu_resources) : []


custom_kube_dns_config = length(keys(var.stub_domains)) > 0
Expand Down
4 changes: 2 additions & 2 deletions modules/beta-private-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ locals {

release_channel = var.release_channel != null ? [{ channel : var.release_channel }] : []

autoscaling_resource_limits = var.cluster_autoscaling.enabled ? [{
autoscaling_resource_limits = var.cluster_autoscaling.enabled ? concat([{
resource_type = "cpu"
minimum = var.cluster_autoscaling.min_cpu_cores
maximum = var.cluster_autoscaling.max_cpu_cores
}, {
resource_type = "memory"
minimum = var.cluster_autoscaling.min_memory_gb
maximum = var.cluster_autoscaling.max_memory_gb
}] : []
}], var.cluster_autoscaling.gpu_resources) : []


custom_kube_dns_config = length(keys(var.stub_domains)) > 0
Expand Down
6 changes: 6 additions & 0 deletions modules/beta-private-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,11 @@ variable "cluster_autoscaling" {
max_cpu_cores = number
min_memory_gb = number
max_memory_gb = number
gpu_resources = list(object({
resource_type = string
minimum = number
maximum = number
}))
})
default = {
enabled = false
Expand All @@ -249,6 +254,7 @@ variable "cluster_autoscaling" {
min_cpu_cores = 0
max_memory_gb = 0
min_memory_gb = 0
gpu_resources = []
}
description = "Cluster autoscaling configuration. See [more details](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters#clusterautoscaling)"
}
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,19 @@ variable "cluster_autoscaling" {
max_cpu_cores = number
min_memory_gb = number
max_memory_gb = number
gpu_resources = list(object({
resource_type = string
minimum = number
maximum = number
}))
})
default = {
enabled = false
max_cpu_cores = 0
min_cpu_cores = 0
max_memory_gb = 0
min_memory_gb = 0
gpu_resources = []
}
description = "Cluster autoscaling configuration. See [more details](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters#clusterautoscaling)"
}
Expand Down

0 comments on commit 129116c

Please sign in to comment.