You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| kubernetes_version | The Kubernetes version of the masters. If set to 'latest' it will pull latest available version in the selected region. | string |`1.10.6-gke.2`| no |
100
+
| 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 |
101
101
| 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 |
102
102
| maintenance_start_time | Time window specified for daily maintenance operations in RFC3339 format | string |`05:00`| no |
103
103
| master_authorized_networks_config | The desired configuration options for master authorized networks. Omit the nested cidr_blocks attribute to disallow external access (except the cluster node IPs, which GKE automatically whitelists)<br><br> ### example format ### master_authorized_networks_config = [{ cidr_blocks = [{ cidr_block = "10.0.0.0/8" display_name = "example_network" }], }]| list |`<list>`| no |
@@ -115,6 +115,7 @@ Then perform the following commands on the root folder:
115
115
| project_id | The project ID to host the cluster in (required) | string | - | yes |
116
116
| region | The region to host the cluster in (required) | string | - | yes |
117
117
| regional | Whether is a regional cluster (zonal cluster if set false. WARNING: changing this after cluster creation is destructive!) | string |`true`| no |
118
+
| service_account | The service account to default running nodes as if not overridden in `node_pools`. Defaults to the compute engine default service account | string | `` | no |
118
119
| 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 |
119
120
| subnetwork | The subnetwork to host the cluster in (required) | string | - | yes |
120
121
| zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | list |`<list>`| no |
@@ -163,12 +164,12 @@ The [project factory](https://github.com/terraform-google-modules/terraform-goog
### Autogeneration of documentation from .tf files
@@ -209,27 +209,59 @@ make generate_docs
209
209
```
210
210
211
211
### Integration test
212
-
#### Terraform integration tests
213
-
The integration tests for this module leverage [kitchen-terraform](https://github.com/newcontext-oss/kitchen-terraform) and [kitchen-inspec](https://github.com/inspec/kitchen-inspec).
214
-
215
-
The tests will do the following:
216
-
- Perform `bundle install` command
217
-
- Installs `kitchen-terraform` and `kitchen-inspec` gems
218
-
- Perform `kitchen create` command
219
-
- Performs a `terraform init`
220
-
- Perform `kitchen converge` command
221
-
- Performs a `terraform apply -auto-approve`
222
-
- Perform `kitchen validate` command
223
-
- Performs inspec tests.
224
-
- Shell out to `gcloud` to validate expected resources in GCP.
225
-
- Shell out to `kubectl` to validate expected resource in Kubernetes.
226
-
- Shell out to `terraform` to validate outputs.
227
-
- Permos `kitchen destroy` command
228
-
- Performs a `terraform destroy -force`
229
-
230
-
You can use the following command to run the integration test in the root folder
231
-
232
-
`make test_integration`
212
+
213
+
Integration tests are run though [test-kitchen](https://github.com/test-kitchen/test-kitchen), [kitchen-terraform](https://github.com/newcontext-oss/kitchen-terraform), and [InSpec](https://github.com/inspec/inspec).
214
+
215
+
Six test-kitchen instances are defined:
216
+
217
+
-`deploy_service`
218
+
-`node_pool`
219
+
-`shared_vpc`
220
+
-`simple_regional`
221
+
-`simple_zonal`
222
+
-`stub_domains`
223
+
224
+
The test-kitchen instances in `test/fixtures/` wrap identically-named examples in the `examples/` directory.
225
+
226
+
#### Setup
227
+
228
+
1. Configure the [test fixtures](#test-configuration)
229
+
2. Download a Service Account key with the necessary permissions and put it in the module's root directory with the name `credentials.json`.
230
+
3. Build the Docker containers for testing:
231
+
232
+
```
233
+
CREDENTIALS_FILE="credentials.json" make docker_build_terraform
234
+
CREDENTIALS_FILE="credentials.json" make docker_build_kitchen_terraform
235
+
```
236
+
4. Run the testing container in interactive mode:
237
+
238
+
```
239
+
make docker_run
240
+
```
241
+
242
+
The module root directory will be loaded into the Docker container at `/cftk/workdir/`.
243
+
5. Run kitchen-terraform to test the infrastructure:
244
+
245
+
1.`kitchen create` creates Terraform state and downloads modules, if applicable.
246
+
2.`kitchen converge` creates the underlying resources. Run `kitchen converge <INSTANCE_NAME>` to create resources for a specific test case.
247
+
3.`kitchen verify` tests the created infrastructure. Run `kitchen verify <INSTANCE_NAME>` to run a specific test case.
248
+
4.`kitchen destroy` tears down the underlying resources created by `kitchen converge`. Run `kitchen destroy <INSTANCE_NAME>` to tear down resources for a specific test case.
249
+
250
+
Alternatively, you can simply run `CREDENTIALS_FILE="credentials.json" make test_integration_docker` to run all the test steps non-interactively.
251
+
252
+
#### Test configuration
253
+
254
+
Each test-kitchen instance is configured with a `variables.tfvars` file in the test fixture directory, e.g. `test/fixtures/node_pool/terraform.tfvars`.
255
+
For convenience, since all of the variables are project-specific, these files have been symlinked to `test/fixtures/shared/terraform.tfvars`.
256
+
Similarly, each test fixture has a `variables.tf` to define these variables, and an `outputs.tf` to facilitate providing necessary information for `inspec` to locate and query against created resources.
257
+
258
+
Each test-kitchen instance creates a GCP Network and Subnetwork fixture to house resources, and may create any other necessary fixture data as needed.
259
+
260
+
### Autogeneration of documentation from .tf files
261
+
Run
262
+
```
263
+
make generate_docs
264
+
```
233
265
234
266
### Linting
235
267
The makefile in this project will lint or sometimes just format any shell,
0 commit comments