Skip to content

Commit 072068a

Browse files
committed
Generate from template
1 parent a633ae1 commit 072068a

File tree

25 files changed

+120
-8
lines changed

25 files changed

+120
-8
lines changed

cluster.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ resource "google_container_cluster" "primary" {
4141
}
4242
}
4343

44+
4445
subnetwork = data.google_compute_subnetwork.gke_subnetwork.self_link
4546
min_master_version = local.master_version
4647

main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ locals {
4545
master_version = var.regional ? local.master_version_regional : local.master_version_zonal
4646
node_version = var.regional ? local.node_version_regional : local.node_version_zonal
4747

48+
4849
custom_kube_dns_config = length(keys(var.stub_domains)) > 0
4950
upstream_nameservers_config = length(var.upstream_nameservers) > 0
5051
network_project_id = var.network_project_id != "" ? var.network_project_id : var.project_id

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
153153
| enable\_intranode\_visibility | Whether Intra-node visibility is enabled for this cluster. This makes same node pod to pod traffic visible for VPC network | bool | `"false"` | no |
154154
| enable\_private\_endpoint | (Beta) Whether the master's internal IP address is used as the cluster endpoint | bool | `"false"` | no |
155155
| enable\_private\_nodes | (Beta) Whether nodes have internal IP addresses only | bool | `"false"` | no |
156+
| enable\_release\_channel | (Beta) Whether release channel is configured for this cluster. | bool | `"false"` | no |
156157
| enable\_vertical\_pod\_autoscaling | Vertical Pod Autoscaling automatically adjusts the resources of pods controlled by it | bool | `"false"` | no |
157158
| grant\_registry\_access | Grants created cluster-specific service account storage.objectViewer role. | bool | `"false"` | no |
158159
| horizontal\_pod\_autoscaling | Enable horizontal pod autoscaling addon | bool | `"true"` | no |
@@ -188,8 +189,9 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
188189
| non\_masquerade\_cidrs | List of strings in CIDR notation that specify the IP address ranges that do not use IP masquerading. | list(string) | `<list>` | no |
189190
| pod\_security\_policy\_config | enabled - Enable the PodSecurityPolicy controller for this cluster. If enabled, pods must be valid under a PodSecurityPolicy to be created. | list | `<list>` | no |
190191
| project\_id | The project ID to host the cluster in (required) | string | n/a | yes |
191-
| region | The region to host the cluster in (required) | string | n/a | yes |
192+
| region | The region to host the cluster in (optional if zonal cluster / required if regional) | string | `"null"` | no |
192193
| regional | Whether is a regional cluster (zonal cluster if set false. WARNING: changing this after cluster creation is destructive!) | bool | `"true"` | no |
194+
| release\_channel | (Beta) The release channel of this cluster. Accepted values are `UNSPECIFIED`, `RAPID`, `REGULAR` and `STABLE`. Defaults to `UNSPECIFIED`. | string | `"UNSPECIFIED"` | no |
193195
| remove\_default\_node\_pool | Remove default node pool while setting up the cluster | bool | `"false"` | no |
194196
| resource\_usage\_export\_dataset\_id | The dataset id for which network egress metering for this cluster will be enabled. If enabled, a daemonset will be created in the cluster to meter network egress traffic. | string | `""` | no |
195197
| sandbox\_enabled | (Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` and `node_version` = `1.12.7-gke.17` or later to use it). | bool | `"false"` | no |
@@ -223,6 +225,8 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
223225
| node\_pools\_versions | List of node pools versions |
224226
| pod\_security\_policy\_enabled | Whether pod security policy is enabled |
225227
| region | Cluster region |
228+
| release\_channel | The release channel of this cluster |
229+
| release\_channel\_enabled | Whether release channel is enabled |
226230
| service\_account | The service account to default running nodes as if not overridden in `node_pools`. |
227231
| type | Cluster type (regional / zonal) |
228232
| vertical\_pod\_autoscaling\_enabled | Whether veritical pod autoscaling is enabled |

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ resource "google_container_cluster" "primary" {
4141
}
4242
}
4343

44+
dynamic "release_channel" {
45+
for_each = local.release_channel
46+
47+
content {
48+
channel = release_channel.value.channel
49+
}
50+
}
51+
4452
subnetwork = data.google_compute_subnetwork.gke_subnetwork.self_link
4553
min_master_version = local.master_version
4654

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ data "google_compute_zones" "available" {
2323
provider = google-beta
2424

2525
project = var.project_id
26-
region = var.region
26+
region = local.region
2727
}
2828

2929
resource "random_shuffle" "available_zones" {
@@ -34,6 +34,7 @@ resource "random_shuffle" "available_zones" {
3434
locals {
3535
// location
3636
location = var.regional ? var.region : var.zones[0]
37+
region = var.region == null ? join("-", slice(split("-", var.zones[0]), 0, 2)) : var.region
3738
// for regional cluster - use var.zones if provided, use available otherwise, for zonal cluster use var.zones with first element extracted
3839
node_locations = var.regional ? coalescelist(compact(var.zones), sort(random_shuffle.available_zones.result)) : slice(var.zones, 1, length(var.zones))
3940
// kuberentes version
@@ -43,6 +44,8 @@ locals {
4344
node_version_zonal = var.node_version != "" && ! var.regional ? var.node_version : local.master_version_zonal
4445
master_version = var.regional ? local.master_version_regional : local.master_version_zonal
4546
node_version = var.regional ? local.node_version_regional : local.node_version_zonal
47+
release_channel = var.enable_release_channel ? [{ channel : var.release_channel }] : []
48+
4649

4750
custom_kube_dns_config = length(keys(var.stub_domains)) > 0
4851
upstream_nameservers_config = length(var.upstream_nameservers) > 0

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ data "google_compute_subnetwork" "gke_subnetwork" {
2727
provider = google-beta
2828

2929
name = var.subnetwork
30-
region = var.region
30+
region = local.region
3131
project = local.network_project_id
3232
}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,3 +149,12 @@ output "vertical_pod_autoscaling_enabled" {
149149
value = local.cluster_vertical_pod_autoscaling_enabled
150150
}
151151

152+
output "release_channel_enabled" {
153+
description = "Whether release channel is enabled"
154+
value = var.enable_release_channel
155+
}
156+
157+
output "release_channel" {
158+
description = "The release channel of this cluster"
159+
value = var.release_channel
160+
}

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ variable "regional" {
4040

4141
variable "region" {
4242
type = string
43-
description = "The region to host the cluster in (required)"
43+
description = "The region to host the cluster in (optional if zonal cluster / required if regional)"
44+
default = null
4445
}
4546

4647
variable "zones" {
@@ -405,3 +406,14 @@ variable "authenticator_security_group" {
405406
default = null
406407
}
407408

409+
variable "enable_release_channel" {
410+
type = bool
411+
description = "(Beta) Whether release channel is configured for this cluster."
412+
default = false
413+
}
414+
415+
variable "release_channel" {
416+
type = string
417+
description = "(Beta) The release channel of this cluster. Accepted values are `UNSPECIFIED`, `RAPID`, `REGULAR` and `STABLE`. Defaults to `UNSPECIFIED`."
418+
default = "UNSPECIFIED"
419+
}

modules/beta-private-cluster/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
153153
| enable\_intranode\_visibility | Whether Intra-node visibility is enabled for this cluster. This makes same node pod to pod traffic visible for VPC network | bool | `"false"` | no |
154154
| enable\_private\_endpoint | (Beta) Whether the master's internal IP address is used as the cluster endpoint | bool | `"false"` | no |
155155
| enable\_private\_nodes | (Beta) Whether nodes have internal IP addresses only | bool | `"false"` | no |
156+
| enable\_release\_channel | (Beta) Whether release channel is configured for this cluster. | bool | `"false"` | no |
156157
| enable\_vertical\_pod\_autoscaling | Vertical Pod Autoscaling automatically adjusts the resources of pods controlled by it | bool | `"false"` | no |
157158
| grant\_registry\_access | Grants created cluster-specific service account storage.objectViewer role. | bool | `"false"` | no |
158159
| horizontal\_pod\_autoscaling | Enable horizontal pod autoscaling addon | bool | `"true"` | no |
@@ -190,6 +191,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
190191
| project\_id | The project ID to host the cluster in (required) | string | n/a | yes |
191192
| region | The region to host the cluster in (optional if zonal cluster / required if regional) | string | `"null"` | no |
192193
| regional | Whether is a regional cluster (zonal cluster if set false. WARNING: changing this after cluster creation is destructive!) | bool | `"true"` | no |
194+
| release\_channel | (Beta) The release channel of this cluster. Accepted values are `UNSPECIFIED`, `RAPID`, `REGULAR` and `STABLE`. Defaults to `UNSPECIFIED`. | string | `"UNSPECIFIED"` | no |
193195
| remove\_default\_node\_pool | Remove default node pool while setting up the cluster | bool | `"false"` | no |
194196
| resource\_usage\_export\_dataset\_id | The dataset id for which network egress metering for this cluster will be enabled. If enabled, a daemonset will be created in the cluster to meter network egress traffic. | string | `""` | no |
195197
| sandbox\_enabled | (Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` and `node_version` = `1.12.7-gke.17` or later to use it). | bool | `"false"` | no |
@@ -223,6 +225,8 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
223225
| node\_pools\_versions | List of node pools versions |
224226
| pod\_security\_policy\_enabled | Whether pod security policy is enabled |
225227
| region | Cluster region |
228+
| release\_channel | The release channel of this cluster |
229+
| release\_channel\_enabled | Whether release channel is enabled |
226230
| service\_account | The service account to default running nodes as if not overridden in `node_pools`. |
227231
| type | Cluster type (regional / zonal) |
228232
| vertical\_pod\_autoscaling\_enabled | Whether veritical pod autoscaling is enabled |

modules/beta-private-cluster/cluster.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ resource "google_container_cluster" "primary" {
4141
}
4242
}
4343

44+
dynamic "release_channel" {
45+
for_each = local.release_channel
46+
47+
content {
48+
channel = release_channel.value.channel
49+
}
50+
}
51+
4452
subnetwork = data.google_compute_subnetwork.gke_subnetwork.self_link
4553
min_master_version = local.master_version
4654

modules/beta-private-cluster/main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ locals {
4444
node_version_zonal = var.node_version != "" && ! var.regional ? var.node_version : local.master_version_zonal
4545
master_version = var.regional ? local.master_version_regional : local.master_version_zonal
4646
node_version = var.regional ? local.node_version_regional : local.node_version_zonal
47+
release_channel = var.enable_release_channel ? [{ channel : var.release_channel }] : []
48+
4749

4850
custom_kube_dns_config = length(keys(var.stub_domains)) > 0
4951
upstream_nameservers_config = length(var.upstream_nameservers) > 0

modules/beta-private-cluster/outputs.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,3 +149,12 @@ output "vertical_pod_autoscaling_enabled" {
149149
value = local.cluster_vertical_pod_autoscaling_enabled
150150
}
151151

152+
output "release_channel_enabled" {
153+
description = "Whether release channel is enabled"
154+
value = var.enable_release_channel
155+
}
156+
157+
output "release_channel" {
158+
description = "The release channel of this cluster"
159+
value = var.release_channel
160+
}

modules/beta-private-cluster/variables.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,3 +406,14 @@ variable "authenticator_security_group" {
406406
default = null
407407
}
408408

409+
variable "enable_release_channel" {
410+
type = bool
411+
description = "(Beta) Whether release channel is configured for this cluster."
412+
default = false
413+
}
414+
415+
variable "release_channel" {
416+
type = string
417+
description = "(Beta) The release channel of this cluster. Accepted values are `UNSPECIFIED`, `RAPID`, `REGULAR` and `STABLE`. Defaults to `UNSPECIFIED`."
418+
default = "UNSPECIFIED"
419+
}

modules/beta-public-cluster/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
145145
| disable\_legacy\_metadata\_endpoints | Disable the /0.1/ and /v1beta1/ metadata server endpoints on the node. Changing this value will cause all node pools to be recreated. | bool | `"true"` | no |
146146
| enable\_binary\_authorization | Enable BinAuthZ Admission controller | string | `"false"` | no |
147147
| enable\_intranode\_visibility | Whether Intra-node visibility is enabled for this cluster. This makes same node pod to pod traffic visible for VPC network | bool | `"false"` | no |
148+
| enable\_release\_channel | (Beta) Whether release channel is configured for this cluster. | bool | `"false"` | no |
148149
| enable\_vertical\_pod\_autoscaling | Vertical Pod Autoscaling automatically adjusts the resources of pods controlled by it | bool | `"false"` | no |
149150
| grant\_registry\_access | Grants created cluster-specific service account storage.objectViewer role. | bool | `"false"` | no |
150151
| horizontal\_pod\_autoscaling | Enable horizontal pod autoscaling addon | bool | `"true"` | no |
@@ -181,6 +182,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
181182
| project\_id | The project ID to host the cluster in (required) | string | n/a | yes |
182183
| region | The region to host the cluster in (optional if zonal cluster / required if regional) | string | `"null"` | no |
183184
| regional | Whether is a regional cluster (zonal cluster if set false. WARNING: changing this after cluster creation is destructive!) | bool | `"true"` | no |
185+
| release\_channel | (Beta) The release channel of this cluster. Accepted values are `UNSPECIFIED`, `RAPID`, `REGULAR` and `STABLE`. Defaults to `UNSPECIFIED`. | string | `"UNSPECIFIED"` | no |
184186
| remove\_default\_node\_pool | Remove default node pool while setting up the cluster | bool | `"false"` | no |
185187
| resource\_usage\_export\_dataset\_id | The dataset id for which network egress metering for this cluster will be enabled. If enabled, a daemonset will be created in the cluster to meter network egress traffic. | string | `""` | no |
186188
| sandbox\_enabled | (Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` and `node_version` = `1.12.7-gke.17` or later to use it). | bool | `"false"` | no |
@@ -214,6 +216,8 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
214216
| node\_pools\_versions | List of node pools versions |
215217
| pod\_security\_policy\_enabled | Whether pod security policy is enabled |
216218
| region | Cluster region |
219+
| release\_channel | The release channel of this cluster |
220+
| release\_channel\_enabled | Whether release channel is enabled |
217221
| service\_account | The service account to default running nodes as if not overridden in `node_pools`. |
218222
| type | Cluster type (regional / zonal) |
219223
| vertical\_pod\_autoscaling\_enabled | Whether veritical pod autoscaling is enabled |

modules/beta-public-cluster/cluster.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ resource "google_container_cluster" "primary" {
4141
}
4242
}
4343

44+
dynamic "release_channel" {
45+
for_each = local.release_channel
46+
47+
content {
48+
channel = release_channel.value.channel
49+
}
50+
}
51+
4452
subnetwork = data.google_compute_subnetwork.gke_subnetwork.self_link
4553
min_master_version = local.master_version
4654

modules/beta-public-cluster/main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ locals {
4444
node_version_zonal = var.node_version != "" && ! var.regional ? var.node_version : local.master_version_zonal
4545
master_version = var.regional ? local.master_version_regional : local.master_version_zonal
4646
node_version = var.regional ? local.node_version_regional : local.node_version_zonal
47+
release_channel = var.enable_release_channel ? [{ channel : var.release_channel }] : []
48+
4749

4850
custom_kube_dns_config = length(keys(var.stub_domains)) > 0
4951
upstream_nameservers_config = length(var.upstream_nameservers) > 0

modules/beta-public-cluster/outputs.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,3 +149,12 @@ output "vertical_pod_autoscaling_enabled" {
149149
value = local.cluster_vertical_pod_autoscaling_enabled
150150
}
151151

152+
output "release_channel_enabled" {
153+
description = "Whether release channel is enabled"
154+
value = var.enable_release_channel
155+
}
156+
157+
output "release_channel" {
158+
description = "The release channel of this cluster"
159+
value = var.release_channel
160+
}

modules/beta-public-cluster/variables.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,3 +382,14 @@ variable "authenticator_security_group" {
382382
default = null
383383
}
384384

385+
variable "enable_release_channel" {
386+
type = bool
387+
description = "(Beta) Whether release channel is configured for this cluster."
388+
default = false
389+
}
390+
391+
variable "release_channel" {
392+
type = string
393+
description = "(Beta) The release channel of this cluster. Accepted values are `UNSPECIFIED`, `RAPID`, `REGULAR` and `STABLE`. Defaults to `UNSPECIFIED`."
394+
default = "UNSPECIFIED"
395+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
174174
| node\_version | The Kubernetes version of the node pools. Defaults kubernetes_version (master) variable and can be overridden for individual node pools by setting the `version` key on them. Must be empyty or set the same as master at cluster creation. | string | `""` | no |
175175
| non\_masquerade\_cidrs | List of strings in CIDR notation that specify the IP address ranges that do not use IP masquerading. | list(string) | `<list>` | no |
176176
| project\_id | The project ID to host the cluster in (required) | string | n/a | yes |
177-
| region | The region to host the cluster in (required) | string | n/a | yes |
177+
| region | The region to host the cluster in (optional if zonal cluster / required if regional) | string | `"null"` | no |
178178
| regional | Whether is a regional cluster (zonal cluster if set false. WARNING: changing this after cluster creation is destructive!) | bool | `"true"` | no |
179179
| remove\_default\_node\_pool | Remove default node pool while setting up the cluster | bool | `"false"` | no |
180180
| 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 |

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ resource "google_container_cluster" "primary" {
4141
}
4242
}
4343

44+
4445
subnetwork = data.google_compute_subnetwork.gke_subnetwork.self_link
4546
min_master_version = local.master_version
4647

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ data "google_compute_zones" "available" {
2323
provider = google
2424

2525
project = var.project_id
26-
region = var.region
26+
region = local.region
2727
}
2828

2929
resource "random_shuffle" "available_zones" {
@@ -34,6 +34,7 @@ resource "random_shuffle" "available_zones" {
3434
locals {
3535
// location
3636
location = var.regional ? var.region : var.zones[0]
37+
region = var.region == null ? join("-", slice(split("-", var.zones[0]), 0, 2)) : var.region
3738
// for regional cluster - use var.zones if provided, use available otherwise, for zonal cluster use var.zones with first element extracted
3839
node_locations = var.regional ? coalescelist(compact(var.zones), sort(random_shuffle.available_zones.result)) : slice(var.zones, 1, length(var.zones))
3940
// kuberentes version
@@ -44,6 +45,7 @@ locals {
4445
master_version = var.regional ? local.master_version_regional : local.master_version_zonal
4546
node_version = var.regional ? local.node_version_regional : local.node_version_zonal
4647

48+
4749
custom_kube_dns_config = length(keys(var.stub_domains)) > 0
4850
upstream_nameservers_config = length(var.upstream_nameservers) > 0
4951
network_project_id = var.network_project_id != "" ? var.network_project_id : var.project_id

modules/private-cluster-update-variant/networks.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ data "google_compute_subnetwork" "gke_subnetwork" {
2727
provider = google
2828

2929
name = var.subnetwork
30-
region = var.region
30+
region = local.region
3131
project = local.network_project_id
3232
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ variable "regional" {
4040

4141
variable "region" {
4242
type = string
43-
description = "The region to host the cluster in (required)"
43+
description = "The region to host the cluster in (optional if zonal cluster / required if regional)"
44+
default = null
4445
}
4546

4647
variable "zones" {

modules/private-cluster/cluster.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ resource "google_container_cluster" "primary" {
4141
}
4242
}
4343

44+
4445
subnetwork = data.google_compute_subnetwork.gke_subnetwork.self_link
4546
min_master_version = local.master_version
4647

0 commit comments

Comments
 (0)