Skip to content

Commit

Permalink
Merge pull request #3 from terraform-google-modules/master
Browse files Browse the repository at this point in the history
update
  • Loading branch information
bharathkkb authored Nov 22, 2019
2 parents be5e130 + 63c8b6f commit e5a7267
Show file tree
Hide file tree
Showing 68 changed files with 1,404 additions and 335 deletions.
17 changes: 17 additions & 0 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,23 @@ suites:
systems:
- name: simple_regional
backend: local
- name: "private_zonal_with_networking"
driver:
root_module_directory: test/fixtures/private_zonal_with_networking
verifier:
systems:
- name: private_zonal_with_networking
backend: local
controls:
- gcloud
- name: private_zonal_with_networking
backend: local
controls:
- subnet
- name: network
backend: gcp
controls:
- network
- name: "simple_regional_with_networking"
driver:
root_module_directory: test/fixtures/simple_regional_with_networking
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ Extending the adopted spec, each change should have a link to its corresponding
* Support for setting node_locations on node pools. [#303]
* Fix for specifying `node_count` on node pools when autoscaling is disabled. [#311]
* Added submodule for installing Anthos Config Management. [#268]
* Support for `local_ssd_count` in node pool configuration. [#244]
* Wait for cluster to be ready before returning endpoint. [#340]

### Removed

* **Breaking**: Removed support for enabling the Kubernetes dashboard, as this is deprecated on GKE. [#337]

## [v5.1.1] - 2019-10-25

Expand Down Expand Up @@ -228,6 +234,8 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
[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

[#337]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/337
[#340]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/340
[#268]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/268
[#311]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/311
[#303]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/303
Expand All @@ -245,6 +253,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
[#238]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/238
[#241]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/241
[#250]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/250
[#244]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/244
[#236]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/236
[#217]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/217
[#234]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/234
Expand Down
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.4.6
DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 0
DOCKER_IMAGE_DEVELOPER_TOOLS := cft/developer-tools
REGISTRY_URL := gcr.io/cloud-foundation-cicd

Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ module "gke" {
ip_range_services = "us-central1-01-gke-01-services"
http_load_balancing = false
horizontal_pod_autoscaling = true
kubernetes_dashboard = true
network_policy = true
node_pools = [
Expand All @@ -43,6 +42,7 @@ module "gke" {
machine_type = "n1-standard-2"
min_count = 1
max_count = 100
local_ssd_count = 0
disk_size_gb = 100
disk_type = "pd-standard"
image_type = "COS"
Expand Down Expand Up @@ -146,7 +146,6 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
| ip\_range\_pods | The _name_ of the secondary subnet ip range to use for pods | string | n/a | yes |
| ip\_range\_services | The _name_ of the secondary subnet range to use for services | string | n/a | yes |
| issue\_client\_certificate | Issues a client certificate to authenticate to the cluster endpoint. To maximize the security of your cluster, leave this option disabled. Client certificates don't automatically rotate and aren't easily revocable. WARNING: changing this after cluster creation is destructive! | bool | `"false"` | no |
| kubernetes\_dashboard | Enable kubernetes dashboard addon | bool | `"false"` | no |
| kubernetes\_version | The Kubernetes version of the masters. If set to 'latest' it will pull latest available version in the selected region. | string | `"latest"` | no |
| logging\_service | The logging service that the cluster should write logs to. Available options include logging.googleapis.com, logging.googleapis.com/kubernetes (beta), and none | string | `"logging.googleapis.com"` | no |
| maintenance\_start\_time | Time window specified for daily maintenance operations in RFC3339 format | string | `"05:00"` | no |
Expand Down Expand Up @@ -184,7 +183,6 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
| endpoint | Cluster endpoint |
| horizontal\_pod\_autoscaling\_enabled | Whether horizontal pod autoscaling enabled |
| http\_load\_balancing\_enabled | Whether http load balancing enabled |
| kubernetes\_dashboard\_enabled | Whether kubernetes dashboard enabled |
| location | Cluster location (region if regional cluster, zone if zonal cluster) |
| logging\_service | Logging service used |
| master\_authorized\_networks\_config | Networks from which access to master is permitted |
Expand Down
2 changes: 1 addition & 1 deletion autogen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ module "gke" {
ip_range_services = "us-central1-01-gke-01-services"
http_load_balancing = false
horizontal_pod_autoscaling = true
kubernetes_dashboard = true
network_policy = true
{% if private_cluster %}
enable_private_endpoint = true
Expand All @@ -60,6 +59,7 @@ module "gke" {
{% endif %}
min_count = 1
max_count = 100
local_ssd_count = 0
disk_size_gb = 100
disk_type = "pd-standard"
image_type = "COS"
Expand Down
File renamed without changes.
71 changes: 36 additions & 35 deletions autogen/cluster.tf → autogen/cluster.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,6 @@ resource "google_container_cluster" "primary" {
disabled = ! var.horizontal_pod_autoscaling
}

kubernetes_dashboard {
disabled = ! var.kubernetes_dashboard
}

network_policy_config {
disabled = ! var.network_policy
}
Expand Down Expand Up @@ -252,10 +248,10 @@ resource "random_id" "name" {
labels = join(",",
sort(
concat(
keys(var.node_pools_labels["all"]),
values(var.node_pools_labels["all"]),
keys(var.node_pools_labels[var.node_pools[count.index]["name"]]),
values(var.node_pools_labels[var.node_pools[count.index]["name"]])
keys(local.node_pools_labels["all"]),
values(local.node_pools_labels["all"]),
keys(local.node_pools_labels[var.node_pools[count.index]["name"]]),
values(local.node_pools_labels[var.node_pools[count.index]["name"]])
)
)
)
Expand All @@ -264,10 +260,10 @@ resource "random_id" "name" {
metadata = join(",",
sort(
concat(
keys(var.node_pools_metadata["all"]),
values(var.node_pools_metadata["all"]),
keys(var.node_pools_metadata[var.node_pools[count.index]["name"]]),
values(var.node_pools_metadata[var.node_pools[count.index]["name"]])
keys(local.node_pools_metadata["all"]),
values(local.node_pools_metadata["all"]),
keys(local.node_pools_metadata[var.node_pools[count.index]["name"]]),
values(local.node_pools_metadata[var.node_pools[count.index]["name"]])
)
)
)
Expand All @@ -276,8 +272,8 @@ resource "random_id" "name" {
oauth_scopes = join(",",
sort(
concat(
var.node_pools_oauth_scopes["all"],
var.node_pools_oauth_scopes[var.node_pools[count.index]["name"]]
local.node_pools_oauth_scopes["all"],
local.node_pools_oauth_scopes[var.node_pools[count.index]["name"]]
)
)
)
Expand All @@ -286,8 +282,8 @@ resource "random_id" "name" {
tags = join(",",
sort(
concat(
var.node_pools_tags["all"],
var.node_pools_tags[var.node_pools[count.index]["name"]]
local.node_pools_tags["all"],
local.node_pools_tags[var.node_pools[count.index]["name"]]
)
)
)
Expand All @@ -314,7 +310,9 @@ resource "google_container_node_pool" "pools" {
// use node_locations if provided, defaults to cluster level node_locations if not specified
node_locations = lookup(var.node_pools[count.index], "node_locations", "") != "" ? split(",", var.node_pools[count.index]["node_locations"]) : null
{% endif %}
cluster = google_container_cluster.primary.name

cluster = google_container_cluster.primary.name

version = lookup(var.node_pools[count.index], "auto_upgrade", false) ? "" : lookup(
var.node_pools[count.index],
"version",
Expand Down Expand Up @@ -350,25 +348,25 @@ resource "google_container_node_pool" "pools" {
image_type = lookup(var.node_pools[count.index], "image_type", "COS")
machine_type = lookup(var.node_pools[count.index], "machine_type", "n1-standard-2")
labels = merge(
lookup(lookup(var.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
lookup(lookup(var.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = var.node_pools[count.index]["name"] } : {},
var.node_pools_labels["all"],
var.node_pools_labels[var.node_pools[count.index]["name"]],
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = var.node_pools[count.index]["name"] } : {},
local.node_pools_labels["all"],
local.node_pools_labels[var.node_pools[count.index]["name"]],
)
metadata = merge(
lookup(lookup(var.node_pools_metadata, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
lookup(lookup(var.node_pools_metadata, "default_values", {}), "node_pool", true) ? { "node_pool" = var.node_pools[count.index]["name"] } : {},
var.node_pools_metadata["all"],
var.node_pools_metadata[var.node_pools[count.index]["name"]],
lookup(lookup(local.node_pools_metadata, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
lookup(lookup(local.node_pools_metadata, "default_values", {}), "node_pool", true) ? { "node_pool" = var.node_pools[count.index]["name"] } : {},
local.node_pools_metadata["all"],
local.node_pools_metadata[var.node_pools[count.index]["name"]],
{
"disable-legacy-endpoints" = var.disable_legacy_metadata_endpoints
},
)
{% if beta_cluster %}
dynamic "taint" {
for_each = concat(
var.node_pools_taints["all"],
var.node_pools_taints[var.node_pools[count.index]["name"]],
local.node_pools_taints["all"],
local.node_pools_taints[var.node_pools[count.index]["name"]],
)
content {
effect = taint.value.effect
Expand All @@ -378,14 +376,16 @@ resource "google_container_node_pool" "pools" {
}
{% endif %}
tags = concat(
lookup(var.node_pools_tags, "default_values", [true, true])[0] ? ["gke-${var.name}"] : [],
lookup(var.node_pools_tags, "default_values", [true, true])[1] ? ["gke-${var.name}-${var.node_pools[count.index]["name"]}"] : [],
var.node_pools_tags["all"],
var.node_pools_tags[var.node_pools[count.index]["name"]],
lookup(local.node_pools_tags, "default_values", [true, true])[0] ? ["gke-${var.name}"] : [],
lookup(local.node_pools_tags, "default_values", [true, true])[1] ? ["gke-${var.name}-${var.node_pools[count.index]["name"]}"] : [],
local.node_pools_tags["all"],
local.node_pools_tags[var.node_pools[count.index]["name"]],
)

disk_size_gb = lookup(var.node_pools[count.index], "disk_size_gb", 100)
disk_type = lookup(var.node_pools[count.index], "disk_type", "pd-standard")
local_ssd_count = lookup(var.node_pools[count.index], "local_ssd_count", 0)
disk_size_gb = lookup(var.node_pools[count.index], "disk_size_gb", 100)
disk_type = lookup(var.node_pools[count.index], "disk_type", "pd-standard")

service_account = lookup(
var.node_pools[count.index],
"service_account",
Expand All @@ -394,8 +394,8 @@ resource "google_container_node_pool" "pools" {
preemptible = lookup(var.node_pools[count.index], "preemptible", false)

oauth_scopes = concat(
var.node_pools_oauth_scopes["all"],
var.node_pools_oauth_scopes[var.node_pools[count.index]["name"]],
local.node_pools_oauth_scopes["all"],
local.node_pools_oauth_scopes[var.node_pools[count.index]["name"]],
)

guest_accelerator = [
Expand Down Expand Up @@ -429,6 +429,7 @@ resource "google_container_node_pool" "pools" {

lifecycle {
ignore_changes = [initial_node_count]

{% if update_variant %}
create_before_destroy = true
{% endif %}
Expand Down
File renamed without changes.
5 changes: 2 additions & 3 deletions autogen/main.tf → autogen/main.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ locals {
cluster_output_network_policy_enabled = google_container_cluster.primary.addons_config.0.network_policy_config.0.disabled
cluster_output_http_load_balancing_enabled = google_container_cluster.primary.addons_config.0.http_load_balancing.0.disabled
cluster_output_horizontal_pod_autoscaling_enabled = google_container_cluster.primary.addons_config.0.horizontal_pod_autoscaling.0.disabled
cluster_output_kubernetes_dashboard_enabled = google_container_cluster.primary.addons_config.0.kubernetes_dashboard.0.disabled

{% if beta_cluster %}
# BETA features
Expand Down Expand Up @@ -139,15 +138,15 @@ locals {
cluster_network_policy_enabled = ! local.cluster_output_network_policy_enabled
cluster_http_load_balancing_enabled = ! local.cluster_output_http_load_balancing_enabled
cluster_horizontal_pod_autoscaling_enabled = ! local.cluster_output_horizontal_pod_autoscaling_enabled
cluster_kubernetes_dashboard_enabled = ! local.cluster_output_kubernetes_dashboard_enabled
{% if beta_cluster %}
# BETA features
cluster_istio_enabled = ! local.cluster_output_istio_disabled
cluster_cloudrun_enabled = var.cloudrun
cluster_pod_security_policy_enabled = local.cluster_output_pod_security_policy_enabled
cluster_intranode_visibility_enabled = local.cluster_output_intranode_visbility_enabled
cluster_vertical_pod_autoscaling_enabled = local.cluster_output_vertical_pod_autoscaling_enabled
cluster_workload_identity_config = var.identity_namespace == "" ? [] : [{

cluster_workload_identity_config = var.identity_namespace == "" ? [] : [{
identity_namespace = var.identity_namespace
}]
# /BETA features
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 1 addition & 5 deletions autogen/outputs.tf → autogen/outputs.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ output "endpoint" {
*/
google_container_cluster.primary,
google_container_node_pool.pools,
null_resource.wait_for_cluster.id,
]
}

Expand Down Expand Up @@ -103,11 +104,6 @@ output "horizontal_pod_autoscaling_enabled" {
value = local.cluster_horizontal_pod_autoscaling_enabled
}

output "kubernetes_dashboard_enabled" {
description = "Whether kubernetes dashboard enabled"
value = local.cluster_kubernetes_dashboard_enabled
}

output "node_pools_names" {
description = "List of node pools names"
value = local.cluster_node_pools_names
Expand Down
File renamed without changes.
Loading

0 comments on commit e5a7267

Please sign in to comment.