Skip to content

Commit ab4e79b

Browse files
authored
Merge branch 'master' into fix_ci_tests_node_pool_deploy_service
2 parents eadb54a + ce90c83 commit ab4e79b

File tree

66 files changed

+1187
-81
lines changed

Some content is hidden

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

66 files changed

+1187
-81
lines changed

.kitchen.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,23 @@ suites:
5252
systems:
5353
- name: simple_regional
5454
backend: local
55+
- name: "simple_regional_with_networking"
56+
driver:
57+
root_module_directory: test/fixtures/simple_regional_with_networking
58+
verifier:
59+
systems:
60+
- name: simple_regional_with_networking
61+
backend: local
62+
controls:
63+
- gcloud
64+
- name: subnet
65+
backend: local
66+
controls:
67+
- subnet
68+
- name: network
69+
backend: gcp
70+
controls:
71+
- network
5572
- name: "simple_regional_private"
5673
driver:
5774
root_module_directory: test/fixtures/simple_regional_private
@@ -140,3 +157,10 @@ suites:
140157
controls:
141158
- gcloud
142159
- kubectl
160+
- name: "sandbox_enabled"
161+
driver:
162+
root_module_directory: test/fixtures/sandbox_enabled
163+
verifier:
164+
systems:
165+
- name: sandbox_enabled
166+
backend: local

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ Extending the adopted spec, each change should have a link to its corresponding
88

99
## [Unreleased]
1010

11+
## [v5.1.1] - 2019-10-25
12+
13+
### Fixed
14+
15+
* Fixed bug with setting up sandboxing on nodes. [#286]
16+
1117
## [v5.1.0] - 2019-10-24
1218

1319
### Added
@@ -198,7 +204,8 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
198204

199205
* Initial release of module.
200206

201-
[Unreleased]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v5.1.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
202209
[v5.1.0]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v5.0.0...v5.1.0
203210
[v5.0.0]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v4.1.0...v5.0.0
204211
[v4.1.0]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v4.0.0...v4.1.0
@@ -214,6 +221,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
214221
[v0.3.0]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v0.2.0...v0.3.0
215222
[v0.2.0]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v0.1.0...v0.2.0
216223

224+
[#286]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/286
217225
[#285]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/285
218226
[#284]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/284
219227
[#282]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/282

Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# Make will use bash instead of sh
1919
SHELL := /usr/bin/env bash
2020

21-
DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 0.4.5
21+
DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 0.4.6
2222
DOCKER_IMAGE_DEVELOPER_TOOLS := cft/developer-tools
2323
REGISTRY_URL := gcr.io/cloud-foundation-cicd
2424

@@ -27,7 +27,7 @@ REGISTRY_URL := gcr.io/cloud-foundation-cicd
2727
docker_run:
2828
docker run --rm -it \
2929
-e SERVICE_ACCOUNT_JSON \
30-
-v $(CURDIR):/workspace \
30+
-v "$(CURDIR)":/workspace \
3131
$(REGISTRY_URL)/${DOCKER_IMAGE_DEVELOPER_TOOLS}:${DOCKER_TAG_VERSION_DEVELOPER_TOOLS} \
3232
/bin/bash
3333

@@ -39,7 +39,7 @@ docker_test_prepare:
3939
-e TF_VAR_org_id \
4040
-e TF_VAR_folder_id \
4141
-e TF_VAR_billing_account \
42-
-v $(CURDIR):/workspace \
42+
-v "$(CURDIR)":/workspace \
4343
$(REGISTRY_URL)/${DOCKER_IMAGE_DEVELOPER_TOOLS}:${DOCKER_TAG_VERSION_DEVELOPER_TOOLS} \
4444
/usr/local/bin/execute_with_credentials.sh prepare_environment
4545

@@ -51,7 +51,7 @@ docker_test_cleanup:
5151
-e TF_VAR_org_id \
5252
-e TF_VAR_folder_id \
5353
-e TF_VAR_billing_account \
54-
-v $(CURDIR):/workspace \
54+
-v "$(CURDIR)":/workspace \
5555
$(REGISTRY_URL)/${DOCKER_IMAGE_DEVELOPER_TOOLS}:${DOCKER_TAG_VERSION_DEVELOPER_TOOLS} \
5656
/usr/local/bin/execute_with_credentials.sh cleanup_environment
5757

@@ -60,31 +60,31 @@ docker_test_cleanup:
6060
docker_test_integration:
6161
docker run --rm -it \
6262
-e SERVICE_ACCOUNT_JSON \
63-
-v $(CURDIR):/workspace \
63+
-v "$(CURDIR)":/workspace \
6464
$(REGISTRY_URL)/${DOCKER_IMAGE_DEVELOPER_TOOLS}:${DOCKER_TAG_VERSION_DEVELOPER_TOOLS} \
6565
/usr/local/bin/test_integration.sh
6666

6767
# Execute lint tests within the docker container
6868
.PHONY: docker_test_lint
6969
docker_test_lint:
7070
docker run --rm -it \
71-
-v $(CURDIR):/workspace \
71+
-v "$(CURDIR)":/workspace \
7272
$(REGISTRY_URL)/${DOCKER_IMAGE_DEVELOPER_TOOLS}:${DOCKER_TAG_VERSION_DEVELOPER_TOOLS} \
7373
/usr/local/bin/test_lint.sh
7474

7575
# Generate documentation
7676
.PHONY: docker_generate_docs
7777
docker_generate_docs:
7878
docker run --rm -it \
79-
-v $(CURDIR):/workspace \
79+
-v "$(CURDIR)":/workspace \
8080
$(REGISTRY_URL)/${DOCKER_IMAGE_DEVELOPER_TOOLS}:${DOCKER_TAG_VERSION_DEVELOPER_TOOLS} \
8181
/bin/bash -c 'source /usr/local/bin/task_helper_functions.sh && generate_docs'
8282

8383
# Generate files from autogen
8484
.PHONY: docker_generate
8585
docker_generate:
8686
docker run --rm -it \
87-
-v $(CURDIR):/workspace \
87+
-v "$(CURDIR)":/workspace \
8888
$(REGISTRY_URL)/${DOCKER_IMAGE_DEVELOPER_TOOLS}:${DOCKER_TAG_VERSION_DEVELOPER_TOOLS} \
8989
/bin/bash -c 'source /usr/local/bin/task_helper_functions.sh && generate'
9090

autogen/cluster.tf

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ resource "google_container_cluster" "primary" {
4545
}
4646
}
4747

48+
{% if beta_cluster %}
49+
dynamic "release_channel" {
50+
for_each = local.release_channel
51+
52+
content {
53+
channel = release_channel.value.channel
54+
}
55+
}
56+
{% endif %}
57+
4858
subnetwork = data.google_compute_subnetwork.gke_subnetwork.self_link
4959
min_master_version = local.master_version
5060

@@ -167,14 +177,6 @@ resource "google_container_cluster" "primary" {
167177
node_metadata = workload_metadata_config.value.node_metadata
168178
}
169179
}
170-
171-
dynamic "sandbox_config" {
172-
for_each = local.cluster_sandbox_enabled
173-
174-
content {
175-
sandbox_type = sandbox_config.value
176-
}
177-
}
178180
{% endif %}
179181
}
180182
}
@@ -407,6 +409,14 @@ resource "google_container_node_pool" "pools" {
407409
node_metadata = workload_metadata_config.value.node_metadata
408410
}
409411
}
412+
413+
dynamic "sandbox_config" {
414+
for_each = local.cluster_sandbox_enabled
415+
416+
content {
417+
sandbox_type = sandbox_config.value
418+
}
419+
}
410420
{% endif %}
411421
}
412422

autogen/main.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ locals {
4848
node_version_zonal = var.node_version != "" && ! var.regional ? var.node_version : local.master_version_zonal
4949
master_version = var.regional ? local.master_version_regional : local.master_version_zonal
5050
node_version = var.regional ? local.node_version_regional : local.node_version_zonal
51+
{% if beta_cluster %}
52+
release_channel = var.release_channel != null ? [{ channel : var.release_channel }] : []
53+
{% endif %}
54+
5155

5256
custom_kube_dns_config = length(keys(var.stub_domains)) > 0
5357
upstream_nameservers_config = length(var.upstream_nameservers) > 0

autogen/outputs.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,4 +150,8 @@ output "vertical_pod_autoscaling_enabled" {
150150
value = local.cluster_vertical_pod_autoscaling_enabled
151151
}
152152

153+
output "release_channel" {
154+
description = "The release channel of this cluster"
155+
value = var.release_channel
156+
}
153157
{% endif %}

autogen/scripts/wait-for-cluster.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515

1616
set -e
1717

18+
# shellcheck disable=SC2034
1819
if [ -n "${GOOGLE_APPLICATION_CREDENTIALS}" ]; then
19-
export CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE=${GOOGLE_APPLICATION_CREDENTIALS}
20+
export CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE="${GOOGLE_APPLICATION_CREDENTIALS}"
2021
fi
2122

2223
PROJECT=$1

autogen/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,4 +422,9 @@ variable "authenticator_security_group" {
422422
default = null
423423
}
424424

425+
variable "release_channel" {
426+
type = string
427+
description = "(Beta) The release channel of this cluster. Accepted values are `UNSPECIFIED`, `RAPID`, `REGULAR` and `STABLE`. Defaults to `UNSPECIFIED`."
428+
default = null
429+
}
425430
{% endif %}

build/int.cloudbuild.yaml

Lines changed: 41 additions & 1 deletion
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
@@ -261,9 +281,29 @@ steps:
261281
- verify node-pool-local
262282
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
263283
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy node-pool-local']
284+
- id: create sandbox-enabled-local
285+
waitFor:
286+
- prepare
287+
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
288+
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do create sandbox-enabled-local']
289+
- id: converge sandbox-enabled-local
290+
waitFor:
291+
- create sandbox-enabled-local
292+
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
293+
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do converge sandbox-enabled-local']
294+
- id: verify sandbox-enabled-local
295+
waitFor:
296+
- converge sandbox-enabled-local
297+
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
298+
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do verify sandbox-enabled-local']
299+
- id: destroy sandbox-enabled-local
300+
waitFor:
301+
- verify sandbox-enabled-local
302+
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
303+
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy sandbox-enabled-local']
264304
tags:
265305
- 'ci'
266306
- 'integration'
267307
substitutions:
268308
_DOCKER_IMAGE_DEVELOPER_TOOLS: 'cft/developer-tools'
269-
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.4.5'
309+
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.4.6'

build/lint.cloudbuild.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ tags:
2424
- 'lint'
2525
substitutions:
2626
_DOCKER_IMAGE_DEVELOPER_TOOLS: 'cft/developer-tools'
27-
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.4.5'
27+
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.4.6'

cluster.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ resource "google_container_cluster" "primary" {
4141
}
4242
}
4343

44+
4445
subnetwork = data.google_compute_subnetwork.gke_subnetwork.self_link
4546
min_master_version = local.master_version
4647

examples/node_pool/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ locals {
1919
}
2020

2121
provider "google-beta" {
22-
version = "~> 2.12.0"
22+
version = "~> 2.18.0"
2323
region = var.region
2424
}
2525

examples/node_pool_update_variant_beta/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ locals {
1919
}
2020

2121
provider "google-beta" {
22-
version = "~> 2.12.0"
22+
version = "~> 2.18.0"
2323
credentials = file(var.credentials_path)
2424
region = var.region
2525
}

examples/simple_regional_beta/README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,24 @@
22

33
This example illustrates how to create a simple cluster with beta features.
44

5-
[^]: (autogen_docs_start)
6-
5+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
76
## Inputs
87

98
| Name | Description | Type | Default | Required |
109
|------|-------------|:----:|:-----:|:-----:|
1110
| cloudrun | Boolean to enable / disable CloudRun | string | `"true"` | no |
1211
| cluster\_name\_suffix | A suffix to append to the default cluster name | string | `""` | no |
1312
| compute\_engine\_service\_account | Service account to associate to the nodes in the cluster | string | n/a | yes |
14-
| credentials\_path | The path to the GCP credentials JSON file | string | n/a | yes |
1513
| ip\_range\_pods | The secondary ip range to use for pods | string | n/a | yes |
1614
| ip\_range\_services | The secondary ip range to use for pods | string | n/a | yes |
1715
| istio | Boolean to enable / disable Istio | string | `"true"` | no |
1816
| network | The VPC network to host the cluster in | string | n/a | yes |
17+
| node\_metadata | Specifies how node metadata is exposed to the workload running on the node | string | `"SECURE"` | no |
18+
| node\_pools | List of maps containing node pools | list(map(string)) | `<list>` | no |
1919
| project\_id | The project ID to host the cluster in | string | n/a | yes |
2020
| region | The region to host the cluster in | string | n/a | yes |
21+
| remove\_default\_node\_pool | Remove default node pool while setting up the cluster | bool | `"false"` | no |
22+
| sandbox\_enabled | (Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` and `node_version` = `1.12.7-gke.17` or later to use it). | bool | `"false"` | no |
2123
| subnetwork | The subnetwork to host the cluster in | string | n/a | yes |
2224

2325
## Outputs
@@ -27,7 +29,6 @@ This example illustrates how to create a simple cluster with beta features.
2729
| ca\_certificate | |
2830
| client\_token | |
2931
| cluster\_name | Cluster name |
30-
| credentials\_path | |
3132
| ip\_range\_pods | The secondary IP range used for pods |
3233
| ip\_range\_services | The secondary IP range used for services |
3334
| kubernetes\_endpoint | |
@@ -36,11 +37,11 @@ This example illustrates how to create a simple cluster with beta features.
3637
| network | |
3738
| project\_id | |
3839
| region | |
39-
| 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. |
4041
| subnetwork | |
4142
| zones | List of zones in which the cluster resides |
4243

43-
[^]: (autogen_docs_end)
44+
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
4445

4546
To provision this example, run the following from within this directory:
4647
- `terraform init` to get the plugins

0 commit comments

Comments
 (0)