diff --git a/autogen/main/variables.tf.tmpl b/autogen/main/variables.tf.tmpl index 080417549..784487db5 100644 --- a/autogen/main/variables.tf.tmpl +++ b/autogen/main/variables.tf.tmpl @@ -454,7 +454,7 @@ variable "pod_security_policy_config" { variable "node_metadata" { description = "Specifies how node metadata is exposed to the workload running on the node" - default = "SECURE" + default = "GKE_METADATA_SERVER" type = string } diff --git a/examples/simple_regional_beta/README.md b/examples/simple_regional_beta/README.md index c0771e73b..916cb254d 100644 --- a/examples/simple_regional_beta/README.md +++ b/examples/simple_regional_beta/README.md @@ -18,7 +18,6 @@ This example illustrates how to create a simple cluster with beta features. | ip\_range\_services | The secondary ip range to use for services | string | n/a | yes | | istio | Boolean to enable / disable Istio | string | `"true"` | no | | network | The VPC network to host the cluster in | string | n/a | yes | -| node\_metadata | Specifies how node metadata is exposed to the workload running on the node | string | `"SECURE"` | no | | node\_pools | List of maps containing node pools | list(map(string)) | `` | no | | 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 | `` | no | | project\_id | The project ID to host the cluster in | string | n/a | yes | diff --git a/examples/simple_regional_beta/main.tf b/examples/simple_regional_beta/main.tf index 4bd63e67e..5a1e9cf77 100644 --- a/examples/simple_regional_beta/main.tf +++ b/examples/simple_regional_beta/main.tf @@ -40,7 +40,6 @@ module "gke" { cloudrun = var.cloudrun dns_cache = var.dns_cache gce_pd_csi_driver = var.gce_pd_csi_driver - node_metadata = var.node_metadata sandbox_enabled = var.sandbox_enabled remove_default_node_pool = var.remove_default_node_pool node_pools = var.node_pools diff --git a/examples/simple_regional_beta/variables.tf b/examples/simple_regional_beta/variables.tf index a3bb1acae..793b721d6 100644 --- a/examples/simple_regional_beta/variables.tf +++ b/examples/simple_regional_beta/variables.tf @@ -69,12 +69,6 @@ variable "gce_pd_csi_driver" { default = false } -variable "node_metadata" { - description = "Specifies how node metadata is exposed to the workload running on the node" - default = "SECURE" - type = string -} - variable "sandbox_enabled" { type = bool description = "(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)." diff --git a/modules/beta-private-cluster-update-variant/README.md b/modules/beta-private-cluster-update-variant/README.md index 0a545fab0..565241cf6 100644 --- a/modules/beta-private-cluster-update-variant/README.md +++ b/modules/beta-private-cluster-update-variant/README.md @@ -209,7 +209,7 @@ Then perform the following commands on the root folder: | network\_policy | Enable network policy addon | bool | `"true"` | no | | network\_policy\_provider | The network policy provider. | string | `"CALICO"` | no | | network\_project\_id | The project ID of the shared VPC's host (for shared vpc support) | string | `""` | no | -| node\_metadata | Specifies how node metadata is exposed to the workload running on the node | string | `"SECURE"` | no | +| node\_metadata | Specifies how node metadata is exposed to the workload running on the node | string | `"GKE_METADATA_SERVER"` | no | | node\_pools | List of maps containing node pools | list(map(string)) | `` | no | | node\_pools\_labels | Map of maps containing node labels by node-pool name | map(map(string)) | `` | no | | node\_pools\_metadata | Map of maps containing node metadata by node-pool name | map(map(string)) | `` | no | diff --git a/modules/beta-private-cluster-update-variant/variables.tf b/modules/beta-private-cluster-update-variant/variables.tf index 7f77f3d05..250aae76c 100644 --- a/modules/beta-private-cluster-update-variant/variables.tf +++ b/modules/beta-private-cluster-update-variant/variables.tf @@ -447,7 +447,7 @@ variable "pod_security_policy_config" { variable "node_metadata" { description = "Specifies how node metadata is exposed to the workload running on the node" - default = "SECURE" + default = "GKE_METADATA_SERVER" type = string } diff --git a/modules/beta-private-cluster/README.md b/modules/beta-private-cluster/README.md index 08c467a56..03cc24799 100644 --- a/modules/beta-private-cluster/README.md +++ b/modules/beta-private-cluster/README.md @@ -187,7 +187,7 @@ Then perform the following commands on the root folder: | network\_policy | Enable network policy addon | bool | `"true"` | no | | network\_policy\_provider | The network policy provider. | string | `"CALICO"` | no | | network\_project\_id | The project ID of the shared VPC's host (for shared vpc support) | string | `""` | no | -| node\_metadata | Specifies how node metadata is exposed to the workload running on the node | string | `"SECURE"` | no | +| node\_metadata | Specifies how node metadata is exposed to the workload running on the node | string | `"GKE_METADATA_SERVER"` | no | | node\_pools | List of maps containing node pools | list(map(string)) | `` | no | | node\_pools\_labels | Map of maps containing node labels by node-pool name | map(map(string)) | `` | no | | node\_pools\_metadata | Map of maps containing node metadata by node-pool name | map(map(string)) | `` | no | diff --git a/modules/beta-private-cluster/variables.tf b/modules/beta-private-cluster/variables.tf index 7f77f3d05..250aae76c 100644 --- a/modules/beta-private-cluster/variables.tf +++ b/modules/beta-private-cluster/variables.tf @@ -447,7 +447,7 @@ variable "pod_security_policy_config" { variable "node_metadata" { description = "Specifies how node metadata is exposed to the workload running on the node" - default = "SECURE" + default = "GKE_METADATA_SERVER" type = string } diff --git a/modules/beta-public-cluster/README.md b/modules/beta-public-cluster/README.md index 4cd8e84b9..2a3ba7a69 100644 --- a/modules/beta-public-cluster/README.md +++ b/modules/beta-public-cluster/README.md @@ -165,7 +165,7 @@ Then perform the following commands on the root folder: | network\_policy | Enable network policy addon | bool | `"true"` | no | | network\_policy\_provider | The network policy provider. | string | `"CALICO"` | no | | network\_project\_id | The project ID of the shared VPC's host (for shared vpc support) | string | `""` | no | -| node\_metadata | Specifies how node metadata is exposed to the workload running on the node | string | `"SECURE"` | no | +| node\_metadata | Specifies how node metadata is exposed to the workload running on the node | string | `"GKE_METADATA_SERVER"` | no | | node\_pools | List of maps containing node pools | list(map(string)) | `` | no | | node\_pools\_labels | Map of maps containing node labels by node-pool name | map(map(string)) | `` | no | | node\_pools\_metadata | Map of maps containing node metadata by node-pool name | map(map(string)) | `` | no | diff --git a/modules/beta-public-cluster/variables.tf b/modules/beta-public-cluster/variables.tf index aadac5660..65f66f403 100644 --- a/modules/beta-public-cluster/variables.tf +++ b/modules/beta-public-cluster/variables.tf @@ -423,7 +423,7 @@ variable "pod_security_policy_config" { variable "node_metadata" { description = "Specifies how node metadata is exposed to the workload running on the node" - default = "SECURE" + default = "GKE_METADATA_SERVER" type = string } diff --git a/test/fixtures/beta_cluster/main.tf b/test/fixtures/beta_cluster/main.tf index 2b2d2556f..ed6a96bc7 100644 --- a/test/fixtures/beta_cluster/main.tf +++ b/test/fixtures/beta_cluster/main.tf @@ -63,8 +63,6 @@ module "this" { pod_security_policy_config = [{ enabled = true }] - - node_metadata = "EXPOSE" } data "google_client_config" "default" { diff --git a/test/fixtures/sandbox_enabled/example.tf b/test/fixtures/sandbox_enabled/example.tf index 920c5e179..b485b575a 100644 --- a/test/fixtures/sandbox_enabled/example.tf +++ b/test/fixtures/sandbox_enabled/example.tf @@ -27,7 +27,6 @@ module "example" { compute_engine_service_account = var.compute_engine_service_accounts[0] istio = false cloudrun = false - node_metadata = "UNSPECIFIED" sandbox_enabled = true remove_default_node_pool = true diff --git a/test/integration/beta_cluster/controls/gcloud.rb b/test/integration/beta_cluster/controls/gcloud.rb index 1b135e9c0..a31ff1cd5 100644 --- a/test/integration/beta_cluster/controls/gcloud.rb +++ b/test/integration/beta_cluster/controls/gcloud.rb @@ -74,8 +74,9 @@ end it "has the expected nodeMetadata conseal config" do - expect(data['nodeConfig']['workloadMetadataConfig']).to include({ - "nodeMetadata" => 'EXPOSE', + expect(data['nodeConfig']['workloadMetadataConfig']).to eq({ + "mode" => "GKE_METADATA", + "nodeMetadata" => 'GKE_METADATA_SERVER', }) end @@ -210,6 +211,19 @@ ) ) end + + it "has the expected node metadata for workload identity" do + expect(node_pools).to include( + including( + "config" => including( + "workloadMetadataConfig" => eq( + "mode" => "GKE_METADATA", + "nodeMetadata" => 'GKE_METADATA_SERVER', + ), + ), + ) + ) + end end end end