Skip to content

Commit e9de006

Browse files
feat!: add service_external_ips option (#1441)
* add service_external_ips option * fixing formatting error Co-authored-by: Bharath KKB <bharathkrishnakb@gmail.com>
1 parent ba3dcd0 commit e9de006

File tree

33 files changed

+143
-4
lines changed

33 files changed

+143
-4
lines changed

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ Then perform the following commands on the root folder:
194194
| remove\_default\_node\_pool | Remove default node pool while setting up the cluster | `bool` | `false` | no |
195195
| resource\_usage\_export\_dataset\_id | The ID of a BigQuery Dataset for using BigQuery as the destination of resource usage export. | `string` | `""` | no |
196196
| service\_account | The service account to run nodes as if not overridden in `node_pools`. The create\_service\_account variable default value (true) will cause a cluster-specific service account to be created. | `string` | `""` | no |
197+
| service\_external\_ips | Whether external ips specified by a service will be allowed in this cluster | `bool` | `false` | no |
197198
| shadow\_firewall\_rules\_priority | The firewall priority of GKE shadow firewall rules. The priority should be less than default firewall, which is 1000. | `number` | `999` | no |
198199
| skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | `bool` | `false` | no |
199200
| stub\_domains | Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server | `map(list(string))` | `{}` | no |

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

+7
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,13 @@ resource "google_container_cluster" "primary" {
208208
}
209209
}
210210

211+
dynamic "service_external_ips_config" {
212+
for_each = var.service_external_ips ? [1] : []
213+
content {
214+
enabled = var.service_external_ips
215+
}
216+
}
217+
211218
addons_config {
212219
http_load_balancing {
213220
disabled = !var.http_load_balancing

Diff for: autogen/main/variables.tf.tmpl

+6
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ variable "http_load_balancing" {
9696
default = true
9797
}
9898

99+
variable "service_external_ips" {
100+
type = bool
101+
description = "Whether external ips specified by a service will be allowed in this cluster"
102+
default = false
103+
}
104+
99105
variable "datapath_provider" {
100106
type = string
101107
description = "The desired datapath provider for this cluster. By default, `DATAPATH_PROVIDER_UNSPECIFIED` enables the IPTables-based kube-proxy implementation. `ADVANCED_DATAPATH` enables Dataplane-V2 feature."

Diff for: autogen/main/versions.tf.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ terraform {
3838
required_providers {
3939
google = {
4040
source = "hashicorp/google"
41-
version = ">= 4.31.0, < 5.0"
41+
version = ">= 4.35.0, < 5.0"
4242
}
4343
kubernetes = {
4444
source = "hashicorp/kubernetes"

Diff for: cluster.tf

+7
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,13 @@ resource "google_container_cluster" "primary" {
109109
}
110110
}
111111

112+
dynamic "service_external_ips_config" {
113+
for_each = var.service_external_ips ? [1] : []
114+
content {
115+
enabled = var.service_external_ips
116+
}
117+
}
118+
112119
addons_config {
113120
http_load_balancing {
114121
disabled = !var.http_load_balancing

Diff for: modules/beta-autopilot-private-cluster/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ Then perform the following commands on the root folder:
124124
| release\_channel | The release channel of this cluster. Accepted values are `UNSPECIFIED`, `RAPID`, `REGULAR` and `STABLE`. Defaults to `UNSPECIFIED`. | `string` | `null` | no |
125125
| resource\_usage\_export\_dataset\_id | The ID of a BigQuery Dataset for using BigQuery as the destination of resource usage export. | `string` | `""` | no |
126126
| service\_account | The service account to run nodes as if not overridden in `node_pools`. The create\_service\_account variable default value (true) will cause a cluster-specific service account to be created. | `string` | `""` | no |
127+
| service\_external\_ips | Whether external ips specified by a service will be allowed in this cluster | `bool` | `false` | no |
127128
| shadow\_firewall\_rules\_priority | The firewall priority of GKE shadow firewall rules. The priority should be less than default firewall, which is 1000. | `number` | `999` | no |
128129
| skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | `bool` | `false` | no |
129130
| stub\_domains | Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server | `map(list(string))` | `{}` | no |

Diff for: modules/beta-autopilot-private-cluster/cluster.tf

+7
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@ resource "google_container_cluster" "primary" {
9494
}
9595
}
9696

97+
dynamic "service_external_ips_config" {
98+
for_each = var.service_external_ips ? [1] : []
99+
content {
100+
enabled = var.service_external_ips
101+
}
102+
}
103+
97104
addons_config {
98105
http_load_balancing {
99106
disabled = !var.http_load_balancing

Diff for: modules/beta-autopilot-private-cluster/variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ variable "http_load_balancing" {
9696
default = true
9797
}
9898

99+
variable "service_external_ips" {
100+
type = bool
101+
description = "Whether external ips specified by a service will be allowed in this cluster"
102+
default = false
103+
}
104+
99105
variable "datapath_provider" {
100106
type = string
101107
description = "The desired datapath provider for this cluster. By default, `DATAPATH_PROVIDER_UNSPECIFIED` enables the IPTables-based kube-proxy implementation. `ADVANCED_DATAPATH` enables Dataplane-V2 feature."

Diff for: modules/beta-autopilot-public-cluster/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ Then perform the following commands on the root folder:
113113
| release\_channel | The release channel of this cluster. Accepted values are `UNSPECIFIED`, `RAPID`, `REGULAR` and `STABLE`. Defaults to `UNSPECIFIED`. | `string` | `null` | no |
114114
| resource\_usage\_export\_dataset\_id | The ID of a BigQuery Dataset for using BigQuery as the destination of resource usage export. | `string` | `""` | no |
115115
| service\_account | The service account to run nodes as if not overridden in `node_pools`. The create\_service\_account variable default value (true) will cause a cluster-specific service account to be created. | `string` | `""` | no |
116+
| service\_external\_ips | Whether external ips specified by a service will be allowed in this cluster | `bool` | `false` | no |
116117
| shadow\_firewall\_rules\_priority | The firewall priority of GKE shadow firewall rules. The priority should be less than default firewall, which is 1000. | `number` | `999` | no |
117118
| skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | `bool` | `false` | no |
118119
| stub\_domains | Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server | `map(list(string))` | `{}` | no |

Diff for: modules/beta-autopilot-public-cluster/cluster.tf

+7
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@ resource "google_container_cluster" "primary" {
9494
}
9595
}
9696

97+
dynamic "service_external_ips_config" {
98+
for_each = var.service_external_ips ? [1] : []
99+
content {
100+
enabled = var.service_external_ips
101+
}
102+
}
103+
97104
addons_config {
98105
http_load_balancing {
99106
disabled = !var.http_load_balancing

Diff for: modules/beta-autopilot-public-cluster/variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ variable "http_load_balancing" {
9696
default = true
9797
}
9898

99+
variable "service_external_ips" {
100+
type = bool
101+
description = "Whether external ips specified by a service will be allowed in this cluster"
102+
default = false
103+
}
104+
99105
variable "datapath_provider" {
100106
type = string
101107
description = "The desired datapath provider for this cluster. By default, `DATAPATH_PROVIDER_UNSPECIFIED` enables the IPTables-based kube-proxy implementation. `ADVANCED_DATAPATH` enables Dataplane-V2 feature."

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

+1
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ Then perform the following commands on the root folder:
253253
| resource\_usage\_export\_dataset\_id | The ID of a BigQuery Dataset for using BigQuery as the destination of resource usage export. | `string` | `""` | no |
254254
| sandbox\_enabled | (Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` to use it). | `bool` | `false` | no |
255255
| service\_account | The service account to run nodes as if not overridden in `node_pools`. The create\_service\_account variable default value (true) will cause a cluster-specific service account to be created. | `string` | `""` | no |
256+
| service\_external\_ips | Whether external ips specified by a service will be allowed in this cluster | `bool` | `false` | no |
256257
| shadow\_firewall\_rules\_priority | The firewall priority of GKE shadow firewall rules. The priority should be less than default firewall, which is 1000. | `number` | `999` | no |
257258
| skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | `bool` | `false` | no |
258259
| stub\_domains | Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server | `map(list(string))` | `{}` | no |

Diff for: modules/beta-private-cluster-update-variant/cluster.tf

+7
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,13 @@ resource "google_container_cluster" "primary" {
171171
}
172172
}
173173

174+
dynamic "service_external_ips_config" {
175+
for_each = var.service_external_ips ? [1] : []
176+
content {
177+
enabled = var.service_external_ips
178+
}
179+
}
180+
174181
addons_config {
175182
http_load_balancing {
176183
disabled = !var.http_load_balancing

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

+6
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ variable "http_load_balancing" {
9696
default = true
9797
}
9898

99+
variable "service_external_ips" {
100+
type = bool
101+
description = "Whether external ips specified by a service will be allowed in this cluster"
102+
default = false
103+
}
104+
99105
variable "datapath_provider" {
100106
type = string
101107
description = "The desired datapath provider for this cluster. By default, `DATAPATH_PROVIDER_UNSPECIFIED` enables the IPTables-based kube-proxy implementation. `ADVANCED_DATAPATH` enables Dataplane-V2 feature."

Diff for: modules/beta-private-cluster/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ Then perform the following commands on the root folder:
231231
| resource\_usage\_export\_dataset\_id | The ID of a BigQuery Dataset for using BigQuery as the destination of resource usage export. | `string` | `""` | no |
232232
| sandbox\_enabled | (Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` to use it). | `bool` | `false` | no |
233233
| service\_account | The service account to run nodes as if not overridden in `node_pools`. The create\_service\_account variable default value (true) will cause a cluster-specific service account to be created. | `string` | `""` | no |
234+
| service\_external\_ips | Whether external ips specified by a service will be allowed in this cluster | `bool` | `false` | no |
234235
| shadow\_firewall\_rules\_priority | The firewall priority of GKE shadow firewall rules. The priority should be less than default firewall, which is 1000. | `number` | `999` | no |
235236
| skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | `bool` | `false` | no |
236237
| stub\_domains | Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server | `map(list(string))` | `{}` | no |

Diff for: modules/beta-private-cluster/cluster.tf

+7
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,13 @@ resource "google_container_cluster" "primary" {
171171
}
172172
}
173173

174+
dynamic "service_external_ips_config" {
175+
for_each = var.service_external_ips ? [1] : []
176+
content {
177+
enabled = var.service_external_ips
178+
}
179+
}
180+
174181
addons_config {
175182
http_load_balancing {
176183
disabled = !var.http_load_balancing

Diff for: modules/beta-private-cluster/variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ variable "http_load_balancing" {
9696
default = true
9797
}
9898

99+
variable "service_external_ips" {
100+
type = bool
101+
description = "Whether external ips specified by a service will be allowed in this cluster"
102+
default = false
103+
}
104+
99105
variable "datapath_provider" {
100106
type = string
101107
description = "The desired datapath provider for this cluster. By default, `DATAPATH_PROVIDER_UNSPECIFIED` enables the IPTables-based kube-proxy implementation. `ADVANCED_DATAPATH` enables Dataplane-V2 feature."

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

+1
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ Then perform the following commands on the root folder:
242242
| resource\_usage\_export\_dataset\_id | The ID of a BigQuery Dataset for using BigQuery as the destination of resource usage export. | `string` | `""` | no |
243243
| sandbox\_enabled | (Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` to use it). | `bool` | `false` | no |
244244
| service\_account | The service account to run nodes as if not overridden in `node_pools`. The create\_service\_account variable default value (true) will cause a cluster-specific service account to be created. | `string` | `""` | no |
245+
| service\_external\_ips | Whether external ips specified by a service will be allowed in this cluster | `bool` | `false` | no |
245246
| shadow\_firewall\_rules\_priority | The firewall priority of GKE shadow firewall rules. The priority should be less than default firewall, which is 1000. | `number` | `999` | no |
246247
| skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | `bool` | `false` | no |
247248
| stub\_domains | Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server | `map(list(string))` | `{}` | no |

Diff for: modules/beta-public-cluster-update-variant/cluster.tf

+7
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,13 @@ resource "google_container_cluster" "primary" {
171171
}
172172
}
173173

174+
dynamic "service_external_ips_config" {
175+
for_each = var.service_external_ips ? [1] : []
176+
content {
177+
enabled = var.service_external_ips
178+
}
179+
}
180+
174181
addons_config {
175182
http_load_balancing {
176183
disabled = !var.http_load_balancing

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

+6
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ variable "http_load_balancing" {
9696
default = true
9797
}
9898

99+
variable "service_external_ips" {
100+
type = bool
101+
description = "Whether external ips specified by a service will be allowed in this cluster"
102+
default = false
103+
}
104+
99105
variable "datapath_provider" {
100106
type = string
101107
description = "The desired datapath provider for this cluster. By default, `DATAPATH_PROVIDER_UNSPECIFIED` enables the IPTables-based kube-proxy implementation. `ADVANCED_DATAPATH` enables Dataplane-V2 feature."

Diff for: modules/beta-public-cluster/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ Then perform the following commands on the root folder:
220220
| resource\_usage\_export\_dataset\_id | The ID of a BigQuery Dataset for using BigQuery as the destination of resource usage export. | `string` | `""` | no |
221221
| sandbox\_enabled | (Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` to use it). | `bool` | `false` | no |
222222
| service\_account | The service account to run nodes as if not overridden in `node_pools`. The create\_service\_account variable default value (true) will cause a cluster-specific service account to be created. | `string` | `""` | no |
223+
| service\_external\_ips | Whether external ips specified by a service will be allowed in this cluster | `bool` | `false` | no |
223224
| shadow\_firewall\_rules\_priority | The firewall priority of GKE shadow firewall rules. The priority should be less than default firewall, which is 1000. | `number` | `999` | no |
224225
| skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | `bool` | `false` | no |
225226
| stub\_domains | Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server | `map(list(string))` | `{}` | no |

Diff for: modules/beta-public-cluster/cluster.tf

+7
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,13 @@ resource "google_container_cluster" "primary" {
171171
}
172172
}
173173

174+
dynamic "service_external_ips_config" {
175+
for_each = var.service_external_ips ? [1] : []
176+
content {
177+
enabled = var.service_external_ips
178+
}
179+
}
180+
174181
addons_config {
175182
http_load_balancing {
176183
disabled = !var.http_load_balancing

Diff for: modules/beta-public-cluster/variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ variable "http_load_balancing" {
9696
default = true
9797
}
9898

99+
variable "service_external_ips" {
100+
type = bool
101+
description = "Whether external ips specified by a service will be allowed in this cluster"
102+
default = false
103+
}
104+
99105
variable "datapath_provider" {
100106
type = string
101107
description = "The desired datapath provider for this cluster. By default, `DATAPATH_PROVIDER_UNSPECIFIED` enables the IPTables-based kube-proxy implementation. `ADVANCED_DATAPATH` enables Dataplane-V2 feature."

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

+1
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ Then perform the following commands on the root folder:
226226
| remove\_default\_node\_pool | Remove default node pool while setting up the cluster | `bool` | `false` | no |
227227
| resource\_usage\_export\_dataset\_id | The ID of a BigQuery Dataset for using BigQuery as the destination of resource usage export. | `string` | `""` | no |
228228
| service\_account | The service account to run nodes as if not overridden in `node_pools`. The create\_service\_account variable default value (true) will cause a cluster-specific service account to be created. | `string` | `""` | no |
229+
| service\_external\_ips | Whether external ips specified by a service will be allowed in this cluster | `bool` | `false` | no |
229230
| shadow\_firewall\_rules\_priority | The firewall priority of GKE shadow firewall rules. The priority should be less than default firewall, which is 1000. | `number` | `999` | no |
230231
| skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | `bool` | `false` | no |
231232
| stub\_domains | Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server | `map(list(string))` | `{}` | no |

Diff for: modules/private-cluster-update-variant/cluster.tf

+7
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,13 @@ resource "google_container_cluster" "primary" {
109109
}
110110
}
111111

112+
dynamic "service_external_ips_config" {
113+
for_each = var.service_external_ips ? [1] : []
114+
content {
115+
enabled = var.service_external_ips
116+
}
117+
}
118+
112119
addons_config {
113120
http_load_balancing {
114121
disabled = !var.http_load_balancing

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

+6
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ variable "http_load_balancing" {
9696
default = true
9797
}
9898

99+
variable "service_external_ips" {
100+
type = bool
101+
description = "Whether external ips specified by a service will be allowed in this cluster"
102+
default = false
103+
}
104+
99105
variable "datapath_provider" {
100106
type = string
101107
description = "The desired datapath provider for this cluster. By default, `DATAPATH_PROVIDER_UNSPECIFIED` enables the IPTables-based kube-proxy implementation. `ADVANCED_DATAPATH` enables Dataplane-V2 feature."

Diff for: modules/private-cluster-update-variant/versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ terraform {
2121
required_providers {
2222
google = {
2323
source = "hashicorp/google"
24-
version = ">= 4.31.0, < 5.0"
24+
version = ">= 4.35.0, < 5.0"
2525
}
2626
kubernetes = {
2727
source = "hashicorp/kubernetes"

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

+1
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ Then perform the following commands on the root folder:
204204
| remove\_default\_node\_pool | Remove default node pool while setting up the cluster | `bool` | `false` | no |
205205
| resource\_usage\_export\_dataset\_id | The ID of a BigQuery Dataset for using BigQuery as the destination of resource usage export. | `string` | `""` | no |
206206
| service\_account | The service account to run nodes as if not overridden in `node_pools`. The create\_service\_account variable default value (true) will cause a cluster-specific service account to be created. | `string` | `""` | no |
207+
| service\_external\_ips | Whether external ips specified by a service will be allowed in this cluster | `bool` | `false` | no |
207208
| shadow\_firewall\_rules\_priority | The firewall priority of GKE shadow firewall rules. The priority should be less than default firewall, which is 1000. | `number` | `999` | no |
208209
| skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | `bool` | `false` | no |
209210
| stub\_domains | Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server | `map(list(string))` | `{}` | no |

Diff for: modules/private-cluster/cluster.tf

+7
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,13 @@ resource "google_container_cluster" "primary" {
109109
}
110110
}
111111

112+
dynamic "service_external_ips_config" {
113+
for_each = var.service_external_ips ? [1] : []
114+
content {
115+
enabled = var.service_external_ips
116+
}
117+
}
118+
112119
addons_config {
113120
http_load_balancing {
114121
disabled = !var.http_load_balancing

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

+6
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ variable "http_load_balancing" {
9696
default = true
9797
}
9898

99+
variable "service_external_ips" {
100+
type = bool
101+
description = "Whether external ips specified by a service will be allowed in this cluster"
102+
default = false
103+
}
104+
99105
variable "datapath_provider" {
100106
type = string
101107
description = "The desired datapath provider for this cluster. By default, `DATAPATH_PROVIDER_UNSPECIFIED` enables the IPTables-based kube-proxy implementation. `ADVANCED_DATAPATH` enables Dataplane-V2 feature."

Diff for: modules/private-cluster/versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ terraform {
2121
required_providers {
2222
google = {
2323
source = "hashicorp/google"
24-
version = ">= 4.31.0, < 5.0"
24+
version = ">= 4.35.0, < 5.0"
2525
}
2626
kubernetes = {
2727
source = "hashicorp/kubernetes"

0 commit comments

Comments
 (0)