Skip to content

Commit

Permalink
feat: Make confidential_nodes GA (#1815)
Browse files Browse the repository at this point in the history
Signed-off-by: drfaust92 <[email protected]>
  • Loading branch information
DrFaust92 authored Jan 26, 2024
1 parent 495623e commit 322a5ee
Show file tree
Hide file tree
Showing 27 changed files with 57 additions and 10 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ Then perform the following commands on the root folder:
| 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 |
| dns\_cache | The status of the NodeLocal DNSCache addon. | `bool` | `false` | no |
| enable\_binary\_authorization | Enable BinAuthZ Admission controller | `bool` | `false` | no |
| enable\_confidential\_nodes | An optional flag to enable confidential node config. | `bool` | `false` | no |
| enable\_cost\_allocation | Enables Cost Allocation Feature and the cluster name and namespace of your GKE workloads appear in the labels field of the billing export to BigQuery | `bool` | `false` | no |
| enable\_kubernetes\_alpha | Whether to enable Kubernetes Alpha features for this cluster. Note that when this option is enabled, the cluster cannot be upgraded and will be automatically deleted after 30 days. | `bool` | `false` | no |
| enable\_mesh\_certificates | Controls the issuance of workload mTLS certificates. When enabled the GKE Workload Identity Certificates controller and node agent will be deployed in the cluster. Requires Workload Identity. | `bool` | `false` | no |
Expand Down
3 changes: 1 addition & 2 deletions autogen/main/cluster.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,13 @@ resource "google_container_cluster" "primary" {
enabled = var.enable_cost_allocation
}
}
{% if beta_cluster %}

dynamic "confidential_nodes" {
for_each = local.confidential_node_config
content {
enabled = confidential_nodes.value.enabled
}
}
{% endif %}

subnetwork = "projects/${local.network_project_id}/regions/${local.region}/subnetworks/${var.subnetwork}"

Expand Down
2 changes: 1 addition & 1 deletion autogen/main/main.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ locals {
cluster_workload_identity_config = ! local.workload_identity_enabled ? [] : var.identity_namespace == "enabled" ? [{
workload_pool = "${var.project_id}.svc.id.goog" }] : [{ workload_pool = var.identity_namespace
}]
confidential_node_config = var.enable_confidential_nodes == true ? [{ enabled = true }] : []
{% if autopilot_cluster != true %}
cluster_mesh_certificates_config = local.workload_identity_enabled ? [{
enable_certificates = var.enable_mesh_certificates
Expand All @@ -234,7 +235,6 @@ locals {
{% endif %}
cluster_pod_security_policy_enabled = local.cluster_output_pod_security_policy_enabled
cluster_intranode_visibility_enabled = local.cluster_output_intranode_visbility_enabled
confidential_node_config = var.enable_confidential_nodes == true ? [{ enabled = true }] : []

# /BETA features
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion autogen/main/variables.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -544,12 +544,12 @@ variable "shadow_firewall_rules_log_config" {
}
}

{% if beta_cluster %}
variable "enable_confidential_nodes" {
type = bool
description = "An optional flag to enable confidential node config."
default = false
}
{% if beta_cluster %}

variable "workload_vulnerability_mode" {
description = "(beta) Vulnerability mode."
Expand Down
7 changes: 7 additions & 0 deletions cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ resource "google_container_cluster" "primary" {
}
}

dynamic "confidential_nodes" {
for_each = local.confidential_node_config
content {
enabled = confidential_nodes.value.enabled
}
}

subnetwork = "projects/${local.network_project_id}/regions/${local.region}/subnetworks/${var.subnetwork}"

default_snat_status {
Expand Down
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ locals {
cluster_workload_identity_config = !local.workload_identity_enabled ? [] : var.identity_namespace == "enabled" ? [{
workload_pool = "${var.project_id}.svc.id.goog" }] : [{ workload_pool = var.identity_namespace
}]
confidential_node_config = var.enable_confidential_nodes == true ? [{ enabled = true }] : []
cluster_mesh_certificates_config = local.workload_identity_enabled ? [{
enable_certificates = var.enable_mesh_certificates
}] : []
Expand Down
1 change: 1 addition & 0 deletions modules/beta-autopilot-private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ resource "google_container_cluster" "primary" {
enabled = var.enable_cost_allocation
}
}

dynamic "confidential_nodes" {
for_each = local.confidential_node_config
content {
Expand Down
2 changes: 1 addition & 1 deletion modules/beta-autopilot-private-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,13 @@ locals {
cluster_workload_identity_config = !local.workload_identity_enabled ? [] : var.identity_namespace == "enabled" ? [{
workload_pool = "${var.project_id}.svc.id.goog" }] : [{ workload_pool = var.identity_namespace
}]
confidential_node_config = var.enable_confidential_nodes == true ? [{ enabled = true }] : []

# BETA features
cluster_istio_enabled = !local.cluster_output_istio_disabled
cluster_dns_cache_enabled = var.dns_cache
cluster_pod_security_policy_enabled = local.cluster_output_pod_security_policy_enabled
cluster_intranode_visibility_enabled = local.cluster_output_intranode_visbility_enabled
confidential_node_config = var.enable_confidential_nodes == true ? [{ enabled = true }] : []

# /BETA features

Expand Down
1 change: 1 addition & 0 deletions modules/beta-autopilot-public-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ resource "google_container_cluster" "primary" {
enabled = var.enable_cost_allocation
}
}

dynamic "confidential_nodes" {
for_each = local.confidential_node_config
content {
Expand Down
2 changes: 1 addition & 1 deletion modules/beta-autopilot-public-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ locals {
cluster_workload_identity_config = !local.workload_identity_enabled ? [] : var.identity_namespace == "enabled" ? [{
workload_pool = "${var.project_id}.svc.id.goog" }] : [{ workload_pool = var.identity_namespace
}]
confidential_node_config = var.enable_confidential_nodes == true ? [{ enabled = true }] : []

# BETA features
cluster_istio_enabled = !local.cluster_output_istio_disabled
cluster_dns_cache_enabled = var.dns_cache
cluster_pod_security_policy_enabled = local.cluster_output_pod_security_policy_enabled
cluster_intranode_visibility_enabled = local.cluster_output_intranode_visbility_enabled
confidential_node_config = var.enable_confidential_nodes == true ? [{ enabled = true }] : []

# /BETA features

Expand Down
1 change: 1 addition & 0 deletions modules/beta-private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ resource "google_container_cluster" "primary" {
enabled = var.enable_cost_allocation
}
}

dynamic "confidential_nodes" {
for_each = local.confidential_node_config
content {
Expand Down
2 changes: 1 addition & 1 deletion modules/beta-private-cluster-update-variant/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ locals {
cluster_workload_identity_config = !local.workload_identity_enabled ? [] : var.identity_namespace == "enabled" ? [{
workload_pool = "${var.project_id}.svc.id.goog" }] : [{ workload_pool = var.identity_namespace
}]
confidential_node_config = var.enable_confidential_nodes == true ? [{ enabled = true }] : []
cluster_mesh_certificates_config = local.workload_identity_enabled ? [{
enable_certificates = var.enable_mesh_certificates
}] : []
Expand All @@ -191,7 +192,6 @@ locals {
cluster_telemetry_type_is_set = var.cluster_telemetry_type != null
cluster_pod_security_policy_enabled = local.cluster_output_pod_security_policy_enabled
cluster_intranode_visibility_enabled = local.cluster_output_intranode_visbility_enabled
confidential_node_config = var.enable_confidential_nodes == true ? [{ enabled = true }] : []

# /BETA features

Expand Down
1 change: 1 addition & 0 deletions modules/beta-private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ resource "google_container_cluster" "primary" {
enabled = var.enable_cost_allocation
}
}

dynamic "confidential_nodes" {
for_each = local.confidential_node_config
content {
Expand Down
2 changes: 1 addition & 1 deletion modules/beta-private-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ locals {
cluster_workload_identity_config = !local.workload_identity_enabled ? [] : var.identity_namespace == "enabled" ? [{
workload_pool = "${var.project_id}.svc.id.goog" }] : [{ workload_pool = var.identity_namespace
}]
confidential_node_config = var.enable_confidential_nodes == true ? [{ enabled = true }] : []
cluster_mesh_certificates_config = local.workload_identity_enabled ? [{
enable_certificates = var.enable_mesh_certificates
}] : []
Expand All @@ -191,7 +192,6 @@ locals {
cluster_telemetry_type_is_set = var.cluster_telemetry_type != null
cluster_pod_security_policy_enabled = local.cluster_output_pod_security_policy_enabled
cluster_intranode_visibility_enabled = local.cluster_output_intranode_visbility_enabled
confidential_node_config = var.enable_confidential_nodes == true ? [{ enabled = true }] : []

# /BETA features

Expand Down
1 change: 1 addition & 0 deletions modules/beta-public-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ resource "google_container_cluster" "primary" {
enabled = var.enable_cost_allocation
}
}

dynamic "confidential_nodes" {
for_each = local.confidential_node_config
content {
Expand Down
2 changes: 1 addition & 1 deletion modules/beta-public-cluster-update-variant/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ locals {
cluster_workload_identity_config = !local.workload_identity_enabled ? [] : var.identity_namespace == "enabled" ? [{
workload_pool = "${var.project_id}.svc.id.goog" }] : [{ workload_pool = var.identity_namespace
}]
confidential_node_config = var.enable_confidential_nodes == true ? [{ enabled = true }] : []
cluster_mesh_certificates_config = local.workload_identity_enabled ? [{
enable_certificates = var.enable_mesh_certificates
}] : []
Expand All @@ -190,7 +191,6 @@ locals {
cluster_telemetry_type_is_set = var.cluster_telemetry_type != null
cluster_pod_security_policy_enabled = local.cluster_output_pod_security_policy_enabled
cluster_intranode_visibility_enabled = local.cluster_output_intranode_visbility_enabled
confidential_node_config = var.enable_confidential_nodes == true ? [{ enabled = true }] : []

# /BETA features

Expand Down
1 change: 1 addition & 0 deletions modules/beta-public-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ resource "google_container_cluster" "primary" {
enabled = var.enable_cost_allocation
}
}

dynamic "confidential_nodes" {
for_each = local.confidential_node_config
content {
Expand Down
2 changes: 1 addition & 1 deletion modules/beta-public-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ locals {
cluster_workload_identity_config = !local.workload_identity_enabled ? [] : var.identity_namespace == "enabled" ? [{
workload_pool = "${var.project_id}.svc.id.goog" }] : [{ workload_pool = var.identity_namespace
}]
confidential_node_config = var.enable_confidential_nodes == true ? [{ enabled = true }] : []
cluster_mesh_certificates_config = local.workload_identity_enabled ? [{
enable_certificates = var.enable_mesh_certificates
}] : []
Expand All @@ -190,7 +191,6 @@ locals {
cluster_telemetry_type_is_set = var.cluster_telemetry_type != null
cluster_pod_security_policy_enabled = local.cluster_output_pod_security_policy_enabled
cluster_intranode_visibility_enabled = local.cluster_output_intranode_visbility_enabled
confidential_node_config = var.enable_confidential_nodes == true ? [{ enabled = true }] : []

# /BETA features

Expand Down
1 change: 1 addition & 0 deletions modules/private-cluster-update-variant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ Then perform the following commands on the root folder:
| 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 |
| dns\_cache | The status of the NodeLocal DNSCache addon. | `bool` | `false` | no |
| enable\_binary\_authorization | Enable BinAuthZ Admission controller | `bool` | `false` | no |
| enable\_confidential\_nodes | An optional flag to enable confidential node config. | `bool` | `false` | no |
| enable\_cost\_allocation | Enables Cost Allocation Feature and the cluster name and namespace of your GKE workloads appear in the labels field of the billing export to BigQuery | `bool` | `false` | no |
| enable\_kubernetes\_alpha | Whether to enable Kubernetes Alpha features for this cluster. Note that when this option is enabled, the cluster cannot be upgraded and will be automatically deleted after 30 days. | `bool` | `false` | no |
| enable\_mesh\_certificates | Controls the issuance of workload mTLS certificates. When enabled the GKE Workload Identity Certificates controller and node agent will be deployed in the cluster. Requires Workload Identity. | `bool` | `false` | no |
Expand Down
7 changes: 7 additions & 0 deletions modules/private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ resource "google_container_cluster" "primary" {
}
}

dynamic "confidential_nodes" {
for_each = local.confidential_node_config
content {
enabled = confidential_nodes.value.enabled
}
}

subnetwork = "projects/${local.network_project_id}/regions/${local.region}/subnetworks/${var.subnetwork}"

default_snat_status {
Expand Down
1 change: 1 addition & 0 deletions modules/private-cluster-update-variant/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ locals {
cluster_workload_identity_config = !local.workload_identity_enabled ? [] : var.identity_namespace == "enabled" ? [{
workload_pool = "${var.project_id}.svc.id.goog" }] : [{ workload_pool = var.identity_namespace
}]
confidential_node_config = var.enable_confidential_nodes == true ? [{ enabled = true }] : []
cluster_mesh_certificates_config = local.workload_identity_enabled ? [{
enable_certificates = var.enable_mesh_certificates
}] : []
Expand Down
5 changes: 5 additions & 0 deletions modules/private-cluster-update-variant/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,11 @@ variable "shadow_firewall_rules_log_config" {
}
}

variable "enable_confidential_nodes" {
type = bool
description = "An optional flag to enable confidential node config."
default = false
}

variable "security_posture_mode" {
description = "Security posture mode. Accepted values are `DISABLED` and `BASIC`. Defaults to `DISABLED`."
Expand Down
1 change: 1 addition & 0 deletions modules/private-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ Then perform the following commands on the root folder:
| 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 |
| dns\_cache | The status of the NodeLocal DNSCache addon. | `bool` | `false` | no |
| enable\_binary\_authorization | Enable BinAuthZ Admission controller | `bool` | `false` | no |
| enable\_confidential\_nodes | An optional flag to enable confidential node config. | `bool` | `false` | no |
| enable\_cost\_allocation | Enables Cost Allocation Feature and the cluster name and namespace of your GKE workloads appear in the labels field of the billing export to BigQuery | `bool` | `false` | no |
| enable\_kubernetes\_alpha | Whether to enable Kubernetes Alpha features for this cluster. Note that when this option is enabled, the cluster cannot be upgraded and will be automatically deleted after 30 days. | `bool` | `false` | no |
| enable\_mesh\_certificates | Controls the issuance of workload mTLS certificates. When enabled the GKE Workload Identity Certificates controller and node agent will be deployed in the cluster. Requires Workload Identity. | `bool` | `false` | no |
Expand Down
7 changes: 7 additions & 0 deletions modules/private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ resource "google_container_cluster" "primary" {
}
}

dynamic "confidential_nodes" {
for_each = local.confidential_node_config
content {
enabled = confidential_nodes.value.enabled
}
}

subnetwork = "projects/${local.network_project_id}/regions/${local.region}/subnetworks/${var.subnetwork}"

default_snat_status {
Expand Down
1 change: 1 addition & 0 deletions modules/private-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ locals {
cluster_workload_identity_config = !local.workload_identity_enabled ? [] : var.identity_namespace == "enabled" ? [{
workload_pool = "${var.project_id}.svc.id.goog" }] : [{ workload_pool = var.identity_namespace
}]
confidential_node_config = var.enable_confidential_nodes == true ? [{ enabled = true }] : []
cluster_mesh_certificates_config = local.workload_identity_enabled ? [{
enable_certificates = var.enable_mesh_certificates
}] : []
Expand Down
5 changes: 5 additions & 0 deletions modules/private-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,11 @@ variable "shadow_firewall_rules_log_config" {
}
}

variable "enable_confidential_nodes" {
type = bool
description = "An optional flag to enable confidential node config."
default = false
}

variable "security_posture_mode" {
description = "Security posture mode. Accepted values are `DISABLED` and `BASIC`. Defaults to `DISABLED`."
Expand Down
5 changes: 5 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,11 @@ variable "shadow_firewall_rules_log_config" {
}
}

variable "enable_confidential_nodes" {
type = bool
description = "An optional flag to enable confidential node config."
default = false
}

variable "security_posture_mode" {
description = "Security posture mode. Accepted values are `DISABLED` and `BASIC`. Defaults to `DISABLED`."
Expand Down

0 comments on commit 322a5ee

Please sign in to comment.