Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add variable disable_default_snat #625

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# Make will use bash instead of sh
SHELL := /usr/bin/env bash

DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 0
DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 0.12.0
DOCKER_IMAGE_DEVELOPER_TOOLS := cft/developer-tools
REGISTRY_URL := gcr.io/cloud-foundation-cicd

Expand Down
5 changes: 5 additions & 0 deletions autogen/main/cluster.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ resource "google_container_cluster" "primary" {

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

{% if beta_cluster %}
default_snat_status{
disabled = var.disable_default_snat
}
{% endif %}
{% if beta_cluster %}
min_master_version = var.release_channel != null ? null : local.master_version
{% else %}
Expand Down
8 changes: 8 additions & 0 deletions autogen/main/variables.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -550,3 +550,11 @@ variable "gcloud_skip_download" {
description = "Whether to skip downloading gcloud (assumes gcloud is already available outside the module)"
default = true
}

{% if beta_cluster %}
variable "disable_default_snat" {
type = bool
description = "Whether to disable the default SNAT to support the private use of public IP addresses"
default = false
}
{% endif %}
2 changes: 1 addition & 1 deletion autogen/main/versions.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ terraform {

required_providers {
{% if beta_cluster %}
google-beta = ">= 3.29.0, <4.0.0"
google-beta = ">= 3.32.0, <4.0.0"
{% else %}
google = ">= 3.16, <4.0.0"
{% endif %}
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 @@ -49,6 +49,8 @@ module "gke" {
ip_range_pods = var.ip_range_pods
ip_range_services = var.ip_range_services

disable_default_snat = var.disable_default_snat

add_cluster_firewall_rules = var.add_cluster_firewall_rules
firewall_priority = var.firewall_priority
firewall_inbound_ports = var.firewall_inbound_ports
Expand Down
6 changes: 6 additions & 0 deletions autogen/safer-cluster/variables.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -363,3 +363,9 @@ variable "config_connector" {
description = "(Beta) Whether ConfigConnector is enabled for this cluster."
default = false
}

variable "disable_default_snat" {
type = bool
description = "Whether to disable the default SNAT to support the private use of public IP addresses"
default = false
}
2 changes: 1 addition & 1 deletion build/int.cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,6 @@ tags:
- 'integration'
substitutions:
_DOCKER_IMAGE_DEVELOPER_TOOLS: 'cft/developer-tools'
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0'
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.12.0'
options:
machineType: 'N1_HIGHCPU_8'
2 changes: 1 addition & 1 deletion build/lint.cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ tags:
- 'lint'
substitutions:
_DOCKER_IMAGE_DEVELOPER_TOOLS: 'cft/developer-tools'
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0'
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.12.0'
2 changes: 1 addition & 1 deletion examples/node_pool/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ locals {
}

provider "google-beta" {
version = "~> 3.29.0"
version = "~> 3.32.0"
region = var.region
}

Expand Down
2 changes: 1 addition & 1 deletion examples/node_pool_update_variant_beta/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ locals {
}

provider "google-beta" {
version = "~> 3.29.0"
version = "~> 3.32.0"
credentials = file(var.credentials_path)
region = var.region
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ provider "google" {
}

provider "google-beta" {
version = "~> 3.29.0"
version = "~> 3.32.0"
}
2 changes: 1 addition & 1 deletion examples/safer_cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ provider "google" {
}

provider "google-beta" {
version = "~> 3.29.0"
version = "~> 3.32.0"
}

module "gke" {
Expand Down
4 changes: 2 additions & 2 deletions examples/safer_cluster_iap_bastion/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
*/

provider "google" {
version = "~> 3.29.0"
version = "~> 3.32.0"
}

provider "google-beta" {
version = "~> 3.29.0"
version = "~> 3.32.0"
}
2 changes: 1 addition & 1 deletion examples/simple_regional_beta/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ locals {
}

provider "google-beta" {
version = "~> 3.29.0"
version = "~> 3.32.0"
region = var.region
}

Expand Down
2 changes: 1 addition & 1 deletion examples/simple_regional_private_beta/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ provider "google" {
}

provider "google-beta" {
version = "~> 3.29.0"
version = "~> 3.32.0"
region = var.region
}

Expand Down
2 changes: 1 addition & 1 deletion examples/simple_zonal_with_asm/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ locals {
}

provider "google-beta" {
version = "~> 3.29.0"
version = "~> 3.32.0"
region = var.region
}

Expand Down
2 changes: 1 addition & 1 deletion examples/workload_metadata_config/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ locals {
}

provider "google-beta" {
version = "~> 3.29.0"
version = "~> 3.32.0"
region = var.region
}

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 @@ -159,6 +159,7 @@ Then perform the following commands on the root folder:
| default\_max\_pods\_per\_node | The maximum number of pods to schedule per node | string | `"110"` | no |
| deploy\_using\_private\_endpoint | (Beta) A toggle for Terraform and kubectl to connect to the master's internal IP address during deployment. | bool | `"false"` | no |
| description | The description of the cluster | string | `""` | no |
| disable\_default\_snat | Whether to disable the default SNAT to support the private use of public IP addresses | bool | `"false"` | no |
| 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 | (Beta) The status of the NodeLocal DNSCache addon. | bool | `"false"` | no |
| enable\_binary\_authorization | Enable BinAuthZ Admission controller | string | `"false"` | no |
Expand Down
3 changes: 3 additions & 0 deletions modules/beta-private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ resource "google_container_cluster" "primary" {

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

default_snat_status {
disabled = var.disable_default_snat
}
min_master_version = var.release_channel != null ? null : local.master_version

logging_service = var.logging_service
Expand Down
6 changes: 6 additions & 0 deletions modules/beta-private-cluster-update-variant/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -540,3 +540,9 @@ variable "gcloud_skip_download" {
description = "Whether to skip downloading gcloud (assumes gcloud is already available outside the module)"
default = true
}

variable "disable_default_snat" {
type = bool
description = "Whether to disable the default SNAT to support the private use of public IP addresses"
default = false
}
2 changes: 1 addition & 1 deletion modules/beta-private-cluster-update-variant/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ terraform {
required_version = ">=0.12.6, <0.14"

required_providers {
google-beta = ">= 3.29.0, <4.0.0"
google-beta = ">= 3.32.0, <4.0.0"
}
}
1 change: 1 addition & 0 deletions modules/beta-private-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ Then perform the following commands on the root folder:
| default\_max\_pods\_per\_node | The maximum number of pods to schedule per node | string | `"110"` | no |
| deploy\_using\_private\_endpoint | (Beta) A toggle for Terraform and kubectl to connect to the master's internal IP address during deployment. | bool | `"false"` | no |
| description | The description of the cluster | string | `""` | no |
| disable\_default\_snat | Whether to disable the default SNAT to support the private use of public IP addresses | bool | `"false"` | no |
| 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 | (Beta) The status of the NodeLocal DNSCache addon. | bool | `"false"` | no |
| enable\_binary\_authorization | Enable BinAuthZ Admission controller | string | `"false"` | no |
Expand Down
3 changes: 3 additions & 0 deletions modules/beta-private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ resource "google_container_cluster" "primary" {

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

default_snat_status {
disabled = var.disable_default_snat
}
min_master_version = var.release_channel != null ? null : local.master_version

logging_service = var.logging_service
Expand Down
6 changes: 6 additions & 0 deletions modules/beta-private-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -540,3 +540,9 @@ variable "gcloud_skip_download" {
description = "Whether to skip downloading gcloud (assumes gcloud is already available outside the module)"
default = true
}

variable "disable_default_snat" {
type = bool
description = "Whether to disable the default SNAT to support the private use of public IP addresses"
default = false
}
2 changes: 1 addition & 1 deletion modules/beta-private-cluster/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ terraform {
required_version = ">=0.12.6, <0.14"

required_providers {
google-beta = ">= 3.29.0, <4.0.0"
google-beta = ">= 3.32.0, <4.0.0"
}
}
1 change: 1 addition & 0 deletions modules/beta-public-cluster-update-variant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ Then perform the following commands on the root folder:
| database\_encryption | Application-layer Secrets Encryption settings. The object format is {state = string, key_name = string}. Valid values of state are: "ENCRYPTED"; "DECRYPTED". key_name is the name of a CloudKMS key. | object | `<list>` | no |
| default\_max\_pods\_per\_node | The maximum number of pods to schedule per node | string | `"110"` | no |
| description | The description of the cluster | string | `""` | no |
| disable\_default\_snat | Whether to disable the default SNAT to support the private use of public IP addresses | bool | `"false"` | no |
| 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 | (Beta) The status of the NodeLocal DNSCache addon. | bool | `"false"` | no |
| enable\_binary\_authorization | Enable BinAuthZ Admission controller | string | `"false"` | no |
Expand Down
3 changes: 3 additions & 0 deletions modules/beta-public-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ resource "google_container_cluster" "primary" {

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

default_snat_status {
disabled = var.disable_default_snat
}
min_master_version = var.release_channel != null ? null : local.master_version

logging_service = var.logging_service
Expand Down
6 changes: 6 additions & 0 deletions modules/beta-public-cluster-update-variant/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -509,3 +509,9 @@ variable "gcloud_skip_download" {
description = "Whether to skip downloading gcloud (assumes gcloud is already available outside the module)"
default = true
}

variable "disable_default_snat" {
type = bool
description = "Whether to disable the default SNAT to support the private use of public IP addresses"
default = false
}
2 changes: 1 addition & 1 deletion modules/beta-public-cluster-update-variant/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ terraform {
required_version = ">=0.12.6, <0.14"

required_providers {
google-beta = ">= 3.29.0, <4.0.0"
google-beta = ">= 3.32.0, <4.0.0"
}
}
1 change: 1 addition & 0 deletions modules/beta-public-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ Then perform the following commands on the root folder:
| database\_encryption | Application-layer Secrets Encryption settings. The object format is {state = string, key_name = string}. Valid values of state are: "ENCRYPTED"; "DECRYPTED". key_name is the name of a CloudKMS key. | object | `<list>` | no |
| default\_max\_pods\_per\_node | The maximum number of pods to schedule per node | string | `"110"` | no |
| description | The description of the cluster | string | `""` | no |
| disable\_default\_snat | Whether to disable the default SNAT to support the private use of public IP addresses | bool | `"false"` | no |
| 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 | (Beta) The status of the NodeLocal DNSCache addon. | bool | `"false"` | no |
| enable\_binary\_authorization | Enable BinAuthZ Admission controller | string | `"false"` | no |
Expand Down
3 changes: 3 additions & 0 deletions modules/beta-public-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ resource "google_container_cluster" "primary" {

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

default_snat_status {
disabled = var.disable_default_snat
}
min_master_version = var.release_channel != null ? null : local.master_version

logging_service = var.logging_service
Expand Down
6 changes: 6 additions & 0 deletions modules/beta-public-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -509,3 +509,9 @@ variable "gcloud_skip_download" {
description = "Whether to skip downloading gcloud (assumes gcloud is already available outside the module)"
default = true
}

variable "disable_default_snat" {
type = bool
description = "Whether to disable the default SNAT to support the private use of public IP addresses"
default = false
}
2 changes: 1 addition & 1 deletion modules/beta-public-cluster/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ terraform {
required_version = ">=0.12.6, <0.14"

required_providers {
google-beta = ">= 3.29.0, <4.0.0"
google-beta = ">= 3.32.0, <4.0.0"
}
}
1 change: 1 addition & 0 deletions modules/private-cluster-update-variant/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -374,3 +374,4 @@ variable "gcloud_skip_download" {
description = "Whether to skip downloading gcloud (assumes gcloud is already available outside the module)"
default = true
}

1 change: 1 addition & 0 deletions modules/private-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -374,3 +374,4 @@ variable "gcloud_skip_download" {
description = "Whether to skip downloading gcloud (assumes gcloud is already available outside the module)"
default = true
}

1 change: 1 addition & 0 deletions modules/safer-cluster-update-variant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ For simplicity, we suggest using `roles/container.admin` and
| database\_encryption | Application-layer Secrets Encryption settings. The object format is {state = string, key_name = string}. Valid values of state are: "ENCRYPTED"; "DECRYPTED". key_name is the name of a CloudKMS key. | object | `<list>` | no |
| default\_max\_pods\_per\_node | The maximum number of pods to schedule per node | string | `"110"` | no |
| description | The description of the cluster | string | `""` | no |
| disable\_default\_snat | Whether to disable the default SNAT to support the private use of public IP addresses | bool | `"false"` | no |
| dns\_cache | (Beta) The status of the NodeLocal DNSCache addon. | bool | `"false"` | no |
| enable\_intranode\_visibility | Whether Intra-node visibility is enabled for this cluster. This makes same node pod to pod traffic visible for VPC network | 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 |
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 @@ -45,6 +45,8 @@ module "gke" {
ip_range_pods = var.ip_range_pods
ip_range_services = var.ip_range_services

disable_default_snat = var.disable_default_snat

add_cluster_firewall_rules = var.add_cluster_firewall_rules
firewall_priority = var.firewall_priority
firewall_inbound_ports = var.firewall_inbound_ports
Expand Down
6 changes: 6 additions & 0 deletions modules/safer-cluster-update-variant/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -363,3 +363,9 @@ variable "config_connector" {
description = "(Beta) Whether ConfigConnector is enabled for this cluster."
default = false
}

variable "disable_default_snat" {
type = bool
description = "Whether to disable the default SNAT to support the private use of public IP addresses"
default = false
}
1 change: 1 addition & 0 deletions modules/safer-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ For simplicity, we suggest using `roles/container.admin` and
| database\_encryption | Application-layer Secrets Encryption settings. The object format is {state = string, key_name = string}. Valid values of state are: "ENCRYPTED"; "DECRYPTED". key_name is the name of a CloudKMS key. | object | `<list>` | no |
| default\_max\_pods\_per\_node | The maximum number of pods to schedule per node | string | `"110"` | no |
| description | The description of the cluster | string | `""` | no |
| disable\_default\_snat | Whether to disable the default SNAT to support the private use of public IP addresses | bool | `"false"` | no |
| dns\_cache | (Beta) The status of the NodeLocal DNSCache addon. | bool | `"false"` | no |
| enable\_intranode\_visibility | Whether Intra-node visibility is enabled for this cluster. This makes same node pod to pod traffic visible for VPC network | 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 |
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 @@ -45,6 +45,8 @@ module "gke" {
ip_range_pods = var.ip_range_pods
ip_range_services = var.ip_range_services

disable_default_snat = var.disable_default_snat

add_cluster_firewall_rules = var.add_cluster_firewall_rules
firewall_priority = var.firewall_priority
firewall_inbound_ports = var.firewall_inbound_ports
Expand Down
6 changes: 6 additions & 0 deletions modules/safer-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -363,3 +363,9 @@ variable "config_connector" {
description = "(Beta) Whether ConfigConnector is enabled for this cluster."
default = false
}

variable "disable_default_snat" {
type = bool
description = "Whether to disable the default SNAT to support the private use of public IP addresses"
default = false
}
2 changes: 1 addition & 1 deletion test/setup/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ provider "google" {
}

provider "google-beta" {
version = "3.25.0"
version = "3.32.0"
}
1 change: 1 addition & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -350,3 +350,4 @@ variable "gcloud_skip_download" {
description = "Whether to skip downloading gcloud (assumes gcloud is already available outside the module)"
default = true
}