Skip to content

Commit a19bd31

Browse files
authored
Merge pull request #5 from terraform-google-modules/master
update
2 parents 6b0e4f0 + d856f2b commit a19bd31

File tree

74 files changed

+1658
-98
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1658
-98
lines changed

.kitchen.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ suites:
4545
systems:
4646
- name: shared_vpc
4747
backend: local
48+
- name: "safer_cluster"
49+
driver:
50+
root_module_directory: test/fixtures/safer_cluster
51+
verifier:
52+
systems:
53+
- name: safer_cluster
54+
backend: local
4855
- name: "simple_regional"
4956
driver:
5057
root_module_directory: test/fixtures/simple_regional

CHANGELOG.md

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,30 @@ Extending the adopted spec, each change should have a link to its corresponding
1414
* Support for setting node_locations on node pools. [#303]
1515
* Fix for specifying `node_count` on node pools when autoscaling is disabled. [#311]
1616
* Added submodule for installing Anthos Config Management. [#268]
17-
* Support for `local_ssd_count` in node pool configuration. [#244]
17+
* Support for `local_ssd_count` in node pool configuration. [#339]
1818
* Wait for cluster to be ready before returning endpoint. [#340]
19+
* `safer-cluster` submodule. [#315]
20+
* `simple_regional_with_networking` example. [#195]
21+
* `release_channel` variable for beta submodules. [#271]
22+
* The `node_locations` attribute to the `node_pools` object for beta submodules. [#290]
23+
* `private_zonal_with_nteworking` example. [#308]
24+
* `regional_private_node_pool_oauth_scopes` example. [#321]
25+
26+
### Changed
27+
28+
* The `node_pool_labels`, `node_pool_tags`, and `node_pool_taints` variables have defaults and can be overridden within the
29+
`node_pools` object. [#3]
30+
* `upstream_nameservers` variable is typed as a list of strings. [#350]
1931

2032
### Removed
2133

2234
* **Breaking**: Removed support for enabling the Kubernetes dashboard, as this is deprecated on GKE. [#337]
35+
* **Beaking**: Removed support for versions of the Google provider and the Google Beta provider older than 2.18. [#261]
36+
37+
### Fixed
38+
39+
* `identity_namespace` output depends on the `google_container_cluster.primary` resource. [#301]
40+
* Idempotency of the beta submodules. [#326]
2341

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

@@ -217,7 +235,8 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
217235

218236
* Initial release of module.
219237

220-
[Unreleased]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v5.1.1...HEAD
238+
[Unreleased]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v5.2.0...HEAD
239+
[v5.2.0]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v5.1.1...v5.2.0
221240
[v5.1.1]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v5.1.0...v5.1.1
222241
[v5.1.0]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v5.0.0...v5.1.0
223242
[v5.0.0]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v4.1.0...v5.0.0
@@ -234,17 +253,27 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
234253
[v0.3.0]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v0.2.0...v0.3.0
235254
[v0.2.0]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v0.1.0...v0.2.0
236255

237-
[#337]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/337
256+
[#350]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/350
238257
[#340]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/340
239-
[#268]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/268
258+
[#339]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/339
259+
[#337]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/337
260+
[#326]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/326
261+
[#321]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/321
262+
[#315]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/315
240263
[#311]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/311
264+
[#308]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/308
241265
[#303]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/303
266+
[#301]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/301
242267
[#300]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/300
268+
[#290]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/290
243269
[#286]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/286
244270
[#285]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/285
245271
[#284]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/284
246272
[#282]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/282
247273
[#273]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/273
274+
[#271]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/271
275+
[#268]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/268
276+
[#261]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/261
248277
[#258]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/258
249278
[#256]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/256
250279
[#248]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/248
@@ -253,7 +282,6 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
253282
[#238]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/238
254283
[#241]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/241
255284
[#250]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/250
256-
[#244]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/244
257285
[#236]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/236
258286
[#217]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/217
259287
[#234]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/234
@@ -265,6 +293,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
265293
[#203]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/203
266294
[#198]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/198
267295
[#197]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/197
296+
[#195]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/195
268297
[#193]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/193
269298
[#188]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/188
270299
[#187]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/187
@@ -312,6 +341,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
312341
[#15]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/15
313342
[#10]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/10
314343
[#9]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/9
344+
[#3]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/3
315345

316346
[upgrading-to-v2.0]: docs/upgrading_to_v2.0.md
317347
[upgrading-to-v3.0]: docs/upgrading_to_v3.0.md

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
172172
| skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | bool | `"false"` | no |
173173
| stub\_domains | Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server | map(list(string)) | `<map>` | no |
174174
| subnetwork | The subnetwork to host the cluster in (required) | string | n/a | yes |
175-
| upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | list | `<list>` | no |
175+
| upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | list(string) | `<list>` | no |
176176
| zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | list(string) | `<list>` | no |
177177

178178
## Outputs

autogen/variables.tf.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ variable "stub_domains" {
217217
}
218218

219219
variable "upstream_nameservers" {
220-
type = "list"
220+
type = list(string)
221221
description = "If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf"
222222
default = []
223223
}

build/int.cloudbuild.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,26 @@ steps:
6464
- verify shared-vpc-local
6565
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
6666
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy shared-vpc-local']
67+
- id: create safer-cluster-local
68+
waitFor:
69+
- prepare
70+
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
71+
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do create safer-cluster-local']
72+
- id: converge safer-cluster-local
73+
waitFor:
74+
- create safer-cluster-local
75+
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
76+
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do converge safer-cluster-local']
77+
- id: verify safer-cluster-local
78+
waitFor:
79+
- converge safer-cluster-local
80+
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
81+
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do verify safer-cluster-local']
82+
- id: destroy safer-cluster-local
83+
waitFor:
84+
- verify safer-cluster-local
85+
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
86+
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy safer-cluster-local']
6787
- id: create simple-regional-local
6888
waitFor:
6989
- prepare

examples/safer_cluster/README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Safer GKE Cluster
2+
3+
This example illustrates how to instantiate the opinionated Safer Cluster module.
4+
5+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
6+
## Inputs
7+
8+
| Name | Description | Type | Default | Required |
9+
|------|-------------|:----:|:-----:|:-----:|
10+
| compute\_engine\_service\_account | Service account to associate to the nodes in the cluster | string | n/a | yes |
11+
| project\_id | The project ID to host the cluster in | string | n/a | yes |
12+
| region | The region to host the cluster in | string | `"us-central1"` | no |
13+
14+
## Outputs
15+
16+
| Name | Description |
17+
|------|-------------|
18+
| ca\_certificate | The cluster ca certificate (base64 encoded) |
19+
| client\_token | The bearer token for auth |
20+
| cluster\_name | Cluster name |
21+
| kubernetes\_endpoint | The cluster endpoint |
22+
| location | |
23+
| master\_kubernetes\_version | Kubernetes version of the master |
24+
| network\_name | The name of the VPC being created |
25+
| project\_id | The project ID the cluster is in |
26+
| region | The region in which the cluster resides |
27+
| service\_account | The service account to default running nodes as if not overridden in `node_pools`. |
28+
| subnet\_names | The names of the subnet being created |
29+
| zones | List of zones in which the cluster resides |
30+
31+
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
32+
33+
To provision this example, run the following from within this directory:
34+
- `terraform init` to get the plugins
35+
- `terraform plan` to see the infrastructure plan
36+
- `terraform apply` to apply the infrastructure build
37+
- `terraform destroy` to destroy the built infrastructure

examples/safer_cluster/main.tf

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/**
2+
* Copyright 2018 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
resource "random_string" "suffix" {
18+
length = 4
19+
special = false
20+
upper = false
21+
}
22+
23+
locals {
24+
cluster_type = "safer-cluster"
25+
network_name = "safer-cluster-network-${random_string.suffix.result}"
26+
subnet_name = "safer-cluster-subnet-${random_string.suffix.result}"
27+
master_auth_subnetwork = "safer-cluster-master-subnet-${random_string.suffix.result}"
28+
pods_range_name = "ip-range-pods-${random_string.suffix.result}"
29+
svc_range_name = "ip-range-svc-${random_string.suffix.result}"
30+
}
31+
32+
provider "google" {
33+
version = "~> 2.18.0"
34+
}
35+
36+
provider "google-beta" {
37+
version = "~> 2.18.0"
38+
}
39+
40+
module "gke" {
41+
source = "../../modules/safer-cluster/"
42+
project_id = var.project_id
43+
name = "${local.cluster_type}-cluster-${random_string.suffix.result}"
44+
regional = true
45+
region = var.region
46+
network = module.gcp-network.network_name
47+
subnetwork = module.gcp-network.subnets_names[0]
48+
ip_range_pods = local.pods_range_name
49+
ip_range_services = local.svc_range_name
50+
compute_engine_service_account = var.compute_engine_service_account
51+
master_ipv4_cidr_block = "172.16.0.0/28"
52+
master_authorized_networks_config = [
53+
{
54+
cidr_blocks = [
55+
{
56+
cidr_block = "10.60.0.0/17"
57+
display_name = "VPC"
58+
},
59+
]
60+
},
61+
]
62+
istio = true
63+
cloudrun = true
64+
}
65+
66+
data "google_client_config" "default" {
67+
}
68+

examples/safer_cluster/network.tf

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/**
2+
* Copyright 2018 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
module "gcp-network" {
18+
source = "terraform-google-modules/network/google"
19+
version = "~> 1.4.0"
20+
project_id = var.project_id
21+
network_name = local.network_name
22+
23+
subnets = [
24+
{
25+
subnet_name = local.subnet_name
26+
subnet_ip = "10.0.0.0/17"
27+
subnet_region = var.region
28+
},
29+
{
30+
subnet_name = local.master_auth_subnetwork
31+
subnet_ip = "10.60.0.0/17"
32+
subnet_region = var.region
33+
},
34+
]
35+
36+
secondary_ranges = {
37+
"${local.subnet_name}" = [
38+
{
39+
range_name = local.pods_range_name
40+
ip_cidr_range = "192.168.0.0/18"
41+
},
42+
{
43+
range_name = local.svc_range_name
44+
ip_cidr_range = "192.168.64.0/18"
45+
},
46+
]
47+
}
48+
}

examples/safer_cluster/outputs.tf

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
/**
2+
* Copyright 2018 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
output "kubernetes_endpoint" {
18+
description = "The cluster endpoint"
19+
sensitive = true
20+
value = module.gke.endpoint
21+
}
22+
23+
output "cluster_name" {
24+
description = "Cluster name"
25+
value = module.gke.name
26+
}
27+
28+
output "location" {
29+
value = module.gke.location
30+
}
31+
32+
output "master_kubernetes_version" {
33+
description = "Kubernetes version of the master"
34+
value = module.gke.master_version
35+
}
36+
37+
output "client_token" {
38+
description = "The bearer token for auth"
39+
sensitive = true
40+
value = base64encode(data.google_client_config.default.access_token)
41+
}
42+
43+
output "ca_certificate" {
44+
description = "The cluster ca certificate (base64 encoded)"
45+
value = module.gke.ca_certificate
46+
}
47+
48+
output "service_account" {
49+
description = "The service account to default running nodes as if not overridden in `node_pools`."
50+
value = module.gke.service_account
51+
}
52+
53+
output "network_name" {
54+
description = "The name of the VPC being created"
55+
value = module.gcp-network.network_name
56+
}
57+
58+
output "subnet_names" {
59+
description = "The names of the subnet being created"
60+
value = module.gcp-network.subnets_names
61+
}
62+
63+
output "region" {
64+
description = "The region in which the cluster resides"
65+
value = module.gke.region
66+
}
67+
68+
output "zones" {
69+
description = "List of zones in which the cluster resides"
70+
value = module.gke.zones
71+
}
72+
73+
output "project_id" {
74+
description = "The project ID the cluster is in"
75+
value = var.project_id
76+
}

0 commit comments

Comments
 (0)