Skip to content

Commit 685a2db

Browse files
authored
feat: Add support for Cloud Run load balancer configuration (#740)
1 parent e8291f0 commit 685a2db

File tree

14 files changed

+84
-5
lines changed

14 files changed

+84
-5
lines changed

autogen/main/main.tf.tmpl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,17 @@ locals {
8888
}]
8989

9090
{% if beta_cluster %}
91-
cluster_cloudrun_config = var.cloudrun ? [{ disabled = false }] : []
91+
cluster_cloudrun_config_load_balancer_config = (var.cloudrun && var.cloudrun_load_balancer_type != "") ? {
92+
load_balancer_type = var.cloudrun_load_balancer_type
93+
} : {}
94+
cluster_cloudrun_config = var.cloudrun ? [
95+
merge(
96+
{
97+
disabled = false
98+
},
99+
local.cluster_cloudrun_config_load_balancer_config
100+
)
101+
] : []
92102

93103
cluster_gce_pd_csi_config = var.gce_pd_csi_driver ? [{ enabled = true }] : [{ enabled = false }]
94104

autogen/main/variables.tf.tmpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,11 @@ variable "cloudrun" {
462462
default = false
463463
}
464464

465+
variable "cloudrun_load_balancer_type" {
466+
description = "(Beta) Configure the Cloud Run load balancer type. External by default. Set to `LOAD_BALANCER_TYPE_INTERNAL` to configure as an internal load balancer."
467+
default = ""
468+
}
469+
465470
variable "enable_pod_security_policy" {
466471
type = bool
467472
description = "enabled - Enable the PodSecurityPolicy controller for this cluster. If enabled, pods must be valid under a PodSecurityPolicy to be created."

modules/beta-private-cluster-update-variant/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ Then perform the following commands on the root folder:
149149
| basic\_auth\_password | The password to be used with Basic Authentication. | `string` | `""` | no |
150150
| basic\_auth\_username | The username to be used with Basic Authentication. An empty value will disable Basic Authentication, which is the recommended configuration. | `string` | `""` | no |
151151
| cloudrun | (Beta) Enable CloudRun addon | `bool` | `false` | no |
152+
| cloudrun\_load\_balancer\_type | (Beta) Configure the Cloud Run load balancer type. External by default. Set to `LOAD_BALANCER_TYPE_INTERNAL` to configure as an internal load balancer. | `string` | `""` | no |
152153
| 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> })</pre> | <pre>{<br> "autoscaling_profile": "BALANCED",<br> "enabled": false,<br> "max_cpu_cores": 0,<br> "max_memory_gb": 0,<br> "min_cpu_cores": 0,<br> "min_memory_gb": 0<br>}</pre> | no |
153154
| cluster\_ipv4\_cidr | The IP address range of the kubernetes pods in this cluster. Default is an automatically assigned CIDR. | `any` | `null` | no |
154155
| cluster\_resource\_labels | The GCE resource labels (a map of key/value pairs) to be applied to the cluster | `map(string)` | `{}` | no |

modules/beta-private-cluster-update-variant/main.tf

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,17 @@ locals {
7979
provider = null
8080
}]
8181

82-
cluster_cloudrun_config = var.cloudrun ? [{ disabled = false }] : []
82+
cluster_cloudrun_config_load_balancer_config = (var.cloudrun && var.cloudrun_load_balancer_type != "") ? {
83+
load_balancer_type = var.cloudrun_load_balancer_type
84+
} : {}
85+
cluster_cloudrun_config = var.cloudrun ? [
86+
merge(
87+
{
88+
disabled = false
89+
},
90+
local.cluster_cloudrun_config_load_balancer_config
91+
)
92+
] : []
8393

8494
cluster_gce_pd_csi_config = var.gce_pd_csi_driver ? [{ enabled = true }] : [{ enabled = false }]
8595

modules/beta-private-cluster-update-variant/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,11 @@ variable "cloudrun" {
447447
default = false
448448
}
449449

450+
variable "cloudrun_load_balancer_type" {
451+
description = "(Beta) Configure the Cloud Run load balancer type. External by default. Set to `LOAD_BALANCER_TYPE_INTERNAL` to configure as an internal load balancer."
452+
default = ""
453+
}
454+
450455
variable "enable_pod_security_policy" {
451456
type = bool
452457
description = "enabled - Enable the PodSecurityPolicy controller for this cluster. If enabled, pods must be valid under a PodSecurityPolicy to be created."

modules/beta-private-cluster/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ Then perform the following commands on the root folder:
127127
| basic\_auth\_password | The password to be used with Basic Authentication. | `string` | `""` | no |
128128
| basic\_auth\_username | The username to be used with Basic Authentication. An empty value will disable Basic Authentication, which is the recommended configuration. | `string` | `""` | no |
129129
| cloudrun | (Beta) Enable CloudRun addon | `bool` | `false` | no |
130+
| cloudrun\_load\_balancer\_type | (Beta) Configure the Cloud Run load balancer type. External by default. Set to `LOAD_BALANCER_TYPE_INTERNAL` to configure as an internal load balancer. | `string` | `""` | no |
130131
| 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> })</pre> | <pre>{<br> "autoscaling_profile": "BALANCED",<br> "enabled": false,<br> "max_cpu_cores": 0,<br> "max_memory_gb": 0,<br> "min_cpu_cores": 0,<br> "min_memory_gb": 0<br>}</pre> | no |
131132
| cluster\_ipv4\_cidr | The IP address range of the kubernetes pods in this cluster. Default is an automatically assigned CIDR. | `any` | `null` | no |
132133
| cluster\_resource\_labels | The GCE resource labels (a map of key/value pairs) to be applied to the cluster | `map(string)` | `{}` | no |

modules/beta-private-cluster/main.tf

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,17 @@ locals {
7979
provider = null
8080
}]
8181

82-
cluster_cloudrun_config = var.cloudrun ? [{ disabled = false }] : []
82+
cluster_cloudrun_config_load_balancer_config = (var.cloudrun && var.cloudrun_load_balancer_type != "") ? {
83+
load_balancer_type = var.cloudrun_load_balancer_type
84+
} : {}
85+
cluster_cloudrun_config = var.cloudrun ? [
86+
merge(
87+
{
88+
disabled = false
89+
},
90+
local.cluster_cloudrun_config_load_balancer_config
91+
)
92+
] : []
8393

8494
cluster_gce_pd_csi_config = var.gce_pd_csi_driver ? [{ enabled = true }] : [{ enabled = false }]
8595

modules/beta-private-cluster/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,11 @@ variable "cloudrun" {
447447
default = false
448448
}
449449

450+
variable "cloudrun_load_balancer_type" {
451+
description = "(Beta) Configure the Cloud Run load balancer type. External by default. Set to `LOAD_BALANCER_TYPE_INTERNAL` to configure as an internal load balancer."
452+
default = ""
453+
}
454+
450455
variable "enable_pod_security_policy" {
451456
type = bool
452457
description = "enabled - Enable the PodSecurityPolicy controller for this cluster. If enabled, pods must be valid under a PodSecurityPolicy to be created."

modules/beta-public-cluster-update-variant/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ Then perform the following commands on the root folder:
143143
| basic\_auth\_password | The password to be used with Basic Authentication. | `string` | `""` | no |
144144
| basic\_auth\_username | The username to be used with Basic Authentication. An empty value will disable Basic Authentication, which is the recommended configuration. | `string` | `""` | no |
145145
| cloudrun | (Beta) Enable CloudRun addon | `bool` | `false` | no |
146+
| cloudrun\_load\_balancer\_type | (Beta) Configure the Cloud Run load balancer type. External by default. Set to `LOAD_BALANCER_TYPE_INTERNAL` to configure as an internal load balancer. | `string` | `""` | no |
146147
| 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> })</pre> | <pre>{<br> "autoscaling_profile": "BALANCED",<br> "enabled": false,<br> "max_cpu_cores": 0,<br> "max_memory_gb": 0,<br> "min_cpu_cores": 0,<br> "min_memory_gb": 0<br>}</pre> | no |
147148
| cluster\_ipv4\_cidr | The IP address range of the kubernetes pods in this cluster. Default is an automatically assigned CIDR. | `any` | `null` | no |
148149
| cluster\_resource\_labels | The GCE resource labels (a map of key/value pairs) to be applied to the cluster | `map(string)` | `{}` | no |

modules/beta-public-cluster-update-variant/main.tf

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,17 @@ locals {
7979
provider = null
8080
}]
8181

82-
cluster_cloudrun_config = var.cloudrun ? [{ disabled = false }] : []
82+
cluster_cloudrun_config_load_balancer_config = (var.cloudrun && var.cloudrun_load_balancer_type != "") ? {
83+
load_balancer_type = var.cloudrun_load_balancer_type
84+
} : {}
85+
cluster_cloudrun_config = var.cloudrun ? [
86+
merge(
87+
{
88+
disabled = false
89+
},
90+
local.cluster_cloudrun_config_load_balancer_config
91+
)
92+
] : []
8393

8494
cluster_gce_pd_csi_config = var.gce_pd_csi_driver ? [{ enabled = true }] : [{ enabled = false }]
8595

0 commit comments

Comments
 (0)