Skip to content

Commit

Permalink
feat: Allow datapath_provider in GA main module (#1084)
Browse files Browse the repository at this point in the history
* Allow datapath_provider in GA main module

* Update examples and tests to 3.55.0

* Update remaining version bump
  • Loading branch information
somethingnew2-0 authored Jan 13, 2022
1 parent 99cfd98 commit 3b5ddb9
Show file tree
Hide file tree
Showing 51 changed files with 69 additions and 36 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ Then perform the following commands on the root folder:
| configure\_ip\_masq | Enables the installation of ip masquerading, which is usually no longer required when using aliasied IP addresses. IP masquerading uses a kubectl call, so when you have a private cluster, you will need access to the API server. | `bool` | `false` | no |
| create\_service\_account | Defines if service account specified to run nodes should be created. | `bool` | `true` | no |
| 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. | `list(object({ state = string, key_name = string }))` | <pre>[<br> {<br> "key_name": "",<br> "state": "DECRYPTED"<br> }<br>]</pre> | no |
| datapath\_provider | The desired datapath provider for this cluster. By default, `DATAPATH_PROVIDER_UNSPECIFIED` enables the IPTables-based kube-proxy implementation. `ADVANCED_DATAPATH` enables Dataplane-V2 feature. | `string` | `"DATAPATH_PROVIDER_UNSPECIFIED"` | no |
| default\_max\_pods\_per\_node | The maximum number of pods to schedule per node | `number` | `110` | no |
| description | The description of the cluster | `string` | `""` | 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 |
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 @@ -217,9 +217,8 @@ resource "google_container_cluster" "primary" {
}
{% endif %}
}
{% if beta_cluster %}

datapath_provider = var.datapath_provider
{% endif %}

{% if beta_cluster %}
networking_mode = "VPC_NATIVE"
Expand Down
3 changes: 1 addition & 2 deletions autogen/main/variables.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,12 @@ variable "network_policy_provider" {
description = "The network policy provider."
default = "CALICO"
}
{% if beta_cluster %}

variable "datapath_provider" {
type = string
description = "The desired datapath provider for this cluster. By default, `DATAPATH_PROVIDER_UNSPECIFIED` enables the IPTables-based kube-proxy implementation. `ADVANCED_DATAPATH` enables Dataplane-V2 feature."
default = "DATAPATH_PROVIDER_UNSPECIFIED"
}
{% endif %}

variable "maintenance_start_time" {
type = string
Expand Down
2 changes: 1 addition & 1 deletion autogen/main/versions.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ terraform {
required_providers {
google = {
source = "hashicorp/google"
version = ">= 3.39.0, <4.0.0"
version = ">= 3.55.0, <4.0.0"
}
kubernetes = {
source = "hashicorp/kubernetes"
Expand Down
2 changes: 2 additions & 0 deletions cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ resource "google_container_cluster" "primary" {
}
}

datapath_provider = var.datapath_provider

ip_allocation_policy {
cluster_secondary_range_name = var.ip_range_pods
services_secondary_range_name = var.ip_range_services
Expand Down
2 changes: 1 addition & 1 deletion examples/deploy_service/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ locals {
}

provider "google" {
version = "~> 3.42.0"
version = "~> 3.55.0"
region = var.region
}

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

provider "google" {
version = "~> 3.42.0"
version = "~> 3.55.0"
region = var.region
}

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

provider "google" {
version = "~> 3.42.0"
version = "~> 3.55.0"
region = var.region
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

provider "google" {
version = "~> 3.42.0"
version = "~> 3.55.0"
}

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

provider "google" {
version = "~> 3.42.0"
version = "~> 3.55.0"
}

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

provider "google" {
version = "~> 3.42.0"
version = "~> 3.55.0"
region = var.region
}

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

provider "google" {
version = "~> 3.42.0"
version = "~> 3.55.0"
region = var.region
}

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

provider "google" {
version = "~> 3.42.0"
version = "~> 3.55.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 @@ -19,7 +19,7 @@ locals {
}

provider "google" {
version = "~> 3.42.0"
version = "~> 3.55.0"
region = var.region
}

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

provider "google" {
version = "~> 3.42.0"
version = "~> 3.55.0"
region = var.region
}

Expand Down
2 changes: 1 addition & 1 deletion examples/simple_regional_with_networking/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

provider "google" {
version = "~> 3.45.0"
version = "~> 3.55.0"
}

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

provider "google" {
version = "~> 3.42.0"
version = "~> 3.55.0"
region = var.region
}

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

provider "google" {
version = "~> 3.42.0"
version = "~> 3.55.0"
region = var.region
}

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

provider "google" {
version = "~> 3.42.0"
version = "~> 3.55.0"
region = var.region
}

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

provider "google" {
version = "~> 3.42.0"
version = "~> 3.55.0"
region = var.region
}

Expand Down
2 changes: 1 addition & 1 deletion examples/stub_domains_private/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

provider "google" {
version = "~> 3.42.0"
version = "~> 3.55.0"
region = var.region
}

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

provider "google" {
version = "~> 3.42.0"
version = "~> 3.55.0"
region = var.region
}

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

provider "google" {
version = "~> 3.42.0"
version = "~> 3.55.0"
region = var.region
}

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

provider "google" {
version = "~> 3.42.0"
version = "~> 3.55.0"
region = var.region
}

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 @@ -196,6 +196,7 @@ resource "google_container_cluster" "primary" {
enabled = var.config_connector
}
}

datapath_provider = var.datapath_provider

networking_mode = "VPC_NATIVE"
Expand Down
1 change: 1 addition & 0 deletions modules/beta-private-cluster-update-variant/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ variable "network_policy_provider" {
description = "The network policy provider."
default = "CALICO"
}

variable "datapath_provider" {
type = string
description = "The desired datapath provider for this cluster. By default, `DATAPATH_PROVIDER_UNSPECIFIED` enables the IPTables-based kube-proxy implementation. `ADVANCED_DATAPATH` enables Dataplane-V2 feature."
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 @@ -196,6 +196,7 @@ resource "google_container_cluster" "primary" {
enabled = var.config_connector
}
}

datapath_provider = var.datapath_provider

networking_mode = "VPC_NATIVE"
Expand Down
1 change: 1 addition & 0 deletions modules/beta-private-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ variable "network_policy_provider" {
description = "The network policy provider."
default = "CALICO"
}

variable "datapath_provider" {
type = string
description = "The desired datapath provider for this cluster. By default, `DATAPATH_PROVIDER_UNSPECIFIED` enables the IPTables-based kube-proxy implementation. `ADVANCED_DATAPATH` enables Dataplane-V2 feature."
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 @@ -196,6 +196,7 @@ resource "google_container_cluster" "primary" {
enabled = var.config_connector
}
}

datapath_provider = var.datapath_provider

networking_mode = "VPC_NATIVE"
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 @@ -107,6 +107,7 @@ variable "network_policy_provider" {
description = "The network policy provider."
default = "CALICO"
}

variable "datapath_provider" {
type = string
description = "The desired datapath provider for this cluster. By default, `DATAPATH_PROVIDER_UNSPECIFIED` enables the IPTables-based kube-proxy implementation. `ADVANCED_DATAPATH` enables Dataplane-V2 feature."
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 @@ -196,6 +196,7 @@ resource "google_container_cluster" "primary" {
enabled = var.config_connector
}
}

datapath_provider = var.datapath_provider

networking_mode = "VPC_NATIVE"
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 @@ -107,6 +107,7 @@ variable "network_policy_provider" {
description = "The network policy provider."
default = "CALICO"
}

variable "datapath_provider" {
type = string
description = "The desired datapath provider for this cluster. By default, `DATAPATH_PROVIDER_UNSPECIFIED` enables the IPTables-based kube-proxy implementation. `ADVANCED_DATAPATH` enables Dataplane-V2 feature."
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 @@ -164,6 +164,7 @@ Then perform the following commands on the root folder:
| configure\_ip\_masq | Enables the installation of ip masquerading, which is usually no longer required when using aliasied IP addresses. IP masquerading uses a kubectl call, so when you have a private cluster, you will need access to the API server. | `bool` | `false` | no |
| create\_service\_account | Defines if service account specified to run nodes should be created. | `bool` | `true` | no |
| 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. | `list(object({ state = string, key_name = string }))` | <pre>[<br> {<br> "key_name": "",<br> "state": "DECRYPTED"<br> }<br>]</pre> | no |
| datapath\_provider | The desired datapath provider for this cluster. By default, `DATAPATH_PROVIDER_UNSPECIFIED` enables the IPTables-based kube-proxy implementation. `ADVANCED_DATAPATH` enables Dataplane-V2 feature. | `string` | `"DATAPATH_PROVIDER_UNSPECIFIED"` | no |
| default\_max\_pods\_per\_node | The maximum number of pods to schedule per node | `number` | `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 |
Expand Down
2 changes: 2 additions & 0 deletions modules/private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ resource "google_container_cluster" "primary" {
}
}

datapath_provider = var.datapath_provider

ip_allocation_policy {
cluster_secondary_range_name = var.ip_range_pods
services_secondary_range_name = var.ip_range_services
Expand Down
6 changes: 6 additions & 0 deletions modules/private-cluster-update-variant/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ variable "network_policy_provider" {
default = "CALICO"
}

variable "datapath_provider" {
type = string
description = "The desired datapath provider for this cluster. By default, `DATAPATH_PROVIDER_UNSPECIFIED` enables the IPTables-based kube-proxy implementation. `ADVANCED_DATAPATH` enables Dataplane-V2 feature."
default = "DATAPATH_PROVIDER_UNSPECIFIED"
}

variable "maintenance_start_time" {
type = string
description = "Time window specified for daily or recurring maintenance operations in RFC3339 format"
Expand Down
2 changes: 1 addition & 1 deletion modules/private-cluster-update-variant/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ terraform {
required_providers {
google = {
source = "hashicorp/google"
version = ">= 3.39.0, <4.0.0"
version = ">= 3.55.0, <4.0.0"
}
kubernetes = {
source = "hashicorp/kubernetes"
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 @@ -142,6 +142,7 @@ Then perform the following commands on the root folder:
| configure\_ip\_masq | Enables the installation of ip masquerading, which is usually no longer required when using aliasied IP addresses. IP masquerading uses a kubectl call, so when you have a private cluster, you will need access to the API server. | `bool` | `false` | no |
| create\_service\_account | Defines if service account specified to run nodes should be created. | `bool` | `true` | no |
| 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. | `list(object({ state = string, key_name = string }))` | <pre>[<br> {<br> "key_name": "",<br> "state": "DECRYPTED"<br> }<br>]</pre> | no |
| datapath\_provider | The desired datapath provider for this cluster. By default, `DATAPATH_PROVIDER_UNSPECIFIED` enables the IPTables-based kube-proxy implementation. `ADVANCED_DATAPATH` enables Dataplane-V2 feature. | `string` | `"DATAPATH_PROVIDER_UNSPECIFIED"` | no |
| default\_max\_pods\_per\_node | The maximum number of pods to schedule per node | `number` | `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 |
Expand Down
2 changes: 2 additions & 0 deletions modules/private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ resource "google_container_cluster" "primary" {
}
}

datapath_provider = var.datapath_provider

ip_allocation_policy {
cluster_secondary_range_name = var.ip_range_pods
services_secondary_range_name = var.ip_range_services
Expand Down
6 changes: 6 additions & 0 deletions modules/private-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ variable "network_policy_provider" {
default = "CALICO"
}

variable "datapath_provider" {
type = string
description = "The desired datapath provider for this cluster. By default, `DATAPATH_PROVIDER_UNSPECIFIED` enables the IPTables-based kube-proxy implementation. `ADVANCED_DATAPATH` enables Dataplane-V2 feature."
default = "DATAPATH_PROVIDER_UNSPECIFIED"
}

variable "maintenance_start_time" {
type = string
description = "Time window specified for daily or recurring maintenance operations in RFC3339 format"
Expand Down
2 changes: 1 addition & 1 deletion modules/private-cluster/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ terraform {
required_providers {
google = {
source = "hashicorp/google"
version = ">= 3.39.0, <4.0.0"
version = ">= 3.55.0, <4.0.0"
}
kubernetes = {
source = "hashicorp/kubernetes"
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/deploy_service/network.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ resource "random_string" "suffix" {
}

provider "google" {
version = "~> 3.42.0"
version = "~> 3.55.0"
project = var.project_ids[0]
}

Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/disable_client_cert/network.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ resource "random_string" "suffix" {
}

provider "google" {
version = "~> 3.42.0"
version = "~> 3.55.0"
project = var.project_ids[0]
}

Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/shared_vpc/network.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ resource "random_string" "suffix" {
}

provider "google" {
version = "~> 3.42.0"
version = "~> 3.55.0"
project = var.project_ids[0]
}

Expand Down
Loading

0 comments on commit 3b5ddb9

Please sign in to comment.