Skip to content

Commit

Permalink
feat: extend enable_secret_manager_addon to beta-autopilot clusters (#…
Browse files Browse the repository at this point in the history
…2017)

Co-authored-by: Andrew Peabody <[email protected]>
  • Loading branch information
arthurpang and apeabody authored Aug 1, 2024
1 parent c0f05fb commit 7f31e96
Show file tree
Hide file tree
Showing 16 changed files with 86 additions and 65 deletions.
14 changes: 7 additions & 7 deletions autogen/main/cluster.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,6 @@ resource "google_container_cluster" "primary" {
enable_intranode_visibility = var.enable_intranode_visibility

{% if beta_cluster %}
dynamic "secret_manager_config" {
for_each = var.enable_secret_manager_addon ? [var.enable_secret_manager_addon] : []
content {
enabled = secret_manager_config.value
}
}

dynamic "pod_security_policy_config" {
for_each = var.enable_pod_security_policy ? [var.enable_pod_security_policy] : []
content {
Expand All @@ -249,6 +242,13 @@ resource "google_container_cluster" "primary" {
enable_cilium_clusterwide_network_policy = var.enable_cilium_clusterwide_network_policy

{% if beta_cluster %}
dynamic "secret_manager_config" {
for_each = var.enable_secret_manager_addon ? [var.enable_secret_manager_addon] : []
content {
enabled = secret_manager_config.value
}
}

enable_fqdn_network_policy = var.enable_fqdn_network_policy
{% endif %}
{% if autopilot_cluster %}
Expand Down
11 changes: 5 additions & 6 deletions autogen/main/variables.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,11 @@ variable "enable_fqdn_network_policy" {
default = null
}

variable "enable_secret_manager_addon" {
description = "(Beta) Enable the Secret Manager add-on for this cluster"
type = bool
default = false
}
{% endif %}

variable "enable_cilium_clusterwide_network_policy" {
Expand Down Expand Up @@ -889,12 +894,6 @@ variable "enable_pod_security_policy" {
default = false
}

variable "enable_secret_manager_addon" {
description = "(Beta) Enable the Secret Manager add-on for this cluster"
type = bool
default = false
}

variable "sandbox_enabled" {
type = bool
description = "(Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` to use it)."
Expand Down
1 change: 1 addition & 0 deletions modules/beta-autopilot-private-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ Then perform the following commands on the root folder:
| enable\_private\_endpoint | Whether the master's internal IP address is used as the cluster endpoint | `bool` | `false` | no |
| enable\_private\_nodes | Whether nodes have internal IP addresses only | `bool` | `false` | no |
| enable\_resource\_consumption\_export | Whether to enable resource consumption metering on this cluster. When enabled, a table will be created in the resource export BigQuery dataset to store resource consumption data. The resulting table can be joined with the resource usage table or with BigQuery billing export. | `bool` | `true` | no |
| enable\_secret\_manager\_addon | (Beta) Enable the Secret Manager add-on for this cluster | `bool` | `false` | no |
| enable\_tpu | Enable Cloud TPU resources in the cluster. WARNING: changing this after cluster creation is destructive! | `bool` | `false` | no |
| enable\_vertical\_pod\_autoscaling | Vertical Pod Autoscaling automatically adjusts the resources of pods controlled by it | `bool` | `true` | no |
| firewall\_inbound\_ports | List of TCP ports for admission/webhook controllers. Either flag `add_master_webhook_firewall_rules` or `add_cluster_firewall_rules` (also adds egress rules) must be set to `true` for inbound-ports firewall rules to be applied. | `list(string)` | <pre>[<br> "8443",<br> "9443",<br> "15017"<br>]</pre> | no |
Expand Down
7 changes: 7 additions & 0 deletions modules/beta-autopilot-private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ resource "google_container_cluster" "primary" {

enable_cilium_clusterwide_network_policy = var.enable_cilium_clusterwide_network_policy

dynamic "secret_manager_config" {
for_each = var.enable_secret_manager_addon ? [var.enable_secret_manager_addon] : []
content {
enabled = secret_manager_config.value
}
}

enable_fqdn_network_policy = var.enable_fqdn_network_policy
enable_autopilot = true
dynamic "master_authorized_networks_config" {
Expand Down
5 changes: 5 additions & 0 deletions modules/beta-autopilot-private-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,11 @@ variable "enable_fqdn_network_policy" {
default = null
}

variable "enable_secret_manager_addon" {
description = "(Beta) Enable the Secret Manager add-on for this cluster"
type = bool
default = false
}

variable "enable_cilium_clusterwide_network_policy" {
type = bool
Expand Down
1 change: 1 addition & 0 deletions modules/beta-autopilot-public-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ Then perform the following commands on the root folder:
| enable\_l4\_ilb\_subsetting | Enable L4 ILB Subsetting on the cluster | `bool` | `false` | no |
| enable\_network\_egress\_export | Whether to enable network egress metering for this cluster. If enabled, a daemonset will be created in the cluster to meter network egress traffic. | `bool` | `false` | no |
| enable\_resource\_consumption\_export | Whether to enable resource consumption metering on this cluster. When enabled, a table will be created in the resource export BigQuery dataset to store resource consumption data. The resulting table can be joined with the resource usage table or with BigQuery billing export. | `bool` | `true` | no |
| enable\_secret\_manager\_addon | (Beta) Enable the Secret Manager add-on for this cluster | `bool` | `false` | no |
| enable\_tpu | Enable Cloud TPU resources in the cluster. WARNING: changing this after cluster creation is destructive! | `bool` | `false` | no |
| enable\_vertical\_pod\_autoscaling | Vertical Pod Autoscaling automatically adjusts the resources of pods controlled by it | `bool` | `true` | no |
| firewall\_inbound\_ports | List of TCP ports for admission/webhook controllers. Either flag `add_master_webhook_firewall_rules` or `add_cluster_firewall_rules` (also adds egress rules) must be set to `true` for inbound-ports firewall rules to be applied. | `list(string)` | <pre>[<br> "8443",<br> "9443",<br> "15017"<br>]</pre> | no |
Expand Down
7 changes: 7 additions & 0 deletions modules/beta-autopilot-public-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ resource "google_container_cluster" "primary" {

enable_cilium_clusterwide_network_policy = var.enable_cilium_clusterwide_network_policy

dynamic "secret_manager_config" {
for_each = var.enable_secret_manager_addon ? [var.enable_secret_manager_addon] : []
content {
enabled = secret_manager_config.value
}
}

enable_fqdn_network_policy = var.enable_fqdn_network_policy
enable_autopilot = true
dynamic "master_authorized_networks_config" {
Expand Down
5 changes: 5 additions & 0 deletions modules/beta-autopilot-public-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,11 @@ variable "enable_fqdn_network_policy" {
default = null
}

variable "enable_secret_manager_addon" {
description = "(Beta) Enable the Secret Manager add-on for this cluster"
type = bool
default = false
}

variable "enable_cilium_clusterwide_network_policy" {
type = bool
Expand Down
14 changes: 7 additions & 7 deletions modules/beta-private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,6 @@ resource "google_container_cluster" "primary" {
enable_tpu = var.enable_tpu
enable_intranode_visibility = var.enable_intranode_visibility

dynamic "secret_manager_config" {
for_each = var.enable_secret_manager_addon ? [var.enable_secret_manager_addon] : []
content {
enabled = secret_manager_config.value
}
}

dynamic "pod_security_policy_config" {
for_each = var.enable_pod_security_policy ? [var.enable_pod_security_policy] : []
content {
Expand All @@ -209,6 +202,13 @@ resource "google_container_cluster" "primary" {

enable_cilium_clusterwide_network_policy = var.enable_cilium_clusterwide_network_policy

dynamic "secret_manager_config" {
for_each = var.enable_secret_manager_addon ? [var.enable_secret_manager_addon] : []
content {
enabled = secret_manager_config.value
}
}

enable_fqdn_network_policy = var.enable_fqdn_network_policy
dynamic "master_authorized_networks_config" {
for_each = local.master_authorized_networks_config
Expand Down
11 changes: 5 additions & 6 deletions modules/beta-private-cluster-update-variant/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,11 @@ variable "enable_fqdn_network_policy" {
default = null
}

variable "enable_secret_manager_addon" {
description = "(Beta) Enable the Secret Manager add-on for this cluster"
type = bool
default = false
}

variable "enable_cilium_clusterwide_network_policy" {
type = bool
Expand Down Expand Up @@ -849,12 +854,6 @@ variable "enable_pod_security_policy" {
default = false
}

variable "enable_secret_manager_addon" {
description = "(Beta) Enable the Secret Manager add-on for this cluster"
type = bool
default = false
}

variable "sandbox_enabled" {
type = bool
description = "(Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` to use it)."
Expand Down
14 changes: 7 additions & 7 deletions modules/beta-private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,6 @@ resource "google_container_cluster" "primary" {
enable_tpu = var.enable_tpu
enable_intranode_visibility = var.enable_intranode_visibility

dynamic "secret_manager_config" {
for_each = var.enable_secret_manager_addon ? [var.enable_secret_manager_addon] : []
content {
enabled = secret_manager_config.value
}
}

dynamic "pod_security_policy_config" {
for_each = var.enable_pod_security_policy ? [var.enable_pod_security_policy] : []
content {
Expand All @@ -209,6 +202,13 @@ resource "google_container_cluster" "primary" {

enable_cilium_clusterwide_network_policy = var.enable_cilium_clusterwide_network_policy

dynamic "secret_manager_config" {
for_each = var.enable_secret_manager_addon ? [var.enable_secret_manager_addon] : []
content {
enabled = secret_manager_config.value
}
}

enable_fqdn_network_policy = var.enable_fqdn_network_policy
dynamic "master_authorized_networks_config" {
for_each = local.master_authorized_networks_config
Expand Down
11 changes: 5 additions & 6 deletions modules/beta-private-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,11 @@ variable "enable_fqdn_network_policy" {
default = null
}

variable "enable_secret_manager_addon" {
description = "(Beta) Enable the Secret Manager add-on for this cluster"
type = bool
default = false
}

variable "enable_cilium_clusterwide_network_policy" {
type = bool
Expand Down Expand Up @@ -849,12 +854,6 @@ variable "enable_pod_security_policy" {
default = false
}

variable "enable_secret_manager_addon" {
description = "(Beta) Enable the Secret Manager add-on for this cluster"
type = bool
default = false
}

variable "sandbox_enabled" {
type = bool
description = "(Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` to use it)."
Expand Down
14 changes: 7 additions & 7 deletions modules/beta-public-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,6 @@ resource "google_container_cluster" "primary" {
enable_tpu = var.enable_tpu
enable_intranode_visibility = var.enable_intranode_visibility

dynamic "secret_manager_config" {
for_each = var.enable_secret_manager_addon ? [var.enable_secret_manager_addon] : []
content {
enabled = secret_manager_config.value
}
}

dynamic "pod_security_policy_config" {
for_each = var.enable_pod_security_policy ? [var.enable_pod_security_policy] : []
content {
Expand All @@ -209,6 +202,13 @@ resource "google_container_cluster" "primary" {

enable_cilium_clusterwide_network_policy = var.enable_cilium_clusterwide_network_policy

dynamic "secret_manager_config" {
for_each = var.enable_secret_manager_addon ? [var.enable_secret_manager_addon] : []
content {
enabled = secret_manager_config.value
}
}

enable_fqdn_network_policy = var.enable_fqdn_network_policy
dynamic "master_authorized_networks_config" {
for_each = local.master_authorized_networks_config
Expand Down
11 changes: 5 additions & 6 deletions modules/beta-public-cluster-update-variant/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,11 @@ variable "enable_fqdn_network_policy" {
default = null
}

variable "enable_secret_manager_addon" {
description = "(Beta) Enable the Secret Manager add-on for this cluster"
type = bool
default = false
}

variable "enable_cilium_clusterwide_network_policy" {
type = bool
Expand Down Expand Up @@ -819,12 +824,6 @@ variable "enable_pod_security_policy" {
default = false
}

variable "enable_secret_manager_addon" {
description = "(Beta) Enable the Secret Manager add-on for this cluster"
type = bool
default = false
}

variable "sandbox_enabled" {
type = bool
description = "(Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` to use it)."
Expand Down
14 changes: 7 additions & 7 deletions modules/beta-public-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,6 @@ resource "google_container_cluster" "primary" {
enable_tpu = var.enable_tpu
enable_intranode_visibility = var.enable_intranode_visibility

dynamic "secret_manager_config" {
for_each = var.enable_secret_manager_addon ? [var.enable_secret_manager_addon] : []
content {
enabled = secret_manager_config.value
}
}

dynamic "pod_security_policy_config" {
for_each = var.enable_pod_security_policy ? [var.enable_pod_security_policy] : []
content {
Expand All @@ -209,6 +202,13 @@ resource "google_container_cluster" "primary" {

enable_cilium_clusterwide_network_policy = var.enable_cilium_clusterwide_network_policy

dynamic "secret_manager_config" {
for_each = var.enable_secret_manager_addon ? [var.enable_secret_manager_addon] : []
content {
enabled = secret_manager_config.value
}
}

enable_fqdn_network_policy = var.enable_fqdn_network_policy
dynamic "master_authorized_networks_config" {
for_each = local.master_authorized_networks_config
Expand Down
11 changes: 5 additions & 6 deletions modules/beta-public-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,11 @@ variable "enable_fqdn_network_policy" {
default = null
}

variable "enable_secret_manager_addon" {
description = "(Beta) Enable the Secret Manager add-on for this cluster"
type = bool
default = false
}

variable "enable_cilium_clusterwide_network_policy" {
type = bool
Expand Down Expand Up @@ -819,12 +824,6 @@ variable "enable_pod_security_policy" {
default = false
}

variable "enable_secret_manager_addon" {
description = "(Beta) Enable the Secret Manager add-on for this cluster"
type = bool
default = false
}

variable "sandbox_enabled" {
type = bool
description = "(Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` to use it)."
Expand Down

0 comments on commit 7f31e96

Please sign in to comment.