Skip to content

Commit f4f0b46

Browse files
committed
Colors, symlink and rand suffix
* Replace outputs w/ symlink * disable color in tests * adding suffix
1 parent b1e9db0 commit f4f0b46

File tree

6 files changed

+39
-120
lines changed

6 files changed

+39
-120
lines changed

.kitchen.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,12 @@ suites:
4343
root_module_directory: test/fixtures/disable_client_cert
4444
verifier:
4545
name: terraform
46+
color: false
4647
systems:
4748
- name: disable_client_cert
4849
backend: local
4950
provisioner:
50-
name: terraform
51+
name: terraform
5152
- name: "node_pool"
5253
driver:
5354
name: "terraform"

README.md

Lines changed: 29 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,13 @@ Then perform the following commands on the root folder:
8484

8585
[^]: (autogen_docs_start)
8686

87+
8788
## Inputs
8889

8990
| Name | Description | Type | Default | Required |
9091
|------|-------------|:----:|:-----:|:-----:|
91-
| basic\_auth\_password | Kubernetes HTTP Basic auth password. Defaults to empty string. Only used if `enable_basic_auth` is true | string | `` | no |
92-
| basic\_auth\_username | Kubernetes HTTP Basic auth username. Defaults to empty string. Only used if `enable_basic_auth` is true | string | `` | no |
9392
| description | The description of the cluster | string | `` | no |
94-
<<<<<<< HEAD
95-
| horizontal_pod_autoscaling | Enable horizontal pod autoscaling addon | string | `false` | no |
93+
| horizontal_pod_autoscaling | Enable horizontal pod autoscaling addon | string | `true` | no |
9694
| http_load_balancing | Enable httpload balancer addon | string | `true` | no |
9795
| ip_masq_link_local | Whether to masquerade traffic to the link-local prefix (169.254.0.0/16). | string | `false` | no |
9896
| ip_masq_resync_interval | The interval at which the agent attempts to sync its ConfigMap file from the disk. | string | `60s` | no |
@@ -104,63 +102,44 @@ Then perform the following commands on the root folder:
104102
| maintenance_start_time | Time window specified for daily maintenance operations in RFC3339 format | string | `05:00` | no |
105103
| 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 |
106104
| monitoring_service | The monitoring service that the cluster should write metrics to. Automatically send metrics from pods in the cluster to the Google Cloud Monitoring API. VM metrics will be collected by Google Compute Engine regardless of this setting Available options include monitoring.googleapis.com, monitoring.googleapis.com/kubernetes (beta) and none | string | `monitoring.googleapis.com` | no |
107-
=======
108-
| enable\_basic\_auth | Basic authentication allows a user to authenticate to the cluster with a username and password. To maximize the security of your cluster, disable this option. Basic authentication is not recommended because it provides no confidentiality protection for transmitted credentials. Default: true | string | `true` | no |
109-
| horizontal\_pod\_autoscaling | Enable horizontal pod autoscaling addon | string | `false` | no |
110-
| http\_load\_balancing | Enable httpload balancer addon | string | `true` | no |
111-
| ip\_masq\_link\_local | Whether to masquerade traffic to the link-local prefix (169.254.0.0/16). | string | `false` | no |
112-
| ip\_masq\_resync\_interval | The interval at which the agent attempts to sync its ConfigMap file from the disk. | string | `60s` | no |
113-
| ip\_range\_pods | The secondary ip range to use for pods | string | - | yes |
114-
| ip\_range\_services | The secondary ip range to use for pods | string | - | yes |
115-
| issue\_client\_certificate | Issues a client certificate to authenticate to the cluster endpoint. To maximize the security of your cluster, leave this option disabled. Client certificates don't automatically rotate and aren't easily revocable. WARNING: changing this after cluster creation is destructive! Default: false | string | `false` | no |
116-
| kubernetes\_dashboard | Enable kubernetes dashboard addon | string | `false` | no |
117-
| 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 |
118-
| 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 |
119-
| maintenance\_start\_time | Time window specified for daily maintenance operations in RFC3339 format | string | `05:00` | no |
120-
| 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 |
121-
| monitoring\_service | The monitoring service that the cluster should write metrics to. Automatically send metrics from pods in the cluster to the Google Cloud Monitoring API. VM metrics will be collected by Google Compute Engine regardless of this setting Available options include monitoring.googleapis.com, monitoring.googleapis.com/kubernetes (beta) and none | string | `monitoring.googleapis.com` | no |
122-
>>>>>>> Adding variables to README
123105
| name | The name of the cluster (required) | string | - | yes |
124106
| network | The VPC network to host the cluster in (required) | string | - | yes |
125-
| network\_policy | Enable network policy addon | string | `false` | no |
126-
| network\_project\_id | The project ID of the shared VPC's host (for shared vpc support) | string | `` | no |
127-
| node\_pools | List of maps containing node pools | list | `<list>` | no |
128-
| node\_pools\_labels | Map of maps containing node labels by node-pool name | map | `<map>` | no |
129-
| node\_pools\_tags | Map of lists containing node network tags by node-pool name | map | `<map>` | no |
130-
| node\_pools\_taints | Map of lists containing node taints by node-pool name | map | `<map>` | no |
131-
| node\_version | The Kubernetes version of the node pools. Defaults kubernetes_version (master) variable and can be overridden for individual node pools by setting the `version` key on them. Must be empyty or set the same as master at cluster creation. | string | `` | no |
132-
| non\_masquerade\_cidrs | List of strings in CIDR notation that specify the IP address ranges that do not use IP masquerading. | list | `<list>` | no |
133-
| project\_id | The project ID to host the cluster in (required) | string | - | yes |
107+
| network_policy | Enable network policy addon | string | `false` | no |
108+
| network_project_id | The project ID of the shared VPC's host (for shared vpc support) | string | `` | no |
109+
| remove_default_node_pool | Boolean value determining removal of default node pool | bool | false | no |
110+
| node_pools | List of maps containing node pools | list | `<list>` | no |
111+
| node_pools_labels | Map of maps containing node labels by node-pool name | map | `<map>` | no |
112+
| node_pools_tags | Map of lists containing node network tags by node-pool name | map | `<map>` | no |
113+
| node_pools_taints | Map of lists containing node taints by node-pool name | map | `<map>` | no |
114+
| node_version | The Kubernetes version of the node pools. Defaults kubernetes_version (master) variable and can be overridden for individual node pools by setting the `version` key on them. Must be empyty or set the same as master at cluster creation. | string | `` | no |
115+
| non_masquerade_cidrs | List of strings in CIDR notation that specify the IP address ranges that do not use IP masquerading. | list | `<list>` | no |
116+
| project_id | The project ID to host the cluster in (required) | string | - | yes |
134117
| region | The region to host the cluster in (required) | string | - | yes |
135118
| regional | Whether is a regional cluster (zonal cluster if set false. WARNING: changing this after cluster creation is destructive!) | string | `true` | no |
136-
<<<<<<< HEAD
137119
| 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 |
138120
| 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 |
139-
=======
140-
| 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 |
141-
>>>>>>> Adding variables to README
142121
| subnetwork | The subnetwork to host the cluster in (required) | string | - | yes |
143122
| zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | list | `<list>` | no |
144123

145124
## Outputs
146125

147126
| Name | Description |
148127
|------|-------------|
149-
| ca\_certificate | Cluster ca certificate (base64 encoded) |
128+
| ca_certificate | Cluster ca certificate (base64 encoded) |
150129
| endpoint | Cluster endpoint |
151-
| horizontal\_pod\_autoscaling\_enabled | Whether horizontal pod autoscaling enabled |
152-
| http\_load\_balancing\_enabled | Whether http load balancing enabled |
153-
| kubernetes\_dashboard\_enabled | Whether kubernetes dashboard enabled |
130+
| horizontal_pod_autoscaling_enabled | Whether horizontal pod autoscaling enabled |
131+
| http_load_balancing_enabled | Whether http load balancing enabled |
132+
| kubernetes_dashboard_enabled | Whether kubernetes dashboard enabled |
154133
| location | Cluster location (region if regional cluster, zone if zonal cluster) |
155-
| logging\_service | Logging service used |
156-
| master\_authorized\_networks\_config | Networks from which access to master is permitted |
157-
| master\_version | Current master kubernetes version |
158-
| min\_master\_version | Minimum master kubernetes version |
159-
| monitoring\_service | Monitoring service used |
134+
| logging_service | Logging service used |
135+
| master_authorized_networks_config | Networks from which access to master is permitted |
136+
| master_version | Current master kubernetes version |
137+
| min_master_version | Minimum master kubernetes version |
138+
| monitoring_service | Monitoring service used |
160139
| name | Cluster name |
161-
| network\_policy\_enabled | Whether network policy enabled |
162-
| node\_pools\_names | List of node pools names |
163-
| node\_pools\_versions | List of node pools versions |
140+
| network_policy_enabled | Whether network policy enabled |
141+
| node_pools_names | List of node pools names |
142+
| node_pools_versions | List of node pools versions |
164143
| region | Cluster region |
165144
| type | Cluster type (regional / zonal) |
166145
| zones | List of zones in which the cluster resides |
@@ -234,10 +213,9 @@ make generate_docs
234213

235214
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).
236215

237-
Seven test-kitchen instances are defined:
216+
Six test-kitchen instances are defined:
238217

239218
- `deploy_service`
240-
- `disable_client_cert`
241219
- `node_pool`
242220
- `shared_vpc`
243221
- `simple_regional`
@@ -253,8 +231,8 @@ The test-kitchen instances in `test/fixtures/` wrap identically-named examples i
253231
3. Build the Docker containers for testing:
254232

255233
```
256-
CREDENTIALS_FILE="credentials.json" make docker_build_terraform
257-
CREDENTIALS_FILE="credentials.json" make docker_build_kitchen_terraform
234+
make docker_build_terraform
235+
make docker_build_kitchen_terraform
258236
```
259237
4. Run the testing container in interactive mode:
260238

@@ -270,7 +248,7 @@ The test-kitchen instances in `test/fixtures/` wrap identically-named examples i
270248
3. `kitchen verify` tests the created infrastructure. Run `kitchen verify <INSTANCE_NAME>` to run a specific test case.
271249
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.
272250

273-
Alternatively, you can simply run `CREDENTIALS_FILE="credentials.json" make test_integration_docker` to run all the test steps non-interactively.
251+
Alternatively, you can simply run `make test_integration_docker` to run all the test steps non-interactively.
274252

275253
#### Test configuration
276254

@@ -325,4 +303,4 @@ are as follows:
325303
is a compiled language so there is no standard linter.
326304
* Terraform - terraform has a built-in linter in the 'terraform validate'
327305
command.
328-
* Dockerfiles - hadolint. Can be found in homebrew
306+
* Dockerfiles - hadolint. Can be found in homebrew

examples/disable_client_cert/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ provider "google" {
2626
module "gke" {
2727
source = "../../"
2828
project_id = "${var.project_id}"
29-
name = "${local.cluster_type}-cluster"
29+
name = "${local.cluster_type}-cluster${var.cluster_name_suffix}"
3030
region = "${var.region}"
3131
network = "${var.network}"
3232
network_project_id = "${var.network_project_id}"

examples/disable_client_cert/test_outputs.tf

Lines changed: 0 additions & 67 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../test/fixtures/all_examples/test_outputs.tf

examples/disable_client_cert/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ variable "credentials_path" {
2222
description = "The path to the GCP credentials JSON file"
2323
}
2424

25+
variable "cluster_name_suffix" {
26+
description = "A suffix to append to the default cluster name"
27+
default = ""
28+
}
29+
2530
variable "region" {
2631
description = "The region to host the cluster in"
2732
}

test/fixtures/disable_client_cert/example.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ module "example" {
1919

2020
project_id = "${var.project_id}"
2121
credentials_path = "${local.credentials_path}"
22+
cluster_name_suffix = "-${random_string.suffix.result}"
2223
region = "${var.region}"
2324
network = "${google_compute_network.main.name}"
2425
network_project_id = "${var.project_id}"

0 commit comments

Comments
 (0)