Skip to content

Commit

Permalink
Merge branch 'master' into feature/shadow-firewall
Browse files Browse the repository at this point in the history
  • Loading branch information
morgante committed Feb 5, 2021
2 parents 8f0a90d + bf4d0da commit 844287a
Show file tree
Hide file tree
Showing 143 changed files with 1,852 additions and 773 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "Close stale issues"
on:
schedule:
- cron: "0 23 * * *"

jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days'
stale-pr-message: 'This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days'
exempt-issue-labels: triaged
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,42 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

Extending the adopted spec, each change should have a link to its corresponding pull request appended.

## [13.0.0](https://www.github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v12.3.0...v13.0.0) (2021-01-29)


### ⚠ BREAKING CHANGES

* Minimum Terraform core version increased to 0.13.
* dynamic operator yaml (#693)
* Using in-cluster features now requires additional provider configuration. See the upgrade guide for details.

### Features

* Add maintenance exclusions support ([#781](https://www.github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/781)) ([0abbf41](https://www.github.com/terraform-google-modules/terraform-google-kubernetes-engine/commit/0abbf416d393dcae29661ded789a642bb5a9c3f8))
* Add nodepool taints to keepers for update-variant ([#717](https://www.github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/717)) ([372a11c](https://www.github.com/terraform-google-modules/terraform-google-kubernetes-engine/commit/372a11c781479e0387231acfda4a724cdd46cc65))
* add support for Linux node config ([#782](https://www.github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/782)) ([98826e6](https://www.github.com/terraform-google-modules/terraform-google-kubernetes-engine/commit/98826e6029d5510d38121f446c2056ef44ece385))
* Add Terraform 0.13 constraint and module attribution ([#792](https://www.github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/792)) ([32db990](https://www.github.com/terraform-google-modules/terraform-google-kubernetes-engine/commit/32db990ce7072c310e2b2c954a1f8a06d5de4349))
* Add the option to disable Kubernetes SA annotation in workload-identity. ([#787](https://www.github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/787)) ([4e4ce02](https://www.github.com/terraform-google-modules/terraform-google-kubernetes-engine/commit/4e4ce0287b6169a4554daa93138191844a100496))
* dynamic operator yaml ([#693](https://www.github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/693)) ([b1cce30](https://www.github.com/terraform-google-modules/terraform-google-kubernetes-engine/commit/b1cce3091214389813fd40885f41590f7177edc6))
* Hub registration using kubeconfig and labels support ([#785](https://www.github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/785)) ([6a29e62](https://www.github.com/terraform-google-modules/terraform-google-kubernetes-engine/commit/6a29e6246de05cc01d518eecc15c9e1c21cb8ba9))
* remove wait for cluster script ([#801](https://www.github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/801)) ([356ed6d](https://www.github.com/terraform-google-modules/terraform-google-kubernetes-engine/commit/356ed6d9b31648518c450bc5ed3f542f0a043a26))
* Set auto-provisioned node pools to use configured service account ([#639](https://www.github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/639)) ([4a61f76](https://www.github.com/terraform-google-modules/terraform-google-kubernetes-engine/commit/4a61f7627946489b9ff7e6c0ae978c38c95c5adf))
* Support for ACM for non GKE clusters ([#786](https://www.github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/786)) ([aa551d5](https://www.github.com/terraform-google-modules/terraform-google-kubernetes-engine/commit/aa551d5b1fdc7bfa0d88bf4562ef5fbfe9da6122))


### Bug Fixes

* Move provider version constraint to required_providers block ([#774](https://www.github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/774)) ([825f287](https://www.github.com/terraform-google-modules/terraform-google-kubernetes-engine/commit/825f287351b1b7a8c832150072371452ff498bd2))
* Remove provider config from module to be TF 0.13 compatible ([#777](https://www.github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/777)) ([81b0a94](https://www.github.com/terraform-google-modules/terraform-google-kubernetes-engine/commit/81b0a9491d51546eedc6c1aabd368dc085c16b5e))

## [12.3.0](https://www.github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v12.2.0...v12.3.0) (2020-12-09)


### Features

* Add instance_group_urls output ([#618](https://www.github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/618)) ([5623d51](https://www.github.com/terraform-google-modules/terraform-google-kubernetes-engine/commit/5623d51885b5d3ed44b29264ae86b5d537feb506))
* Enable vertical autoscaling in GA modules ([#758](https://www.github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/758)) ([2e4f36a](https://www.github.com/terraform-google-modules/terraform-google-kubernetes-engine/commit/2e4f36aef7da1840303ff0a445acc6b560aa8a7c))

## [12.2.0](https://www.github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v12.1.0...v12.2.0) (2020-12-04)


Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# Make will use bash instead of sh
SHELL := /usr/bin/env bash

DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 0.12.2
DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 0.13
DOCKER_IMAGE_DEVELOPER_TOOLS := cft/developer-tools
REGISTRY_URL := gcr.io/cloud-foundation-cicd

Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ intended for Terraform 0.11.x is [3.0.0].
There are multiple examples included in the [examples](https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/tree/master/examples) folder but simple usage is as follows:

```hcl
# google_client_config and kubernetes provider must be explicitly specified like the following.
data "google_client_config" "default" {}
provider "kubernetes" {
load_config_file = false
host = "https://${module.gke.endpoint}"
token = data.google_client_config.default.access_token
cluster_ca_certificate = base64decode(module.gke.ca_certificate)
}
module "gke" {
source = "terraform-google-modules/kubernetes-engine/google"
project_id = "<PROJECT ID>"
Expand Down Expand Up @@ -147,6 +157,7 @@ Then perform the following commands on the root folder:
| 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! | `bool` | `false` | no |
| 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 |
| 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/kubernetes"` | no |
| maintenance\_exclusions | List of maintenance exclusions. A cluster can have up to three | `list(object({ name = string, start_time = string, end_time = string }))` | `[]` | no |
| maintenance\_start\_time | Time window specified for daily or recurring maintenance operations in RFC3339 format | `string` | `"05:00"` | no |
| master\_authorized\_networks | List of master authorized networks. If none are provided, disallow external access (except the cluster node IPs, which GKE automatically whitelists). | `list(object({ cidr_block = string, display_name = string }))` | `[]` | no |
| 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/kubernetes"` | no |
Expand Down
11 changes: 0 additions & 11 deletions auth.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,3 @@
data "google_client_config" "default" {
provider = google
}

/******************************************
Configure provider
*****************************************/
provider "kubernetes" {
version = "~> 1.10, != 1.11.0"
load_config_file = false
host = "https://${local.cluster_endpoint}"
token = data.google_client_config.default.access_token
cluster_ca_certificate = base64decode(local.cluster_ca_certificate)
}
10 changes: 10 additions & 0 deletions autogen/main/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ intended for Terraform 0.11.x is [3.0.0].
There are multiple examples included in the [examples](https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/tree/master/examples) folder but simple usage is as follows:

```hcl
# google_client_config and kubernetes provider must be explicitly specified like the following.
data "google_client_config" "default" {}
provider "kubernetes" {
load_config_file = false
host = "https://${module.gke.endpoint}"
token = data.google_client_config.default.access_token
cluster_ca_certificate = base64decode(module.gke.ca_certificate)
}
module "gke" {
source = "terraform-google-modules/kubernetes-engine/google{{ module_path }}"
project_id = "<PROJECT ID>"
Expand Down
11 changes: 0 additions & 11 deletions autogen/main/auth.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,3 @@ data "google_client_config" "default" {
provider = google
{% endif %}
}

/******************************************
Configure provider
*****************************************/
provider "kubernetes" {
version = "~> 1.10, != 1.11.0"
load_config_file = false
host = "https://${local.cluster_endpoint}"
token = data.google_client_config.default.access_token
cluster_ca_certificate = base64decode(local.cluster_ca_certificate)
}
64 changes: 46 additions & 18 deletions autogen/main/cluster.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,16 @@ resource "google_container_cluster" "primary" {
{% endif %}

cluster_autoscaling {
enabled = var.cluster_autoscaling.enabled
enabled = var.cluster_autoscaling.enabled
{% if beta_cluster %}
dynamic "auto_provisioning_defaults" {
for_each = var.cluster_autoscaling.enabled ? [1] : []

content {
service_account = local.service_account
oauth_scopes = local.node_pools_oauth_scopes["all"]
}
}
autoscaling_profile = var.cluster_autoscaling.autoscaling_profile != null ? var.cluster_autoscaling.autoscaling_profile : "BALANCED"
{% endif %}
dynamic "resource_limits" {
Expand All @@ -90,7 +98,7 @@ resource "google_container_cluster" "primary" {
}
}
}

vertical_pod_autoscaling {
enabled = var.enable_vertical_pod_autoscaling
}
Expand Down Expand Up @@ -206,6 +214,16 @@ resource "google_container_cluster" "primary" {
start_time = var.maintenance_start_time
}
}

dynamic "maintenance_exclusion" {
for_each = var.maintenance_exclusions
content {
exclusion_name = maintenance_exclusion.value.name
start_time = maintenance_exclusion.value.start_time
end_time = maintenance_exclusion.value.end_time
}
}

{% else %}
daily_maintenance_window {
start_time = var.maintenance_start_time
Expand Down Expand Up @@ -357,6 +375,18 @@ resource "random_id" "name" {
)
)
},
{
taints = join(",",
sort(
flatten(
concat(
[for all_taints in local.node_pools_taints["all"] : "all/${all_taints.key}/${all_taints.value}/${all_taints.effect}"],
[for each_pool_taint in local.node_pools_taints[each.value["name"]] : "${each.value["name"]}/${each_pool_taint.key}/${each_pool_taint.value}/${each_pool_taint.effect}"],
)
)
)
)
},
{
metadata = join(",",
sort(
Expand Down Expand Up @@ -535,6 +565,20 @@ resource "google_container_node_pool" "pools" {
cpu_manager_policy = lookup(each.value, "cpu_manager_policy")
}
}

dynamic "linux_node_config" {
for_each = length(merge(
local.node_pools_linux_node_configs_sysctls["all"],
local.node_pools_linux_node_configs_sysctls[each.value["name"]]
)) != 0 ? [1] : []

content {
sysctls = merge(
local.node_pools_linux_node_configs_sysctls["all"],
local.node_pools_linux_node_configs_sysctls[each.value["name"]]
)
}
}
{% endif %}

shielded_instance_config {
Expand All @@ -558,19 +602,3 @@ resource "google_container_node_pool" "pools" {
}
}

module "gcloud_wait_for_cluster" {
source = "terraform-google-modules/gcloud/google"
version = "~> 2.0.2"
enabled = ! var.skip_provisioners
upgrade = var.gcloud_upgrade

create_cmd_entrypoint = "${path.module}/scripts/wait-for-cluster.sh"
create_cmd_body = "${var.project_id} ${var.name} ${local.location} ${var.impersonate_service_account}"
destroy_cmd_entrypoint = "${path.module}/scripts/wait-for-cluster.sh"
destroy_cmd_body = "${var.project_id} ${var.name} ${local.location} ${var.impersonate_service_account}"

module_depends_on = concat(
[google_container_cluster.primary.master_version],
[for pool in google_container_node_pool.pools : pool.name]
)
}
1 change: 0 additions & 1 deletion autogen/main/outputs.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ output "endpoint" {
*/
google_container_cluster.primary,
google_container_node_pool.pools,
module.gcloud_wait_for_cluster.wait,
]
}

Expand Down
2 changes: 1 addition & 1 deletion autogen/main/sa.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ locals {
["dummy"],
),
)
// if user set var.service_accont it will be used even if var.create_service_account==true, so service account will be created but not used
// if user set var.service_account it will be used even if var.create_service_account==true, so service account will be created but not used
service_account = (var.service_account == "" || var.service_account == "create") && var.create_service_account ? local.service_account_list[0] : var.service_account
}

Expand Down
44 changes: 0 additions & 44 deletions autogen/main/scripts/wait-for-cluster.sh

This file was deleted.

19 changes: 19 additions & 0 deletions autogen/main/variables.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ variable "maintenance_start_time" {
default = "05:00"
}

variable "maintenance_exclusions" {
type = list(object({ name = string, start_time = string, end_time = string }))
description = "List of maintenance exclusions. A cluster can have up to three"
default = []
}

{% if beta_cluster %}
variable "maintenance_end_time" {
type = string
Expand Down Expand Up @@ -188,6 +194,19 @@ variable "node_pools_metadata" {
default-node-pool = {}
}
}
{% if beta_cluster %}

variable "node_pools_linux_node_configs_sysctls" {
type = map(map(string))
description = "Map of maps containing linux node config sysctls by node-pool name"

# Default is being set in variables_defaults.tf
default = {
all = {}
default-node-pool = {}
}
}
{% endif %}

variable "resource_usage_export_dataset_id" {
type = string
Expand Down
12 changes: 12 additions & 0 deletions autogen/main/variables_defaults.tf
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,16 @@ locals {
),
var.node_pools_oauth_scopes
)
{% if beta_cluster %}

node_pools_linux_node_configs_sysctls = merge(
{ all = {} },
{ default-node-pool = {} },
zipmap(
[for node_pool in var.node_pools : node_pool["name"]],
[for node_pool in var.node_pools : {}]
),
var.node_pools_linux_node_configs_sysctls
)
{% endif %}
}
Loading

0 comments on commit 844287a

Please sign in to comment.