Skip to content

Commit

Permalink
Merge branch 'master' into add_check_for_beta_feature_fields
Browse files Browse the repository at this point in the history
  • Loading branch information
morgante committed Aug 28, 2019
2 parents 99d8e37 + dbda452 commit ff4ba33
Show file tree
Hide file tree
Showing 15 changed files with 97 additions and 17 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ Extending the adopted spec, each change should have a link to its corresponding
### Added

* Added support for resource usage export config [#238]
* Added `sandbox_enabled` variable to use GKE Sandbox [#241]
* Added `grant_registry_access` variable to grant Container Registry access to created SA [#236]
* Support for Intranode Visbiility (IV) and Veritical Pod Autoscaling (VPA) beta features [#216]
* Support for Workload Identity beta feature [#234]
* Support for Google Groups based RBAC beta feature [#217]
* Support for disabling node pool autoscaling by setting `autoscaling` to `false` within the node pool variable. [#250]

## [v4.1.0] 2019-07-24

Expand Down Expand Up @@ -172,6 +174,8 @@ Extending the adopted spec, each change should have a link to its corresponding
[v0.2.0]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v0.1.0...v0.2.0

[#238]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/238
[#241]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/241
[#250]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/250
[#236]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/236
[#217]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/217
[#234]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/234
Expand Down
19 changes: 16 additions & 3 deletions autogen/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,14 @@ resource "google_container_cluster" "primary" {
node_metadata = workload_metadata_config.value.node_metadata
}
}

dynamic "sandbox_config" {
for_each = local.cluster_sandbox_enabled

content {
sandbox_type = sandbox_config.value
}
}
{% endif %}
}
}
Expand Down Expand Up @@ -232,9 +240,14 @@ resource "google_container_node_pool" "pools" {
max_pods_per_node = lookup(var.node_pools[count.index], "max_pods_per_node", null)
{% endif %}

autoscaling {
min_node_count = lookup(var.node_pools[count.index], "min_count", 1)
max_node_count = lookup(var.node_pools[count.index], "max_count", 100)
node_count = lookup(var.node_pools[count.index], "autoscaling", true) ? null : lookup(var.node_pools[count.index], "min_count", 1)

dynamic "autoscaling" {
for_each = lookup(var.node_pools[count.index], "autoscaling", true) ? [var.node_pools[count.index]] : []
content {
min_node_count = lookup(autoscaling.value, "min_count", 1)
max_node_count = lookup(autoscaling.value, "max_count", 100)
}
}

management {
Expand Down
2 changes: 2 additions & 0 deletions autogen/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ locals {
security_group = var.authenticator_security_group
}]

cluster_sandbox_enabled = var.sandbox_enabled ? ["gvisor"] : []

{% endif %}

cluster_output_name = google_container_cluster.primary.name
Expand Down
8 changes: 7 additions & 1 deletion autogen/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -377,13 +377,19 @@ variable "node_metadata" {
default = "UNSPECIFIED"
}

variable "sandbox_enabled" {
type = bool
description = "(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)."
default = false
}

variable "enable_intranode_visibility" {
type = bool
description = "Whether Intra-node visibility is enabled for this cluster. This makes same node pod to pod traffic visible for VPC network"
default = false
}

variable "enable_vertical_pod_autoscaling" {
variable "enable_vertical_pod_autoscaling" {
type = bool
description = "Vertical Pod Autoscaling automatically adjusts the resources of pods controlled by it"
default = false
Expand Down
11 changes: 8 additions & 3 deletions cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,14 @@ resource "google_container_node_pool" "pools" {
lookup(var.node_pools[count.index], "min_count", 1),
)

autoscaling {
min_node_count = lookup(var.node_pools[count.index], "min_count", 1)
max_node_count = lookup(var.node_pools[count.index], "max_count", 100)
node_count = lookup(var.node_pools[count.index], "autoscaling", true) ? null : lookup(var.node_pools[count.index], "min_count", 1)

dynamic "autoscaling" {
for_each = lookup(var.node_pools[count.index], "autoscaling", true) ? [var.node_pools[count.index]] : []
content {
min_node_count = lookup(autoscaling.value, "min_count", 1)
max_node_count = lookup(autoscaling.value, "max_count", 100)
}
}

management {
Expand Down
1 change: 1 addition & 0 deletions modules/beta-private-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
| regional | Whether is a regional cluster (zonal cluster if set false. WARNING: changing this after cluster creation is destructive!) | bool | `"true"` | no |
| remove\_default\_node\_pool | Remove default node pool while setting up the cluster | bool | `"false"` | no |
| resource\_usage\_export\_dataset\_id | The dataset id for which network egress metering for this cluster will be enabled. If enabled, a daemonset will be created in the cluster to meter network egress traffic. | string | `""` | no |
| 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 |
| 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 |
| 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 |
| subnetwork | The subnetwork to host the cluster in (required) | string | n/a | yes |
Expand Down
19 changes: 16 additions & 3 deletions modules/beta-private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,14 @@ resource "google_container_cluster" "primary" {
node_metadata = workload_metadata_config.value.node_metadata
}
}

dynamic "sandbox_config" {
for_each = local.cluster_sandbox_enabled

content {
sandbox_type = sandbox_config.value
}
}
}
}

Expand Down Expand Up @@ -216,9 +224,14 @@ resource "google_container_node_pool" "pools" {
)
max_pods_per_node = lookup(var.node_pools[count.index], "max_pods_per_node", null)

autoscaling {
min_node_count = lookup(var.node_pools[count.index], "min_count", 1)
max_node_count = lookup(var.node_pools[count.index], "max_count", 100)
node_count = lookup(var.node_pools[count.index], "autoscaling", true) ? null : lookup(var.node_pools[count.index], "min_count", 1)

dynamic "autoscaling" {
for_each = lookup(var.node_pools[count.index], "autoscaling", true) ? [var.node_pools[count.index]] : []
content {
min_node_count = lookup(autoscaling.value, "min_count", 1)
max_node_count = lookup(autoscaling.value, "max_count", 100)
}
}

management {
Expand Down
2 changes: 2 additions & 0 deletions modules/beta-private-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ locals {
security_group = var.authenticator_security_group
}]

cluster_sandbox_enabled = var.sandbox_enabled ? ["gvisor"] : []


cluster_output_name = google_container_cluster.primary.name
cluster_output_location = google_container_cluster.primary.location
Expand Down
6 changes: 6 additions & 0 deletions modules/beta-private-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,12 @@ variable "node_metadata" {
default = "UNSPECIFIED"
}

variable "sandbox_enabled" {
type = bool
description = "(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)."
default = false
}

variable "enable_intranode_visibility" {
type = bool
description = "Whether Intra-node visibility is enabled for this cluster. This makes same node pod to pod traffic visible for VPC network"
Expand Down
1 change: 1 addition & 0 deletions modules/beta-public-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
| regional | Whether is a regional cluster (zonal cluster if set false. WARNING: changing this after cluster creation is destructive!) | bool | `"true"` | no |
| remove\_default\_node\_pool | Remove default node pool while setting up the cluster | bool | `"false"` | no |
| resource\_usage\_export\_dataset\_id | The dataset id for which network egress metering for this cluster will be enabled. If enabled, a daemonset will be created in the cluster to meter network egress traffic. | string | `""` | no |
| 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 |
| 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 |
| 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 |
| subnetwork | The subnetwork to host the cluster in (required) | string | n/a | yes |
Expand Down
19 changes: 16 additions & 3 deletions modules/beta-public-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,14 @@ resource "google_container_cluster" "primary" {
node_metadata = workload_metadata_config.value.node_metadata
}
}

dynamic "sandbox_config" {
for_each = local.cluster_sandbox_enabled

content {
sandbox_type = sandbox_config.value
}
}
}
}

Expand Down Expand Up @@ -211,9 +219,14 @@ resource "google_container_node_pool" "pools" {
)
max_pods_per_node = lookup(var.node_pools[count.index], "max_pods_per_node", null)

autoscaling {
min_node_count = lookup(var.node_pools[count.index], "min_count", 1)
max_node_count = lookup(var.node_pools[count.index], "max_count", 100)
node_count = lookup(var.node_pools[count.index], "autoscaling", true) ? null : lookup(var.node_pools[count.index], "min_count", 1)

dynamic "autoscaling" {
for_each = lookup(var.node_pools[count.index], "autoscaling", true) ? [var.node_pools[count.index]] : []
content {
min_node_count = lookup(autoscaling.value, "min_count", 1)
max_node_count = lookup(autoscaling.value, "max_count", 100)
}
}

management {
Expand Down
2 changes: 2 additions & 0 deletions modules/beta-public-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ locals {
security_group = var.authenticator_security_group
}]

cluster_sandbox_enabled = var.sandbox_enabled ? ["gvisor"] : []


cluster_output_name = google_container_cluster.primary.name
cluster_output_location = google_container_cluster.primary.location
Expand Down
6 changes: 6 additions & 0 deletions modules/beta-public-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,12 @@ variable "node_metadata" {
default = "UNSPECIFIED"
}

variable "sandbox_enabled" {
type = bool
description = "(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)."
default = false
}

variable "enable_intranode_visibility" {
type = bool
description = "Whether Intra-node visibility is enabled for this cluster. This makes same node pod to pod traffic visible for VPC network"
Expand Down
11 changes: 8 additions & 3 deletions modules/private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,14 @@ resource "google_container_node_pool" "pools" {
lookup(var.node_pools[count.index], "min_count", 1),
)

autoscaling {
min_node_count = lookup(var.node_pools[count.index], "min_count", 1)
max_node_count = lookup(var.node_pools[count.index], "max_count", 100)
node_count = lookup(var.node_pools[count.index], "autoscaling", true) ? null : lookup(var.node_pools[count.index], "min_count", 1)

dynamic "autoscaling" {
for_each = lookup(var.node_pools[count.index], "autoscaling", true) ? [var.node_pools[count.index]] : []
content {
min_node_count = lookup(autoscaling.value, "min_count", 1)
max_node_count = lookup(autoscaling.value, "max_count", 100)
}
}

management {
Expand Down
3 changes: 2 additions & 1 deletion test/make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ finish() {
trap finish EXIT
# Create a temporary file in the auto-cleaned up directory while avoiding
# overwriting TMPDIR for other processes.
# shellcheck disable=SC2120 # (Arguments may be passed, e.g. maketemp -d)
# shellcheck disable=SC2120
# (Arguments may be passed, e.g. maketemp -d)
maketemp() {
TMPDIR="${DELETE_AT_EXIT}" mktemp "$@"
}
Expand Down

0 comments on commit ff4ba33

Please sign in to comment.