Skip to content

Commit

Permalink
Merge pull request #137 from terraform-google-modules/aaron-lane-v2.0.0
Browse files Browse the repository at this point in the history
v2.0.0
  • Loading branch information
aaron-lane authored Apr 12, 2019
2 parents 90bb4b6 + f9fbdf3 commit 76d38de
Show file tree
Hide file tree
Showing 50 changed files with 787 additions and 53 deletions.
21 changes: 20 additions & 1 deletion .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@ suites:
backend: local
provisioner:
name: terraform
- name: "disable_client_cert"
driver:
name: "terraform"
command_timeout: 1800
root_module_directory: test/fixtures/disable_client_cert
verifier:
name: terraform
color: false
systems:
- name: disable_client_cert
backend: local
provisioner:
name: terraform
- name: "node_pool"
driver:
name: "terraform"
Expand Down Expand Up @@ -98,8 +111,14 @@ suites:
name: terraform
color: false
systems:
- name: simple_zonal
- name: gcloud
backend: local
controls:
- gcloud
- name: gcp
backend: gcp
controls:
- gcp
provisioner:
name: terraform
- name: "simple_zonal_private"
Expand Down
22 changes: 20 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ Extending the adopted spec, each change should have a link to its corresponding

## [Unreleased]

## [v2.0.0] - 2019-YY-ZZ

### Added

* Add `basic_auth_username` set to `""` by default. [#40]
* Add `basic_auth_password` set to `""` by default. [#40]
* Add `issue_client_certificate` set to `false` by default. [#40]

### Changed

* The `service_account` variable defaults to `"create"` which causes a
cluster-specific service account to be created.
* Disabled Basic Authentication by default. [#40]

## [v1.0.1] - 2019-04-04

### Added
Expand All @@ -33,7 +47,9 @@ Extending the adopted spec, each change should have a link to its corresponding
* Added `disable_legacy_metadata_endpoints` parameter. [#114]

### Changed
* Set `horizontal_pod_autoscaling` to `true` by default. Fixes [#42]. [#54]

* Set `horizontal_pod_autoscaling` to `true` by default.
Fixes [#42]. [#54]
* Update simple-zonal example GKE version to supported version. [#49]
* Drop explicit version from simple_zonal example. [#74]
* Remove explicit versions from test cases and examples. [#62]
Expand Down Expand Up @@ -76,7 +92,8 @@ Extending the adopted spec, each change should have a link to its corresponding

* Initial release of module.

[Unreleased]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v1.0.1...HEAD
[Unreleased]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v2.0.0...HEAD
[v2.0.0]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v1.0.1...v2.0.0
[v1.0.1]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v1.0.0...v1.0.1
[v1.0.0]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v0.4.0...v1.0.0
[v0.4.0]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v0.4.0...v0.5.0
Expand Down Expand Up @@ -106,6 +123,7 @@ Extending the adopted spec, each change should have a link to its corresponding
[#46]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/46
[#43]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/43
[#42]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/42
[#40]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/40
[#38]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/38
[#33]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/33
[#31]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/31
Expand Down
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ module "gke" {
},
]
node_pools_oauth_scopes = {
all = []
default-node-pool = [
"https://www.googleapis.com/auth/cloud-platform",
]
}
node_pools_labels = {
all = {}
Expand Down Expand Up @@ -89,6 +97,11 @@ Then perform the following commands on the root folder:
- `terraform apply` to apply the infrastructure build
- `terraform destroy` to destroy the built infrastructure

## Upgrade to v2.0.0

v2.0.0 is a breaking release. Refer to the
[Upgrading to v2.0 guide][upgrading-to-v2.0] for details.

## Upgrade to v1.0.0

Version 1.0.0 of this module introduces a breaking change: adding the `disable-legacy-endpoints` metadata field to all node pools. This metadata is required by GKE and [determines whether the `/0.1/` and `/v1beta1/` paths are available in the nodes' metadata server](https://cloud.google.com/kubernetes-engine/docs/how-to/protecting-cluster-metadata#disable-legacy-apis). If your applications do not require access to the node's metadata server, you can leave the default value of `true` provided by the module. If your applications require access to the metadata server, be sure to read the linked documentation to see if you need to set the value for this field to `false` to allow your applications access to the above metadata server paths.
Expand All @@ -101,6 +114,8 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| basic\_auth\_password | The password to be used with Basic Authentication. | string | `""` | no |
| basic\_auth\_username | The username to be used with Basic Authentication. An empty value will disable Basic Authentication, which is the recommended configuration. | string | `""` | 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. | string | `"true"` | no |
| horizontal\_pod\_autoscaling | Enable horizontal pod autoscaling addon | string | `"true"` | no |
Expand All @@ -109,6 +124,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
| ip\_masq\_resync\_interval | The interval at which the agent attempts to sync its ConfigMap file from the disk. | string | `"60s"` | no |
| 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! | string | `"false"` | no |
| kubernetes\_dashboard | Enable kubernetes dashboard addon | string | `"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 |
Expand All @@ -122,6 +138,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
| node\_pools | List of maps containing node pools | list | `<list>` | no |
| node\_pools\_labels | Map of maps containing node labels by node-pool name | map | `<map>` | no |
| node\_pools\_metadata | Map of maps containing node metadata by node-pool name | map | `<map>` | no |
| node\_pools\_oauth\_scopes | Map of lists containing node oauth scopes by node-pool name | map | `<map>` | no |
| node\_pools\_tags | Map of lists containing node network tags by node-pool name | map | `<map>` | no |
| node\_pools\_taints | Map of lists containing node taints by node-pool name | map | `<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 |
Expand All @@ -130,7 +147,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
| region | The region to host the cluster in (required) | string | n/a | yes |
| regional | Whether is a regional cluster (zonal cluster if set false. WARNING: changing this after cluster creation is destructive!) | string | `"true"` | no |
| remove\_default\_node\_pool | Remove default node pool while setting up the cluster | string | `"false"` | no |
| service\_account | The service account to default running nodes as if not overridden in `node_pools`. Defaults to the compute engine default service account. May also specify `create` to automatically create a cluster-specific service account | string | `""` | no |
| service\_account | The service account to run nodes as if not overridden in `node_pools`. The default value will cause a cluster-specific service account to be created. | string | `"create"` | no |
| stub\_domains | Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server | map | `<map>` | no |
| subnetwork | The subnetwork to host the cluster in (required) | string | n/a | yes |
| zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | list | `<list>` | no |
Expand Down Expand Up @@ -339,3 +356,5 @@ is a compiled language so there is no standard linter.
* Terraform - terraform has a built-in linter in the 'terraform validate'
command.
* Dockerfiles - hadolint. Can be found in homebrew

[upgrading-to-v2.0]: docs/upgrading_to_v2.0.md
2 changes: 1 addition & 1 deletion auth.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ provider "kubernetes" {
host = "https://${local.cluster_endpoint}"
token = "${data.google_client_config.default.access_token}"
cluster_ca_certificate = "${base64decode(local.cluster_ca_certificate)}"
}
}
19 changes: 19 additions & 0 deletions autogen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ module "gke" {
},
]
node_pools_oauth_scopes = {
all = []
default-node-pool = [
"https://www.googleapis.com/auth/cloud-platform",
]
}
node_pools_labels = {
all = {}
Expand Down Expand Up @@ -99,6 +107,11 @@ Then perform the following commands on the root folder:
- `terraform apply` to apply the infrastructure build
- `terraform destroy` to destroy the built infrastructure

## Upgrade to v2.0.0

v2.0.0 is a breaking release. Refer to the
[Upgrading to v2.0 guide][upgrading-to-v2.0] for details.

## Upgrade to v1.0.0

Version 1.0.0 of this module introduces a breaking change: adding the `disable-legacy-endpoints` metadata field to all node pools. This metadata is required by GKE and [determines whether the `/0.1/` and `/v1beta1/` paths are available in the nodes' metadata server](https://cloud.google.com/kubernetes-engine/docs/how-to/protecting-cluster-metadata#disable-legacy-apis). If your applications do not require access to the node's metadata server, you can leave the default value of `true` provided by the module. If your applications require access to the metadata server, be sure to read the linked documentation to see if you need to set the value for this field to `false` to allow your applications access to the above metadata server paths.
Expand Down Expand Up @@ -290,3 +303,9 @@ is a compiled language so there is no standard linter.
* Terraform - terraform has a built-in linter in the 'terraform validate'
command.
* Dockerfiles - hadolint. Can be found in homebrew

{% if private_cluster %}
[upgrading-to-v2.0]: ../../docs/upgrading_to_v2.0.md
{% else %}
[upgrading-to-v2.0]: docs/upgrading_to_v2.0.md
{% endif %}
18 changes: 15 additions & 3 deletions autogen/cluster_regional.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ resource "google_container_cluster" "primary" {
description = "${var.description}"
project = "${var.project_id}"

region = "${var.region}"
node_locations = ["${coalescelist(compact(var.zones), sort(random_shuffle.available_zones.result))}"]
region = "${var.region}"
node_locations = ["${coalescelist(compact(var.zones), sort(random_shuffle.available_zones.result))}"]

network = "${replace(data.google_compute_network.gke_network.self_link, "https://www.googleapis.com/compute/v1/", "")}"
subnetwork = "${replace(data.google_compute_subnetwork.gke_subnetwork.self_link, "https://www.googleapis.com/compute/v1/", "")}"
Expand All @@ -38,6 +38,15 @@ resource "google_container_cluster" "primary" {

master_authorized_networks_config = ["${var.master_authorized_networks_config}"]

master_auth {
username = "${var.basic_auth_username}"
password = "${var.basic_auth_password}"

client_certificate_config {
issue_client_certificate = "${var.issue_client_certificate}"
}
}

addons_config {
http_load_balancing {
disabled = "${var.http_load_balancing ? 0 : 1}"
Expand Down Expand Up @@ -85,12 +94,14 @@ resource "google_container_cluster" "primary" {
}
}
{% if private_cluster %}

private_cluster_config {
enable_private_endpoint = "${var.enable_private_endpoint}"
enable_private_nodes = "${var.enable_private_nodes}"
master_ipv4_cidr_block = "${var.master_ipv4_cidr_block}"
}
{% endif %}

remove_default_node_pool = "${var.remove_default_node_pool}"
}

Expand Down Expand Up @@ -131,7 +142,8 @@ resource "google_container_node_pool" "pools" {
preemptible = "${lookup(var.node_pools[count.index], "preemptible", false)}"

oauth_scopes = [
"https://www.googleapis.com/auth/cloud-platform",
"${concat(var.node_pools_oauth_scopes["all"],
var.node_pools_oauth_scopes[lookup(var.node_pools[count.index], "name")])}",
]
}

Expand Down
18 changes: 15 additions & 3 deletions autogen/cluster_zonal.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ resource "google_container_cluster" "zonal_primary" {
description = "${var.description}"
project = "${var.project_id}"

zone = "${var.zones[0]}"
node_locations = ["${slice(var.zones,1,length(var.zones))}"]
zone = "${var.zones[0]}"
node_locations = ["${slice(var.zones,1,length(var.zones))}"]

network = "${replace(data.google_compute_network.gke_network.self_link, "https://www.googleapis.com/compute/v1/", "")}"
subnetwork = "${replace(data.google_compute_subnetwork.gke_subnetwork.self_link, "https://www.googleapis.com/compute/v1/", "")}"
Expand All @@ -38,6 +38,15 @@ resource "google_container_cluster" "zonal_primary" {

master_authorized_networks_config = ["${var.master_authorized_networks_config}"]

master_auth {
username = "${var.basic_auth_username}"
password = "${var.basic_auth_password}"

client_certificate_config {
issue_client_certificate = "${var.issue_client_certificate}"
}
}

addons_config {
http_load_balancing {
disabled = "${var.http_load_balancing ? 0 : 1}"
Expand Down Expand Up @@ -85,12 +94,14 @@ resource "google_container_cluster" "zonal_primary" {
}
}
{% if private_cluster %}

private_cluster_config {
enable_private_endpoint = "${var.enable_private_endpoint}"
enable_private_nodes = "${var.enable_private_nodes}"
master_ipv4_cidr_block = "${var.master_ipv4_cidr_block}"
}
{% endif %}

remove_default_node_pool = "${var.remove_default_node_pool}"
}

Expand Down Expand Up @@ -131,7 +142,8 @@ resource "google_container_node_pool" "zonal_pools" {
preemptible = "${lookup(var.node_pools[count.index], "preemptible", false)}"

oauth_scopes = [
"https://www.googleapis.com/auth/cloud-platform",
"${concat(var.node_pools_oauth_scopes["all"],
var.node_pools_oauth_scopes[lookup(var.node_pools[count.index], "name")])}",
]
}

Expand Down
2 changes: 1 addition & 1 deletion autogen/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,5 @@ output "node_pools_versions" {

output "service_account" {
description = "The service account to default running nodes as if not overridden in `node_pools`."
value = "${local.service_account}"
value = "${local.service_account}"
}
29 changes: 27 additions & 2 deletions autogen/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,16 @@ variable "node_pools_tags" {
}
}

variable "node_pools_oauth_scopes" {
type = "map"
description = "Map of lists containing node oauth scopes by node-pool name"

default = {
all = ["https://www.googleapis.com/auth/cloud-platform"]
default-node-pool = []
}
}

variable "stub_domains" {
type = "map"
description = "Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server"
Expand Down Expand Up @@ -213,8 +223,8 @@ variable "monitoring_service" {
}

variable "service_account" {
description = "The service account to default running nodes as if not overridden in `node_pools`. Defaults to the compute engine default service account. May also specify `create` to automatically create a cluster-specific service account"
default = ""
description = "The service account to run nodes as if not overridden in `node_pools`. The default value will cause a cluster-specific service account to be created."
default = "create"
}
{% if private_cluster %}

Expand All @@ -233,3 +243,18 @@ variable "master_ipv4_cidr_block" {
default = "10.0.0.0/28"
}
{% endif %}

variable "basic_auth_username" {
description = "The username to be used with Basic Authentication. An empty value will disable Basic Authentication, which is the recommended configuration."
default = ""
}

variable "basic_auth_password" {
description = "The password to be used with Basic Authentication."
default = ""
}

variable "issue_client_certificate" {
description = "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!"
default = "false"
}
Loading

0 comments on commit 76d38de

Please sign in to comment.