Skip to content

Commit

Permalink
Ensure that GA modules don't depend on beta functionality
Browse files Browse the repository at this point in the history
Beta functionality removed fully from public and private cluster modules and related exampled.
As long node_pool example used taints that in beta, it switched to public-cluster-beta module from root one.

Fixes #181
  • Loading branch information
kopachevsky committed Aug 14, 2019
1 parent ed58124 commit 13e5a52
Show file tree
Hide file tree
Showing 36 changed files with 44 additions and 157 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
Extending the adopted spec, each change should have a link to its corresponding pull request appended.

## [Unreleased]

### Changed

* All Beta functionality removed from non-beta clusters, some properties like node_pool taints available only in beta cluster now [#228]

### Added

* Support for Intranode Visbiility (IV) and Veritical Pod Autoscaling (VPA) beta features [#216]
Expand Down Expand Up @@ -167,6 +172,7 @@ Extending the adopted spec, each change should have a link to its corresponding
[v0.3.0]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v0.2.0...v0.3.0
[v0.2.0]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v0.1.0...v0.2.0

[#228]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/228
[#216]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/216
[#214]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/214
[#210]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/210
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
| node\_pools\_metadata | Map of maps containing node metadata by node-pool name | map(map(string)) | `<map>` | no |
| node\_pools\_oauth\_scopes | Map of lists containing node oauth scopes by node-pool name | map(list(string)) | `<map>` | no |
| node\_pools\_tags | Map of lists containing node network tags by node-pool name | map(list(string)) | `<map>` | no |
| node\_pools\_taints | Map of lists containing node taints by node-pool name | object | `<map>` | no |
| node\_version | The Kubernetes version of the node pools. Defaults kubernetes_version (master) variable and can be overridden for individual node pools by setting the `version` key on them. Must be empyty or set the same as master at cluster creation. | string | `""` | no |
| non\_masquerade\_cidrs | List of strings in CIDR notation that specify the IP address ranges that do not use IP masquerading. | list(string) | `<list>` | no |
| project\_id | The project ID to host the cluster in (required) | string | n/a | yes |
Expand Down
2 changes: 1 addition & 1 deletion autogen/auth.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
Retrieve authentication token
*****************************************/
data "google_client_config" "default" {
{% if private_cluster or beta_cluster %}
{% if beta_cluster %}
provider = google-beta
{% else %}
provider = google
Expand Down
8 changes: 7 additions & 1 deletion autogen/cluster_regional.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
Create regional cluster
*****************************************/
resource "google_container_cluster" "primary" {
{% if private_cluster or beta_cluster %}
{% if beta_cluster %}
provider = google-beta
{% else %}
provider = google
Expand Down Expand Up @@ -193,7 +193,11 @@ resource "google_container_cluster" "primary" {
Create regional node pools
*****************************************/
resource "google_container_node_pool" "pools" {
{% if beta_cluster %}
provider = google-beta
{% else %}
provider = google
{% endif %}
count = var.regional ? length(var.node_pools) : 0
name = var.node_pools[count.index]["name"]
project = var.project_id
Expand Down Expand Up @@ -249,6 +253,7 @@ resource "google_container_node_pool" "pools" {
"disable-legacy-endpoints" = var.disable_legacy_metadata_endpoints
},
)
{% if beta_cluster %}
dynamic "taint" {
for_each = concat(
var.node_pools_taints["all"],
Expand All @@ -260,6 +265,7 @@ resource "google_container_node_pool" "pools" {
value = taint.value.value
}
}
{% endif %}
tags = concat(
["gke-${var.name}"],
["gke-${var.name}-${var.node_pools[count.index]["name"]}"],
Expand Down
9 changes: 7 additions & 2 deletions autogen/cluster_zonal.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
Create zonal cluster
*****************************************/
resource "google_container_cluster" "zonal_primary" {
{% if private_cluster or beta_cluster %}
{% if beta_cluster %}
provider = google-beta
{% else %}
provider = google
Expand Down Expand Up @@ -189,7 +189,11 @@ resource "google_container_cluster" "zonal_primary" {
Create zonal node pools
*****************************************/
resource "google_container_node_pool" "zonal_pools" {
{% if beta_cluster %}
provider = google-beta
{% else %}
provider = google
{% endif %}
count = var.regional ? 0 : length(var.node_pools)
name = var.node_pools[count.index]["name"]
project = var.project_id
Expand Down Expand Up @@ -244,6 +248,7 @@ resource "google_container_node_pool" "zonal_pools" {
"disable-legacy-endpoints" = var.disable_legacy_metadata_endpoints
},
)
{% if beta_cluster %}
dynamic "taint" {
for_each = concat(
var.node_pools_taints["all"],
Expand All @@ -255,7 +260,7 @@ resource "google_container_node_pool" "zonal_pools" {
value = taint.value.value
}
}

{% endif %}
tags = concat(
["gke-${var.name}"],
["gke-${var.name}-${var.node_pools[count.index]["name"]}"],
Expand Down
6 changes: 5 additions & 1 deletion autogen/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
Get available zones in region
*****************************************/
data "google_compute_zones" "available" {
{% if private_cluster or beta_cluster %}
{% if beta_cluster %}
provider = google-beta
{% else %}
provider = google
Expand Down Expand Up @@ -309,7 +309,11 @@ locals {
Get available container engine versions
*****************************************/
data "google_container_engine_versions" "region" {
{% if beta_cluster %}
provider = google-beta
{% else %}
provider = google
{% endif %}
region = var.region
project = var.project_id
}
Expand Down
4 changes: 2 additions & 2 deletions autogen/networks.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{{ autogeneration_note }}

data "google_compute_network" "gke_network" {
{% if private_cluster or beta_cluster %}
{% if beta_cluster %}
provider = google-beta
{% else %}
provider = google
Expand All @@ -28,7 +28,7 @@ data "google_compute_network" "gke_network" {
}

data "google_compute_subnetwork" "gke_subnetwork" {
{% if private_cluster or beta_cluster %}
{% if beta_cluster %}
provider = google-beta
{% else %}
provider = google
Expand Down
2 changes: 2 additions & 0 deletions autogen/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ variable "node_pools_metadata" {
}
}

{% if beta_cluster %}
variable "node_pools_taints" {
type = map(list(object({key=string,value=string,effect=string})))
description = "Map of lists containing node taints by node-pool name"
Expand All @@ -187,6 +188,7 @@ variable "node_pools_taints" {
default-node-pool = []
}
}
{% endif %}

variable "node_pools_tags" {
type = map(list(string))
Expand Down
13 changes: 1 addition & 12 deletions cluster_regional.tf
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ resource "google_container_cluster" "primary" {
Create regional node pools
*****************************************/
resource "google_container_node_pool" "pools" {
provider = google-beta
provider = google
count = var.regional ? length(var.node_pools) : 0
name = var.node_pools[count.index]["name"]
project = var.project_id
Expand Down Expand Up @@ -182,17 +182,6 @@ resource "google_container_node_pool" "pools" {
"disable-legacy-endpoints" = var.disable_legacy_metadata_endpoints
},
)
dynamic "taint" {
for_each = concat(
var.node_pools_taints["all"],
var.node_pools_taints[var.node_pools[count.index]["name"]],
)
content {
effect = taint.value.effect
key = taint.value.key
value = taint.value.value
}
}
tags = concat(
["gke-${var.name}"],
["gke-${var.name}-${var.node_pools[count.index]["name"]}"],
Expand Down
14 changes: 1 addition & 13 deletions cluster_zonal.tf
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ resource "google_container_cluster" "zonal_primary" {
Create zonal node pools
*****************************************/
resource "google_container_node_pool" "zonal_pools" {
provider = google-beta
provider = google
count = var.regional ? 0 : length(var.node_pools)
name = var.node_pools[count.index]["name"]
project = var.project_id
Expand Down Expand Up @@ -178,18 +178,6 @@ resource "google_container_node_pool" "zonal_pools" {
"disable-legacy-endpoints" = var.disable_legacy_metadata_endpoints
},
)
dynamic "taint" {
for_each = concat(
var.node_pools_taints["all"],
var.node_pools_taints[var.node_pools[count.index]["name"]],
)
content {
effect = taint.value.effect
key = taint.value.key
value = taint.value.value
}
}

tags = concat(
["gke-${var.name}"],
["gke-${var.name}-${var.node_pools[count.index]["name"]}"],
Expand Down
5 changes: 0 additions & 5 deletions examples/deploy_service/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ provider "google" {
region = var.region
}

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

provider "kubernetes" {
load_config_file = false
host = "https://${module.gke.endpoint}"
Expand Down
5 changes: 0 additions & 5 deletions examples/disable_client_cert/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ provider "google" {
region = var.region
}

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

module "gke" {
source = "../../"

Expand Down
7 changes: 1 addition & 6 deletions examples/node_pool/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,8 @@ provider "google" {
region = var.region
}

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

module "gke" {
source = "../../"
source = "../../modules/beta-public-cluster/"
project_id = var.project_id
name = "${local.cluster_type}-cluster${var.cluster_name_suffix}"
regional = false
Expand Down
5 changes: 0 additions & 5 deletions examples/shared_vpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ provider "google" {
region = var.region
}

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

module "gke" {
source = "../../"
project_id = var.project_id
Expand Down
5 changes: 0 additions & 5 deletions examples/simple_regional/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ provider "google" {
region = var.region
}

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

module "gke" {
source = "../../"
project_id = var.project_id
Expand Down
6 changes: 0 additions & 6 deletions examples/simple_regional_beta/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ provider "google" {
region = var.region
}

provider "google-beta" {
version = "~> 2.9.0"
credentials = file(var.credentials_path)
region = var.region
}

module "gke" {
source = "../../modules/beta-public-cluster/"
project_id = var.project_id
Expand Down
5 changes: 0 additions & 5 deletions examples/simple_regional_private/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ locals {
cluster_type = "simple-regional-private"
}

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

data "google_compute_subnetwork" "subnetwork" {
name = var.subnetwork
project = var.project_id
Expand Down
5 changes: 0 additions & 5 deletions examples/simple_zonal/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ provider "google" {
region = var.region
}

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

module "gke" {
source = "../../"
project_id = var.project_id
Expand Down
5 changes: 0 additions & 5 deletions examples/simple_zonal_private/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ locals {
cluster_type = "simple-regional-private"
}

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

data "google_compute_subnetwork" "subnetwork" {
name = var.subnetwork
project = var.project_id
Expand Down
5 changes: 0 additions & 5 deletions examples/stub_domains/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ provider "google" {
region = var.region
}

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

module "gke" {
source = "../../"
project_id = var.project_id
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 @@ -14,7 +14,7 @@
* limitations under the License.
*/

provider "google-beta" {
provider "google" {
version = "~> 2.9.0"
region = var.region
}
Expand Down
5 changes: 0 additions & 5 deletions examples/stub_domains_upstream_nameservers/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ provider "google" {
region = var.region
}

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

module "gke" {
source = "../../"
project_id = var.project_id
Expand Down
5 changes: 0 additions & 5 deletions examples/upstream_nameservers/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ provider "google" {
region = var.region
}

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

module "gke" {
source = "../../"
project_id = var.project_id
Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ locals {
Get available container engine versions
*****************************************/
data "google_container_engine_versions" "region" {
provider = google-beta
provider = google
region = var.region
project = var.project_id
}
Expand Down
1 change: 0 additions & 1 deletion modules/beta-private-cluster/cluster_zonal.tf
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ resource "google_container_node_pool" "zonal_pools" {
value = taint.value.value
}
}

tags = concat(
["gke-${var.name}"],
["gke-${var.name}-${var.node_pools[count.index]["name"]}"],
Expand Down
Loading

0 comments on commit 13e5a52

Please sign in to comment.