Skip to content

Commit f962275

Browse files
authored
Merge branch 'master' into fast_socket
2 parents d4f4d0a + 1f85f66 commit f962275

File tree

48 files changed

+315
-57
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+315
-57
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ Then perform the following commands on the root folder:
264264
| cluster\_id | Cluster ID |
265265
| dns\_cache\_enabled | Whether DNS Cache enabled |
266266
| endpoint | Cluster endpoint |
267+
| endpoint\_dns | Cluster endpoint DNS |
267268
| fleet\_membership | Fleet membership (if registered) |
268269
| gateway\_api\_channel | The gateway api channel of this cluster. |
269270
| horizontal\_pod\_autoscaling\_enabled | Whether horizontal pod autoscaling enabled |

autogen/main/cluster.tf.tmpl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,15 @@ resource "google_container_cluster" "primary" {
637637
}
638638
}
639639
}
640+
641+
dynamic "control_plane_endpoints_config" {
642+
for_each = var.enable_private_endpoint && var.deploy_using_private_endpoint ? [1] : [0]
643+
content {
644+
dns_endpoint_config {
645+
allow_external_traffic = var.deploy_using_private_endpoint
646+
}
647+
}
648+
}
640649
{% endif %}
641650

642651
{% if autopilot_cluster != true %}
@@ -723,8 +732,6 @@ resource "google_container_cluster" "primary" {
723732
{% if update_variant %}
724733
locals {
725734
force_node_pool_recreation_resources = [
726-
"disk_size_gb",
727-
"disk_type",
728735
"accelerator_count",
729736
"accelerator_type",
730737
"gpu_partition_size",
@@ -737,15 +744,13 @@ locals {
737744
{% if beta_cluster %}
738745
"local_ssd_ephemeral_count",
739746
{% endif %}
740-
"machine_type",
741747
"placement_policy",
742748
"max_pods_per_node",
743749
"min_cpu_platform",
744750
"pod_range",
745751
"preemptible",
746752
"spot",
747753
"service_account",
748-
"enable_gcfs",
749754
"enable_gvnic",
750755
"boot_disk_kms_key",
751756
"queued_provisioning",

autogen/main/outputs.tf.tmpl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,23 @@ output "endpoint" {
7676
]
7777
}
7878

79+
output "endpoint_dns" {
80+
description = "Cluster endpoint DNS"
81+
value = google_container_cluster.primary.control_plane_endpoints_config[0].dns_endpoint_config[0].endpoint
82+
depends_on = [
83+
/* Nominally, the endpoint is populated as soon as it is known to Terraform.
84+
* However, the cluster may not be in a usable state yet. Therefore any
85+
* resources dependent on the cluster being up will fail to deploy. With
86+
* this explicit dependency, dependent resources can wait for the cluster
87+
* to be up.
88+
*/
89+
google_container_cluster.primary,
90+
{% if autopilot_cluster != true %}
91+
google_container_node_pool.pools,
92+
{% endif %}
93+
]
94+
}
95+
7996
output "min_master_version" {
8097
description = "Minimum master kubernetes version"
8198
value = local.cluster_min_master_version

autogen/main/versions.tf.tmpl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2022 Google LLC
2+
* Copyright 2022-2024 Google LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,33 +24,33 @@ terraform {
2424
required_providers {
2525
google = {
2626
source = "hashicorp/google"
27-
version = ">= 6.7.0, < 7"
27+
version = ">= 6.11.0, < 7"
2828
}
2929
google-beta = {
3030
source = "hashicorp/google-beta"
31-
version = ">= 6.7.0, < 7"
31+
version = ">= 6.11.0, < 7"
3232
}
3333
{% elif beta_cluster and autopilot_cluster %}
3434
required_providers {
3535
google = {
3636
source = "hashicorp/google"
37-
version = ">= 6.8.0, < 7"
37+
version = ">= 6.11.0, < 7"
3838
}
3939
google-beta = {
4040
source = "hashicorp/google-beta"
41-
version = ">= 6.8.0, < 7"
41+
version = ">= 6.11.0, < 7"
4242
}
4343
{% elif autopilot_cluster %}
4444
required_providers {
4545
google = {
4646
source = "hashicorp/google"
47-
version = ">= 6.8.0, < 7"
47+
version = ">= 6.11.0, < 7"
4848
}
4949
{% else %}
5050
required_providers {
5151
google = {
5252
source = "hashicorp/google"
53-
version = ">= 6.7.0, < 7"
53+
version = ">= 6.11.0, < 7"
5454
}
5555
{% endif %}
5656
kubernetes = {

autogen/safer-cluster/outputs.tf.tmpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ output "endpoint" {
5252
value = module.gke.endpoint
5353
}
5454

55+
output "endpoint_dns" {
56+
description = "Cluster endpoint DNS"
57+
value = module.gke.endpoint_dns
58+
}
59+
5560
output "min_master_version" {
5661
description = "Minimum master kubernetes version"
5762
value = module.gke.min_master_version

docs/upgrading_to_v35.0.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,47 @@ The Terraform Kubernetes Engine Module now requires version 6 of the Google Clou
66

77
### Private Cluster Sub-Modules Endpoint Output
88
The private cluster sub-modules now return the cluster's private endpoint for the `endpoint` output when the `enable_private_endpoint` argument is `true`, regardless of the `deploy_using_private_endpoint` argument value.
9+
10+
## Update variant random ID keepers updated
11+
12+
The v35.0 release updates the keepers for the update variant modules. This will force a recreation of the nodepools.
13+
14+
To avoid this, it is possible to edit the remote state of the `random_id` resource to add the new attributes.
15+
16+
1. Perform a `terraform plan` as normal, identifying the `random_id` resource(s) changing and the new/removed attributes
17+
```tf
18+
~ keepers = { # forces replacement
19+
- "disk_type" = "" -> null
20+
- "disk_size_gb" = "" -> null
21+
- "machine_type" = "" -> null
22+
- "enable_gcfs" = "" -> null
23+
# (19 unchanged elements hidden)
24+
}
25+
# (2 unchanged attributes hidden)
26+
}
27+
```
28+
2. Pull the remote state locally: `terraform state pull > default.tfstate`
29+
3. Back up the original remote state: `cp default.tfstate original.tfstate`
30+
4. Edit the `random_id` resource(s) to add/remove the attributes from the `terraform plan` step
31+
```diff
32+
"attributes": {
33+
"b64_std": "pool-02-vb4=",
34+
"b64_url": "pool-02-vb4",
35+
"byte_length": 2,
36+
"dec": "pool-02-48574",
37+
"hex": "pool-02-bdbe",
38+
"id": "vb4",
39+
"keepers": {
40+
...
41+
"taints": "",
42+
- "disk_size_gb": "",
43+
- "enable_gcfs": "",
44+
- "machine_type": "",
45+
- "disk_type": "",
46+
},
47+
"prefix": "pool-02-"
48+
}
49+
```
50+
1. Bump the serial number at the top
51+
2. Push the modified state to the remote `terraform state push default.tfstate`
52+
3. Confirm the `random_id` resource(s) no longer changes (or the corresponding `nodepool`) in a `terraform plan`

examples/safer_cluster_iap_bastion/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ To deploy this example:
6060
| ca\_certificate | Cluster ca certificate (base64 encoded) |
6161
| cluster\_name | Cluster name |
6262
| endpoint | Cluster endpoint |
63+
| endpoint\_dns | Cluster endpoint DNS |
6364
| get\_credentials\_command | gcloud get-credentials command to generate kubeconfig for the private cluster |
6465
| keyring | The name of the keyring. |
6566
| keyring\_resource | The location of the keyring. |

examples/safer_cluster_iap_bastion/bastion.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,6 @@ module "bastion" {
3434
startup_script = templatefile("${path.module}/templates/startup-script.tftpl", {})
3535
members = var.bastion_members
3636
shielded_vm = "false"
37+
38+
service_account_roles = ["roles/container.viewer"]
3739
}

examples/safer_cluster_iap_bastion/outputs.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ output "endpoint" {
3535
value = module.gke.endpoint
3636
}
3737

38+
output "endpoint_dns" {
39+
sensitive = true
40+
description = "Cluster endpoint DNS"
41+
value = module.gke.endpoint_dns
42+
}
43+
3844
output "master_authorized_networks_config" {
3945
description = "Networks from which access to master is permitted"
4046
value = module.gke.master_authorized_networks_config

examples/simple_regional_beta/main.tf

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@ locals {
2020

2121
data "google_client_config" "default" {}
2222

23-
provider "kubernetes" {
24-
host = "https://${module.gke.endpoint}"
25-
token = data.google_client_config.default.access_token
26-
cluster_ca_certificate = base64decode(module.gke.ca_certificate)
27-
}
28-
2923
module "gke" {
3024
source = "terraform-google-modules/kubernetes-engine/google//modules/beta-public-cluster"
3125
version = "~> 34.0"

0 commit comments

Comments
 (0)