Skip to content

Commit aa32a5a

Browse files
Merge branch 'master' into fix/180
2 parents 49b5aa6 + e3494d7 commit aa32a5a

File tree

39 files changed

+123
-66
lines changed

39 files changed

+123
-66
lines changed

CHANGELOG.md

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

99
## [Unreleased]
1010

11+
### Added
12+
13+
* Support for Shielded Nodes beta feature via `enabled_shielded_nodes` variable. [#300]
14+
1115
## [v5.1.1] - 2019-10-25
1216

1317
### Fixed

autogen/cluster.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ resource "google_container_cluster" "primary" {
6565
enable_binary_authorization = var.enable_binary_authorization
6666
enable_intranode_visibility = var.enable_intranode_visibility
6767
default_max_pods_per_node = var.default_max_pods_per_node
68+
enable_shielded_nodes = var.enable_shielded_nodes
6869

6970
vertical_pod_autoscaling {
7071
enabled = var.enable_vertical_pod_autoscaling

autogen/outputs.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,4 +154,12 @@ output "release_channel" {
154154
description = "The release channel of this cluster"
155155
value = var.release_channel
156156
}
157+
158+
output "identity_namespace" {
159+
description = "Workload Identity namespace"
160+
value = var.identity_namespace
161+
depends_on = [
162+
"google_container_cluster.primary"
163+
]
164+
}
157165
{% endif %}

autogen/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,4 +427,10 @@ variable "release_channel" {
427427
description = "(Beta) The release channel of this cluster. Accepted values are `UNSPECIFIED`, `RAPID`, `REGULAR` and `STABLE`. Defaults to `UNSPECIFIED`."
428428
default = null
429429
}
430+
431+
variable "enable_shielded_nodes" {
432+
type = bool
433+
description = "Enable Shielded Nodes features on all nodes in this cluster"
434+
default = false
435+
}
430436
{% endif %}

autogen/versions.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,12 @@
1616

1717
terraform {
1818
required_version = ">= 0.12"
19+
20+
required_providers {
21+
{% if beta_cluster %}
22+
google-beta = "~> 2.18.0"
23+
{% else %}
24+
google = "~> 2.18.0"
25+
{% endif %}
26+
}
1927
}

build/int.cloudbuild.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ steps:
260260
waitFor:
261261
- verify beta-cluster-local
262262
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']
263+
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy beta-cluster-local']
264264
- id: create sandbox-enabled-local
265265
waitFor:
266266
- prepare

examples/deploy_service/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" {
22-
version = "~> 2.12.0"
22+
version = "~> 2.18.0"
2323
region = var.region
2424
}
2525

examples/disable_client_cert/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" {
22-
version = "~> 2.12.0"
22+
version = "~> 2.18.0"
2323
region = var.region
2424
}
2525

examples/node_pool_update_variant/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" {
22-
version = "~> 2.12.0"
22+
version = "~> 2.18.0"
2323
region = var.region
2424
}
2525

examples/shared_vpc/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" {
22-
version = "~> 2.12.0"
22+
version = "~> 2.18.0"
2323
region = var.region
2424
}
2525

examples/simple_regional/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" {
22-
version = "~> 2.12.0"
22+
version = "~> 2.18.0"
2323
region = var.region
2424
}
2525

examples/simple_regional_private/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" {
22-
version = "~> 2.12.0"
22+
version = "~> 2.18.0"
2323
region = var.region
2424
}
2525

examples/simple_zonal/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" {
22-
version = "~> 2.12.0"
22+
version = "~> 2.18.0"
2323
region = var.region
2424
}
2525

examples/simple_zonal_private/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" {
22-
version = "~> 2.12.0"
22+
version = "~> 2.18.0"
2323
region = var.region
2424
}
2525

examples/stub_domains/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" {
22-
version = "~> 2.12.0"
22+
version = "~> 2.18.0"
2323
region = var.region
2424
}
2525

examples/stub_domains_private/main.tf

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,10 @@
1515
*/
1616

1717
provider "google" {
18-
version = "~> 2.12.0"
18+
version = "~> 2.18.0"
1919
region = var.region
2020
}
2121

22-
provider "random" {
23-
version = "~> 2.1"
24-
}
25-
2622
data "google_compute_subnetwork" "subnetwork" {
2723
name = var.subnetwork
2824
project = var.project_id

examples/stub_domains_upstream_nameservers/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" {
22-
version = "~> 2.12.0"
22+
version = "~> 2.18.0"
2323
region = var.region
2424
}
2525

examples/upstream_nameservers/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" {
22-
version = "~> 2.12.0"
22+
version = "~> 2.18.0"
2323
region = var.region
2424
}
2525

modules/beta-private-cluster-update-variant/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
153153
| enable\_intranode\_visibility | Whether Intra-node visibility is enabled for this cluster. This makes same node pod to pod traffic visible for VPC network | bool | `"false"` | no |
154154
| enable\_private\_endpoint | (Beta) Whether the master's internal IP address is used as the cluster endpoint | bool | `"false"` | no |
155155
| enable\_private\_nodes | (Beta) Whether nodes have internal IP addresses only | bool | `"false"` | no |
156+
| enable\_shielded\_nodes | Enable Shielded Nodes features on all nodes in this cluster | bool | `"false"` | no |
156157
| enable\_vertical\_pod\_autoscaling | Vertical Pod Autoscaling automatically adjusts the resources of pods controlled by it | bool | `"false"` | no |
157158
| grant\_registry\_access | Grants created cluster-specific service account storage.objectViewer role. | bool | `"false"` | no |
158159
| horizontal\_pod\_autoscaling | Enable horizontal pod autoscaling addon | bool | `"true"` | no |
@@ -211,6 +212,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
211212
| endpoint | Cluster endpoint |
212213
| horizontal\_pod\_autoscaling\_enabled | Whether horizontal pod autoscaling enabled |
213214
| http\_load\_balancing\_enabled | Whether http load balancing enabled |
215+
| identity\_namespace | Workload Identity namespace |
214216
| intranode\_visibility\_enabled | Whether intra-node visibility is enabled |
215217
| istio\_enabled | Whether Istio is enabled |
216218
| kubernetes\_dashboard\_enabled | Whether kubernetes dashboard enabled |

modules/beta-private-cluster-update-variant/cluster.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ resource "google_container_cluster" "primary" {
5858
enable_binary_authorization = var.enable_binary_authorization
5959
enable_intranode_visibility = var.enable_intranode_visibility
6060
default_max_pods_per_node = var.default_max_pods_per_node
61+
enable_shielded_nodes = var.enable_shielded_nodes
6162

6263
vertical_pod_autoscaling {
6364
enabled = var.enable_vertical_pod_autoscaling

modules/beta-private-cluster-update-variant/outputs.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,11 @@ output "release_channel" {
153153
description = "The release channel of this cluster"
154154
value = var.release_channel
155155
}
156+
157+
output "identity_namespace" {
158+
description = "Workload Identity namespace"
159+
value = var.identity_namespace
160+
depends_on = [
161+
"google_container_cluster.primary"
162+
]
163+
}

modules/beta-private-cluster-update-variant/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,3 +422,9 @@ variable "release_channel" {
422422
description = "(Beta) The release channel of this cluster. Accepted values are `UNSPECIFIED`, `RAPID`, `REGULAR` and `STABLE`. Defaults to `UNSPECIFIED`."
423423
default = null
424424
}
425+
426+
variable "enable_shielded_nodes" {
427+
type = bool
428+
description = "Enable Shielded Nodes features on all nodes in this cluster"
429+
default = false
430+
}

modules/beta-private-cluster-update-variant/versions.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,8 @@
1616

1717
terraform {
1818
required_version = ">= 0.12"
19+
20+
required_providers {
21+
google-beta = "~> 2.18.0"
22+
}
1923
}

modules/beta-private-cluster/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
153153
| enable\_intranode\_visibility | Whether Intra-node visibility is enabled for this cluster. This makes same node pod to pod traffic visible for VPC network | bool | `"false"` | no |
154154
| enable\_private\_endpoint | (Beta) Whether the master's internal IP address is used as the cluster endpoint | bool | `"false"` | no |
155155
| enable\_private\_nodes | (Beta) Whether nodes have internal IP addresses only | bool | `"false"` | no |
156+
| enable\_shielded\_nodes | Enable Shielded Nodes features on all nodes in this cluster | bool | `"false"` | no |
156157
| enable\_vertical\_pod\_autoscaling | Vertical Pod Autoscaling automatically adjusts the resources of pods controlled by it | bool | `"false"` | no |
157158
| grant\_registry\_access | Grants created cluster-specific service account storage.objectViewer role. | bool | `"false"` | no |
158159
| horizontal\_pod\_autoscaling | Enable horizontal pod autoscaling addon | bool | `"true"` | no |
@@ -173,10 +174,9 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
173174
| master\_ipv4\_cidr\_block | (Beta) The IP range in CIDR notation to use for the hosted master network | string | `"10.0.0.0/28"` | no |
174175
| 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 |
175176
| name | The name of the cluster (required) | string | n/a | yes |
176-
| network | The VPC network to host the cluster in (required) | string | n/a | yes |
177+
| network | The VPC network link to host the cluster in (required) | string | n/a | yes |
177178
| network\_policy | Enable network policy addon | bool | `"false"` | no |
178179
| network\_policy\_provider | The network policy provider. | string | `"CALICO"` | no |
179-
| network\_project\_id | The project ID of the shared VPC's host (for shared vpc support) | string | `""` | no |
180180
| node\_metadata | Specifies how node metadata is exposed to the workload running on the node | string | `"SECURE"` | no |
181181
| node\_pools | List of maps containing node pools | list(map(string)) | `<list>` | no |
182182
| node\_pools\_labels | Map of maps containing node labels by node-pool name | map(map(string)) | `<map>` | no |
@@ -198,7 +198,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
198198
| 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 |
199199
| skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | bool | `"false"` | no |
200200
| 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 |
201-
| subnetwork | The subnetwork to host the cluster in (required) | string | n/a | yes |
201+
| subnetwork | The subnetwork link to host the cluster in (required) | string | n/a | yes |
202202
| upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | list | `<list>` | no |
203203
| zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | list(string) | `<list>` | no |
204204

@@ -211,6 +211,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
211211
| endpoint | Cluster endpoint |
212212
| horizontal\_pod\_autoscaling\_enabled | Whether horizontal pod autoscaling enabled |
213213
| http\_load\_balancing\_enabled | Whether http load balancing enabled |
214+
| identity\_namespace | Workload Identity namespace |
214215
| intranode\_visibility\_enabled | Whether intra-node visibility is enabled |
215216
| istio\_enabled | Whether Istio is enabled |
216217
| kubernetes\_dashboard\_enabled | Whether kubernetes dashboard enabled |

modules/beta-private-cluster/cluster.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ resource "google_container_cluster" "primary" {
3030
location = local.location
3131
node_locations = local.node_locations
3232
cluster_ipv4_cidr = var.cluster_ipv4_cidr
33-
network = data.google_compute_network.gke_network.self_link
33+
network = var.network
3434

3535
dynamic "network_policy" {
3636
for_each = local.cluster_network_policy
@@ -49,7 +49,7 @@ resource "google_container_cluster" "primary" {
4949
}
5050
}
5151

52-
subnetwork = data.google_compute_subnetwork.gke_subnetwork.self_link
52+
subnetwork = var.subnetwork
5353
min_master_version = local.master_version
5454

5555
logging_service = var.logging_service
@@ -58,6 +58,7 @@ resource "google_container_cluster" "primary" {
5858
enable_binary_authorization = var.enable_binary_authorization
5959
enable_intranode_visibility = var.enable_intranode_visibility
6060
default_max_pods_per_node = var.default_max_pods_per_node
61+
enable_shielded_nodes = var.enable_shielded_nodes
6162

6263
vertical_pod_autoscaling {
6364
enabled = var.enable_vertical_pod_autoscaling

modules/beta-private-cluster/main.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ locals {
4949

5050
custom_kube_dns_config = length(keys(var.stub_domains)) > 0
5151
upstream_nameservers_config = length(var.upstream_nameservers) > 0
52-
network_project_id = var.network_project_id != "" ? var.network_project_id : var.project_id
5352
zone_count = length(var.zones)
5453
cluster_type = var.regional ? "regional" : "zonal"
5554
// auto upgrade by defaults only for regional cluster as long it has multiple masters versus zonal clusters have only have a single master so upgrades are more dangerous.

modules/beta-private-cluster/networks.tf

Lines changed: 0 additions & 32 deletions
This file was deleted.

modules/beta-private-cluster/outputs.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,11 @@ output "release_channel" {
153153
description = "The release channel of this cluster"
154154
value = var.release_channel
155155
}
156+
157+
output "identity_namespace" {
158+
description = "Workload Identity namespace"
159+
value = var.identity_namespace
160+
depends_on = [
161+
"google_container_cluster.primary"
162+
]
163+
}

modules/beta-private-cluster/variables.tf

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,12 @@ variable "zones" {
5252

5353
variable "network" {
5454
type = string
55-
description = "The VPC network to host the cluster in (required)"
56-
}
57-
58-
variable "network_project_id" {
59-
type = string
60-
description = "The project ID of the shared VPC's host (for shared vpc support)"
61-
default = ""
55+
description = "The VPC network link to host the cluster in (required)"
6256
}
6357

6458
variable "subnetwork" {
6559
type = string
66-
description = "The subnetwork to host the cluster in (required)"
60+
description = "The subnetwork link to host the cluster in (required)"
6761
}
6862

6963
variable "kubernetes_version" {
@@ -422,3 +416,9 @@ variable "release_channel" {
422416
description = "(Beta) The release channel of this cluster. Accepted values are `UNSPECIFIED`, `RAPID`, `REGULAR` and `STABLE`. Defaults to `UNSPECIFIED`."
423417
default = null
424418
}
419+
420+
variable "enable_shielded_nodes" {
421+
type = bool
422+
description = "Enable Shielded Nodes features on all nodes in this cluster"
423+
default = false
424+
}

modules/beta-private-cluster/versions.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,8 @@
1616

1717
terraform {
1818
required_version = ">= 0.12"
19+
20+
required_providers {
21+
google-beta = "~> 2.18.0"
22+
}
1923
}

0 commit comments

Comments
 (0)