Skip to content

Commit d7cf736

Browse files
authored
Merge branch 'master' into release-channels
2 parents 934fd12 + 287eaa4 commit d7cf736

File tree

83 files changed

+1164
-97
lines changed

Some content is hidden

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

83 files changed

+1164
-97
lines changed

.kitchen.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,23 @@ suites:
6868
systems:
6969
- name: simple_regional
7070
backend: local
71+
- name: "simple_regional_with_networking"
72+
driver:
73+
root_module_directory: test/fixtures/simple_regional_with_networking
74+
verifier:
75+
systems:
76+
- name: simple_regional_with_networking
77+
backend: local
78+
controls:
79+
- gcloud
80+
- name: subnet
81+
backend: local
82+
controls:
83+
- subnet
84+
- name: network
85+
backend: gcp
86+
controls:
87+
- network
7188
- name: "simple_regional_private"
7289
driver:
7390
root_module_directory: test/fixtures/simple_regional_private
@@ -131,3 +148,10 @@ suites:
131148
systems:
132149
- name: workload_metadata_config
133150
backend: local
151+
- name: "sandbox_enabled"
152+
driver:
153+
root_module_directory: test/fixtures/sandbox_enabled
154+
verifier:
155+
systems:
156+
- name: sandbox_enabled
157+
backend: local

CHANGELOG.md

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,29 @@ Extending the adopted spec, each change should have a link to its corresponding
88

99
## [Unreleased]
1010

11-
### Changed
11+
## [v5.1.1] - 2019-10-25
12+
13+
### Fixed
1214

13-
* Made `region` variable optional for zonal clusters [#247]
15+
* Fixed bug with setting up sandboxing on nodes. [#286]
16+
17+
## [v5.1.0] - 2019-10-24
1418

1519
### Added
1620

21+
* Added ability to skip local-exec provisioners. [#258]
1722
* Added [private](https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/tree/master/modules/private-cluster-update-variant) and [beta private](https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/tree/master/modules/beta-private-cluster-update-variant) variants which allow node pools to be created before being destroyed. [#256]
1823
* Add a parameter `registry_project_id` to allow connecting to registries in other projects. [#273]
1924

25+
### Changed
26+
27+
* Made `region` variable optional for zonal clusters. [#247]
28+
* Made default metadata, labels, and tags optional. [#282]
29+
30+
### Fixed
31+
32+
* Authenticate gcloud in wait-for-cluster.sh using value of `GOOGLE_APPLICATION_CREDENTIALS`. [#284] [#285]
33+
2034
## [v5.0.0] - 2019-09-25
2135
v5.0.0 is a backwards-incompatible release. Please see the [upgrading guide](./docs/upgrading_to_v5.0.md).
2236

@@ -190,7 +204,9 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
190204

191205
* Initial release of module.
192206

193-
[Unreleased]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v5.0.0...HEAD
207+
[Unreleased]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v5.1.1...HEAD
208+
[v5.1.1]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v5.1.0...v5.1.1
209+
[v5.1.0]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v5.0.0...v5.1.0
194210
[v5.0.0]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v4.1.0...v5.0.0
195211
[v4.1.0]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v4.0.0...v4.1.0
196212
[v4.0.0]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v3.0.0...v4.0.0
@@ -205,10 +221,15 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
205221
[v0.3.0]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v0.2.0...v0.3.0
206222
[v0.2.0]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v0.1.0...v0.2.0
207223

224+
[#286]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/286
225+
[#285]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/285
226+
[#284]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/284
227+
[#282]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/282
208228
[#273]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/273
209-
[#247]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/247
229+
[#258]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/258
210230
[#256]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/256
211231
[#248]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/248
232+
[#247]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/247
212233
[#228]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/228
213234
[#238]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/238
214235
[#241]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/241

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
170170
| registry\_project\_id | Project holding the Google Container Registry. If empty, we use the cluster project. If grant_registry_access is true, storage.objectViewer role is assigned on this project. | string | `""` | no |
171171
| remove\_default\_node\_pool | Remove default node pool while setting up the cluster | bool | `"false"` | no |
172172
| service\_account | The service account to run nodes as if not overridden in `node_pools`. The create_service_account variable default value (true) will cause a cluster-specific service account to be created. | string | `""` | no |
173+
| skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | bool | `"false"` | no |
173174
| 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 |
174175
| subnetwork | The subnetwork to host the cluster in (required) | string | n/a | yes |
175176
| upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | list | `<list>` | no |

autogen/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ Version 1.0.0 of this module introduces a breaking change: adding the `disable-l
139139
In either case, upgrading to module version `v1.0.0` will trigger a recreation of all node pools in the cluster.
140140

141141
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
142-
143142
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
144143

145144
## Requirements

autogen/cluster.tf

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,6 @@ resource "google_container_cluster" "primary" {
177177
node_metadata = workload_metadata_config.value.node_metadata
178178
}
179179
}
180-
181-
dynamic "sandbox_config" {
182-
for_each = local.cluster_sandbox_enabled
183-
184-
content {
185-
sandbox_type = sandbox_config.value
186-
}
187-
}
188180
{% endif %}
189181
}
190182
}
@@ -417,6 +409,14 @@ resource "google_container_node_pool" "pools" {
417409
node_metadata = workload_metadata_config.value.node_metadata
418410
}
419411
}
412+
413+
dynamic "sandbox_config" {
414+
for_each = local.cluster_sandbox_enabled
415+
416+
content {
417+
sandbox_type = sandbox_config.value
418+
}
419+
}
420420
{% endif %}
421421
}
422422

@@ -435,6 +435,7 @@ resource "google_container_node_pool" "pools" {
435435
}
436436

437437
resource "null_resource" "wait_for_cluster" {
438+
count = var.skip_provisioners ? 0 : 1
438439

439440
provisioner "local-exec" {
440441
command = "${path.module}/scripts/wait-for-cluster.sh ${var.project_id} ${var.name}"

autogen/dns.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
Delete default kube-dns configmap
2121
*****************************************/
2222
resource "null_resource" "delete_default_kube_dns_configmap" {
23-
count = local.custom_kube_dns_config || local.upstream_nameservers_config ? 1 : 0
23+
count = (local.custom_kube_dns_config || local.upstream_nameservers_config) && ! var.skip_provisioners ? 1 : 0
2424

2525
provisioner "local-exec" {
2626
command = "${path.module}/scripts/kubectl_wrapper.sh https://${local.cluster_endpoint} ${data.google_client_config.default.access_token} ${local.cluster_ca_certificate} ${path.module}/scripts/delete-default-resource.sh kube-system configmap kube-dns"

autogen/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,11 @@ variable "cluster_resource_labels" {
311311
default = {}
312312
}
313313

314+
variable "skip_provisioners" {
315+
type = bool
316+
description = "Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality."
317+
default = false
318+
}
314319
{% if private_cluster %}
315320

316321
variable "deploy_using_private_endpoint" {

build/int.cloudbuild.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,26 @@ steps:
101101
- verify simple-regional-private-local
102102
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
103103
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy simple-regional-private-local']
104+
- id: create simple-regional-with-networking-local
105+
waitFor:
106+
- prepare
107+
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
108+
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do create simple-regional-with-networking-local']
109+
- id: converge simple-regional-with-networking-local
110+
waitFor:
111+
- create simple-regional-with-networking-local
112+
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
113+
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do converge simple-regional-with-networking-local']
114+
- id: verify simple-regional-with-networking-local
115+
waitFor:
116+
- converge simple-regional-with-networking-local
117+
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
118+
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do verify simple-regional-with-networking-local']
119+
- id: destroy simple-regional-with-networking-local
120+
waitFor:
121+
- verify simple-regional-with-networking-local
122+
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
123+
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy simple-regional-with-networking-local']
104124
- id: create simple-zonal-local
105125
waitFor:
106126
- prepare
@@ -221,6 +241,26 @@ steps:
221241
- verify workload-metadata-config-local
222242
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
223243
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy workload-metadata-config-local']
244+
- id: create sandbox-enabled-local
245+
waitFor:
246+
- prepare
247+
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
248+
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do create sandbox-enabled-local']
249+
- id: converge sandbox-enabled-local
250+
waitFor:
251+
- create sandbox-enabled-local
252+
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
253+
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do converge sandbox-enabled-local']
254+
- id: verify sandbox-enabled-local
255+
waitFor:
256+
- converge sandbox-enabled-local
257+
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
258+
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do verify sandbox-enabled-local']
259+
- id: destroy sandbox-enabled-local
260+
waitFor:
261+
- verify sandbox-enabled-local
262+
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
263+
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy sandbox-enabled-local']
224264
tags:
225265
- 'ci'
226266
- 'integration'

cluster.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ resource "google_container_node_pool" "pools" {
220220
}
221221

222222
resource "null_resource" "wait_for_cluster" {
223+
count = var.skip_provisioners ? 0 : 1
223224

224225
provisioner "local-exec" {
225226
command = "${path.module}/scripts/wait-for-cluster.sh ${var.project_id} ${var.name}"

dns.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
Delete default kube-dns configmap
2121
*****************************************/
2222
resource "null_resource" "delete_default_kube_dns_configmap" {
23-
count = local.custom_kube_dns_config || local.upstream_nameservers_config ? 1 : 0
23+
count = (local.custom_kube_dns_config || local.upstream_nameservers_config) && ! var.skip_provisioners ? 1 : 0
2424

2525
provisioner "local-exec" {
2626
command = "${path.module}/scripts/kubectl_wrapper.sh https://${local.cluster_endpoint} ${data.google_client_config.default.access_token} ${local.cluster_ca_certificate} ${path.module}/scripts/delete-default-resource.sh kube-system configmap kube-dns"

examples/deploy_service/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ It will:
3737
| network | |
3838
| project\_id | |
3939
| region | |
40-
| service\_account | The service account to default running nodes as if not overridden in `node_pools`. |
40+
| service\_account | The default service account used for running nodes. |
4141
| subnetwork | |
4242
| zones | List of zones in which the cluster resides |
4343

examples/deploy_service/outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ output "ca_certificate" {
2929
}
3030

3131
output "service_account" {
32-
description = "The service account to default running nodes as if not overridden in `node_pools`."
32+
description = "The default service account used for running nodes."
3333
value = module.gke.service_account
3434
}
3535

examples/disable_client_cert/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ This example illustrates how to create a simple cluster and disable deprecated s
3636
| network | |
3737
| project\_id | |
3838
| region | |
39-
| service\_account | The service account to default running nodes as if not overridden in `node_pools`. |
39+
| service\_account | The default service account used for running nodes. |
4040
| subnetwork | |
4141
| zones | List of zones in which the cluster resides |
4242

examples/disable_client_cert/outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ output "ca_certificate" {
2929
}
3030

3131
output "service_account" {
32-
description = "The service account to default running nodes as if not overridden in `node_pools`."
32+
description = "The default service account used for running nodes."
3333
value = module.gke.service_account
3434
}
3535

examples/node_pool/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ This example illustrates how to create a cluster with multiple custom node-pool
3232
| network | |
3333
| project\_id | |
3434
| region | |
35-
| service\_account | The service account to default running nodes as if not overridden in `node_pools`. |
35+
| service\_account | The default service account used for running nodes. |
3636
| subnetwork | |
3737
| zones | List of zones in which the cluster resides |
3838

examples/node_pool/outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ output "ca_certificate" {
2929
}
3030

3131
output "service_account" {
32-
description = "The service account to default running nodes as if not overridden in `node_pools`."
32+
description = "The default service account used for running nodes."
3333
value = module.gke.service_account
3434
}
3535

examples/shared_vpc/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ This example illustrates how to create a simple cluster where the host network i
3232
| network | |
3333
| project\_id | |
3434
| region | |
35-
| service\_account | The service account to default running nodes as if not overridden in `node_pools`. |
35+
| service\_account | The default service account used for running nodes. |
3636
| subnetwork | |
3737
| zones | List of zones in which the cluster resides |
3838

examples/shared_vpc/outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ output "ca_certificate" {
2929
}
3030

3131
output "service_account" {
32-
description = "The service account to default running nodes as if not overridden in `node_pools`."
32+
description = "The default service account used for running nodes."
3333
value = module.gke.service_account
3434
}
3535

examples/simple_regional/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ This example illustrates how to create a simple cluster.
1414
| network | The VPC network to host the cluster in | string | n/a | yes |
1515
| project\_id | The project ID to host the cluster in | string | n/a | yes |
1616
| region | The region to host the cluster in | string | n/a | yes |
17+
| skip\_provisioners | Flag to skip local-exec provisioners | bool | `"false"` | no |
1718
| subnetwork | The subnetwork to host the cluster in | string | n/a | yes |
1819

1920
## Outputs
@@ -31,7 +32,7 @@ This example illustrates how to create a simple cluster.
3132
| network | |
3233
| project\_id | |
3334
| region | |
34-
| service\_account | The service account to default running nodes as if not overridden in `node_pools`. |
35+
| service\_account | The default service account used for running nodes. |
3536
| subnetwork | |
3637
| zones | List of zones in which the cluster resides |
3738

examples/simple_regional/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ module "gke" {
3535
ip_range_services = var.ip_range_services
3636
create_service_account = false
3737
service_account = var.compute_engine_service_account
38+
skip_provisioners = var.skip_provisioners
3839
}
3940

4041
data "google_client_config" "default" {

examples/simple_regional/outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ output "ca_certificate" {
2929
}
3030

3131
output "service_account" {
32-
description = "The service account to default running nodes as if not overridden in `node_pools`."
32+
description = "The default service account used for running nodes."
3333
value = module.gke.service_account
3434
}
3535

examples/simple_regional/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,8 @@ variable "compute_engine_service_account" {
4747
description = "Service account to associate to the nodes in the cluster"
4848
}
4949

50+
variable "skip_provisioners" {
51+
type = bool
52+
description = "Flag to skip local-exec provisioners"
53+
default = false
54+
}

0 commit comments

Comments
 (0)