Skip to content

Commit

Permalink
feat: Add support for enabling master_global_access, which is turned …
Browse files Browse the repository at this point in the history
…on by default. (terraform-google-modules#601)
  • Loading branch information
ilkelma committed Jul 16, 2020
1 parent 991c757 commit f235a7d
Show file tree
Hide file tree
Showing 13 changed files with 56 additions and 0 deletions.
8 changes: 8 additions & 0 deletions autogen/main/cluster.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,14 @@ resource "google_container_cluster" "primary" {
enable_private_endpoint = private_cluster_config.value.enable_private_endpoint
enable_private_nodes = private_cluster_config.value.enable_private_nodes
master_ipv4_cidr_block = private_cluster_config.value.master_ipv4_cidr_block
{% if beta_cluster %}
dynamic "master_global_access_config" {
for_each = var.master_global_access_enabled ? [var.master_global_access_enabled] : []
content {
enabled = master_global_access_config.value
}
}
{% endif %}
}
}
{% endif %}
Expand Down
10 changes: 10 additions & 0 deletions autogen/main/variables.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,19 @@ variable "master_ipv4_cidr_block" {
description = "(Beta) The IP range in CIDR notation to use for the hosted master network"
default = "10.0.0.0/28"
}
{% if beta_cluster %}

variable "master_global_access_enabled" {
type = bool
description = "(Beta) Whether the cluster master is accessible globally (from any region) or only within the same region as the private endpoint."

default = true
}
{% endif %}
{% endif %}
{% if beta_cluster %}


variable "istio" {
description = "(Beta) Enable Istio addon"
default = false
Expand Down
2 changes: 2 additions & 0 deletions autogen/safer-cluster/main.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ module "gke" {
// additional configurations.
enable_private_nodes = true

master_global_access_enabled = true

master_ipv4_cidr_block = var.master_ipv4_cidr_block

// Istio is recommended for pod-to-pod communications.
Expand Down
1 change: 1 addition & 0 deletions modules/beta-private-cluster-update-variant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ Then perform the following commands on the root folder:
| maintenance\_recurrence | Frequency of the recurring maintenance window in RFC5545 format. | string | `""` | no |
| maintenance\_start\_time | Time window specified for daily or recurring maintenance operations in RFC3339 format | string | `"05:00"` | no |
| master\_authorized\_networks | List of master authorized networks. If none are provided, disallow external access (except the cluster node IPs, which GKE automatically whitelists). | object | `<list>` | no |
| master\_global\_access\_enabled | (Beta) Whether the cluster master is accessible globally (from any region) or only within the same region as the private endpoint. | bool | `"true"` | no |
| master\_ipv4\_cidr\_block | (Beta) The IP range in CIDR notation to use for the hosted master network | string | `"10.0.0.0/28"` | no |
| monitoring\_service | The monitoring service that the cluster should write metrics to. Automatically send metrics from pods in the cluster to the Google Cloud Monitoring API. VM metrics will be collected by Google Compute Engine regardless of this setting Available options include monitoring.googleapis.com, monitoring.googleapis.com/kubernetes (beta) and none | string | `"monitoring.googleapis.com/kubernetes"` | no |
| name | The name of the cluster (required) | string | n/a | yes |
Expand Down
6 changes: 6 additions & 0 deletions modules/beta-private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,12 @@ resource "google_container_cluster" "primary" {
enable_private_endpoint = private_cluster_config.value.enable_private_endpoint
enable_private_nodes = private_cluster_config.value.enable_private_nodes
master_ipv4_cidr_block = private_cluster_config.value.master_ipv4_cidr_block
dynamic "master_global_access_config" {
for_each = var.master_global_access_enabled ? [var.master_global_access_enabled] : []
content {
enabled = master_global_access_config.value
}
}
}
}

Expand Down
8 changes: 8 additions & 0 deletions modules/beta-private-cluster-update-variant/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,14 @@ variable "master_ipv4_cidr_block" {
default = "10.0.0.0/28"
}

variable "master_global_access_enabled" {
type = bool
description = "(Beta) Whether the cluster master is accessible globally (from any region) or only within the same region as the private endpoint."

default = true
}


variable "istio" {
description = "(Beta) Enable Istio addon"
default = false
Expand Down
1 change: 1 addition & 0 deletions modules/beta-private-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ Then perform the following commands on the root folder:
| maintenance\_recurrence | Frequency of the recurring maintenance window in RFC5545 format. | string | `""` | no |
| maintenance\_start\_time | Time window specified for daily or recurring maintenance operations in RFC3339 format | string | `"05:00"` | no |
| master\_authorized\_networks | List of master authorized networks. If none are provided, disallow external access (except the cluster node IPs, which GKE automatically whitelists). | object | `<list>` | no |
| master\_global\_access\_enabled | (Beta) Whether the cluster master is accessible globally (from any region) or only within the same region as the private endpoint. | bool | `"true"` | no |
| master\_ipv4\_cidr\_block | (Beta) The IP range in CIDR notation to use for the hosted master network | string | `"10.0.0.0/28"` | no |
| monitoring\_service | The monitoring service that the cluster should write metrics to. Automatically send metrics from pods in the cluster to the Google Cloud Monitoring API. VM metrics will be collected by Google Compute Engine regardless of this setting Available options include monitoring.googleapis.com, monitoring.googleapis.com/kubernetes (beta) and none | string | `"monitoring.googleapis.com/kubernetes"` | no |
| name | The name of the cluster (required) | string | n/a | yes |
Expand Down
6 changes: 6 additions & 0 deletions modules/beta-private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,12 @@ resource "google_container_cluster" "primary" {
enable_private_endpoint = private_cluster_config.value.enable_private_endpoint
enable_private_nodes = private_cluster_config.value.enable_private_nodes
master_ipv4_cidr_block = private_cluster_config.value.master_ipv4_cidr_block
dynamic "master_global_access_config" {
for_each = var.master_global_access_enabled ? [var.master_global_access_enabled] : []
content {
enabled = master_global_access_config.value
}
}
}
}

Expand Down
8 changes: 8 additions & 0 deletions modules/beta-private-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,14 @@ variable "master_ipv4_cidr_block" {
default = "10.0.0.0/28"
}

variable "master_global_access_enabled" {
type = bool
description = "(Beta) Whether the cluster master is accessible globally (from any region) or only within the same region as the private endpoint."

default = true
}


variable "istio" {
description = "(Beta) Enable Istio addon"
default = false
Expand Down
1 change: 1 addition & 0 deletions modules/beta-public-cluster-update-variant/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ variable "default_max_pods_per_node" {
default = 110
}


variable "istio" {
description = "(Beta) Enable Istio addon"
default = false
Expand Down
1 change: 1 addition & 0 deletions modules/beta-public-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ variable "default_max_pods_per_node" {
default = 110
}


variable "istio" {
description = "(Beta) Enable Istio addon"
default = false
Expand Down
2 changes: 2 additions & 0 deletions modules/safer-cluster-update-variant/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ module "gke" {
// additional configurations.
enable_private_nodes = true

master_global_access_enabled = true

master_ipv4_cidr_block = var.master_ipv4_cidr_block

// Istio is recommended for pod-to-pod communications.
Expand Down
2 changes: 2 additions & 0 deletions modules/safer-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ module "gke" {
// additional configurations.
enable_private_nodes = true

master_global_access_enabled = true

master_ipv4_cidr_block = var.master_ipv4_cidr_block

// Istio is recommended for pod-to-pod communications.
Expand Down

0 comments on commit f235a7d

Please sign in to comment.