Skip to content

Commit 6189fef

Browse files
authored
Merge pull request #69 from terraform-google-modules/feature/private-cluster-module
Add submodule and tests for private clusters
2 parents 7d7da1d + a466549 commit 6189fef

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

+3061
-94
lines changed

.kitchen.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,19 @@ suites:
7676
backend: local
7777
provisioner:
7878
name: terraform
79+
- name: "simple_regional_private"
80+
driver:
81+
name: "terraform"
82+
command_timeout: 1800
83+
root_module_directory: test/fixtures/simple_regional_private
84+
verifier:
85+
name: terraform
86+
color: false
87+
systems:
88+
- name: simple_regional_private
89+
backend: local
90+
provisioner:
91+
name: terraform
7992
- name: "simple_zonal"
8093
driver:
8194
name: "terraform"
@@ -89,6 +102,19 @@ suites:
89102
backend: local
90103
provisioner:
91104
name: terraform
105+
- name: "simple_zonal_private"
106+
driver:
107+
name: "terraform"
108+
command_timeout: 1800
109+
root_module_directory: test/fixtures/simple_zonal_private
110+
verifier:
111+
name: terraform
112+
color: false
113+
systems:
114+
- name: simple_zonal_private
115+
backend: local
116+
provisioner:
117+
name: terraform
92118
- name: "stub_domains"
93119
driver:
94120
name: "terraform"

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99
### Changed
10+
* Add support for private clusters via submodule. #69
1011
* Set `horizontal_pod_autoscaling` to `true` by default. #42
1112
* Add `remove_default_node_pool` set to `false` by default #15
1213
* Allow arbitrary key-value pairs to be set on node pool metadata. #52
13-
* Add `initial_node_count` parameter to node_pool block. #60
14+
* Add `initial_node_count` parameter to node_pool block. #60
1415

1516
## [v0.4.0] - 2018-12-19
1617
### Added

README.md

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Terraform Kubernetes Engine Module
22

33
This module handles opinionated Google Cloud Platform Kubernetes Engine cluster creation and configuration with Node Pools, IP MASQ, Network Policy, etc.
4-
54
The resources/services/activations/deletions that this module will create/trigger are:
65
- Create a GKE cluster with the provided addons
76
- Create GKE Node Pool(s) with provided configuration and attach to cluster
@@ -115,7 +114,6 @@ Then perform the following commands on the root folder:
115114
| network | The VPC network to host the cluster in (required) | string | - | yes |
116115
| network_policy | Enable network policy addon | string | `false` | no |
117116
| network_project_id | The project ID of the shared VPC's host (for shared vpc support) | string | `` | no |
118-
| remove_default_node_pool | Boolean value determining removal of default node pool | bool | false | no |
119117
| node_pools | List of maps containing node pools | list | `<list>` | no |
120118
| node_pools_labels | Map of maps containing node labels by node-pool name | map | `<map>` | no |
121119
| node_pools_metadata | Map of maps containing node metadata by node-pool name | map | `<map>` | no |
@@ -126,6 +124,7 @@ Then perform the following commands on the root folder:
126124
| project_id | The project ID to host the cluster in (required) | string | - | yes |
127125
| region | The region to host the cluster in (required) | string | - | yes |
128126
| regional | Whether is a regional cluster (zonal cluster if set false. WARNING: changing this after cluster creation is destructive!) | string | `true` | no |
127+
| remove_default_node_pool | Remove default node pool while setting up the cluster | string | `false` | no |
129128
| 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 |
130129
| 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 |
131130
| subnetwork | The subnetwork to host the cluster in (required) | string | - | yes |
@@ -168,11 +167,11 @@ Before this module can be used on a project, you must ensure that the following
168167
The [project factory](https://github.com/terraform-google-modules/terraform-google-project-factory) can be used to provision projects with the correct APIs active and the necessary Shared VPC connections.
169168

170169
### Software Dependencies
171-
### Kubectl
170+
#### Kubectl
172171
- [kubectl](https://github.com/kubernetes/kubernetes/releases) 1.9.x
173-
### Terraform plugins
174-
- [Terraform](https://www.terraform.io/downloads.html) 0.10.x
175-
- [terraform-provider-google](https://github.com/terraform-providers/terraform-provider-google) plugin v1.8.0
172+
#### Terraform and Plugins
173+
- [Terraform](https://www.terraform.io/downloads.html) 0.11.x
174+
- [terraform-provider-google](https://github.com/terraform-providers/terraform-provider-google) v1.8.0
176175

177176
### Configure a Service Account
178177
In order to execute this module you must have a Service Account with the
@@ -188,12 +187,6 @@ In order to operate with the Service Account you must activate the following API
188187
- Compute Engine API - compute.googleapis.com
189188
- Kubernetes Engine API - container.googleapis.com
190189

191-
## Install
192-
193-
### Terraform
194-
Be sure you have the correct Terraform version (0.10.x), you can choose the binary here:
195-
- https://releases.hashicorp.com/terraform/
196-
197190
## File structure
198191
The project has the following folders and files:
199192

@@ -209,9 +202,9 @@ The project has the following folders and files:
209202

210203
## Templating
211204

212-
To more cleanly handle cases where desired functionality would require complex duplication of Terraform resources (i.e. [PR 51](https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/51)), this repository is largely generated from the [`autogen`](./autogen) directory.
205+
To more cleanly handle cases where desired functionality would require complex duplication of Terraform resources (i.e. [PR 51](https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/51)), this repository is largely generated from the [`autogen`](/autogen) directory.
213206

214-
The root module is generated by running `make generate`. Changes to this repository should be made in the [`autogen`](./autogen) directory where appropriate.
207+
The root module is generated by running `make generate`. Changes to this repository should be made in the [`autogen`](/autogen) directory where appropriate.
215208

216209
## Testing
217210

@@ -270,7 +263,7 @@ Alternatively, you can simply run `make test_integration_docker` to run all the
270263
#### Test configuration
271264

272265
Each test-kitchen instance is configured with a `variables.tfvars` file in the test fixture directory, e.g. `test/fixtures/node_pool/terraform.tfvars`.
273-
For convenience, since all of the variables are project-specific, these files have been symlinked to `test/fixtures/shared/terraform.tfvars`.
266+
For convenience, since all of the variables are project-specific, these files have been symlinked to `test/fixtures/shared/terraform.tfvars`.
274267
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.
275268

276269
Each test-kitchen instance creates a GCP Network and Subnetwork fixture to house resources, and may create any other necessary fixture data as needed.

auth.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
/******************************************
2020
Retrieve authentication token
2121
*****************************************/
22-
data "google_client_config" "default" {}
22+
data "google_client_config" "default" {
23+
provider = "google"
24+
}
2325

2426
/******************************************
2527
Configure provider
@@ -29,4 +31,4 @@ provider "kubernetes" {
2931
host = "https://${local.cluster_endpoint}"
3032
token = "${data.google_client_config.default.access_token}"
3133
cluster_ca_certificate = "${base64decode(local.cluster_ca_certificate)}"
32-
}
34+
}

0 commit comments

Comments
 (0)