Skip to content

Commit

Permalink
Merge branch 'master' into loggingvariant
Browse files Browse the repository at this point in the history
  • Loading branch information
ericyz authored Sep 11, 2023
2 parents d655b1a + 91467fa commit b823eb5
Show file tree
Hide file tree
Showing 62 changed files with 303 additions and 10 deletions.
8 changes: 4 additions & 4 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
":rebaseStalePrs"
],
"minimumReleaseAge": "7 days",
"ignorePaths": [],
"ignorePaths": [".github/workflows/lint.yaml", ".github/workflows/stale.yml"],
"labels": ["dependencies"],
"vulnerabilityAlerts": {
"labels": ["type:security"],
Expand All @@ -17,11 +17,11 @@
"packageRules": [
{
"matchFileNames": ["examples/**", "test/**", ".github/**"],
"extends": [":semanticCommitTypeAll(chore)"]
"commitMessagePrefix": "chore(deps):"
},
{
"matchFileNames": ["*", "modules/**"],
"extends": [":semanticCommitTypeAll(fix)"]
"commitMessagePrefix": "fix(deps):"
},
{
"matchFileNames": ["*", "modules/**"],
Expand All @@ -41,7 +41,7 @@
"postUpdateOptions": ["gomodTidy"]
},
{
"matchPackageNames": ["google", "google-beta"],
"matchDepNames": ["google", "google-beta"],
"groupName": "Terraform Google Provider"
}
],
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
name: 'lint'
runs-on: 'ubuntu-latest'
steps:
- uses: 'actions/checkout@v3'
- uses: 'actions/checkout@v4'
- id: variables
run: |
MAKEFILE=$(find . -name Makefile -print -quit)
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ Then perform the following commands on the root folder:
| enable\_binary\_authorization | Enable BinAuthZ Admission controller | `bool` | `false` | no |
| enable\_cost\_allocation | Enables Cost Allocation Feature and the cluster name and namespace of your GKE workloads appear in the labels field of the billing export to BigQuery | `bool` | `false` | no |
| enable\_kubernetes\_alpha | Whether to enable Kubernetes Alpha features for this cluster. Note that when this option is enabled, the cluster cannot be upgraded and will be automatically deleted after 30 days. | `bool` | `false` | no |
| enable\_mesh\_certificates | Controls the issuance of workload mTLS certificates. When enabled the GKE Workload Identity Certificates controller and node agent will be deployed in the cluster. Requires Workload Identity. | `bool` | `false` | no |
| enable\_network\_egress\_export | Whether to enable network egress metering for this cluster. If enabled, a daemonset will be created in the cluster to meter network egress traffic. | `bool` | `false` | no |
| enable\_resource\_consumption\_export | Whether to enable resource consumption metering on this cluster. When enabled, a table will be created in the resource export BigQuery dataset to store resource consumption data. The resulting table can be joined with the resource usage table or with BigQuery billing export. | `bool` | `true` | no |
| enable\_shielded\_nodes | Enable Shielded Nodes features on all nodes in this cluster | `bool` | `true` | no |
Expand Down Expand Up @@ -238,6 +239,7 @@ Then perform the following commands on the root folder:
| logging\_service | Logging service used |
| master\_authorized\_networks\_config | Networks from which access to master is permitted |
| master\_version | Current master kubernetes version |
| mesh\_certificates\_config | Mesh certificates configuration |
| min\_master\_version | Minimum master kubernetes version |
| monitoring\_service | Monitoring service used |
| name | Cluster name |
Expand Down
10 changes: 10 additions & 0 deletions autogen/main/cluster.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,16 @@ resource "google_container_cluster" "primary" {
}
{% endif %}

{% if autopilot_cluster != true %}
dynamic "mesh_certificates" {
for_each = local.cluster_mesh_certificates_config

content {
enable_certificates = mesh_certificates.value.enable_certificates
}
}
{% endif %}

dynamic "authenticator_groups_config" {
for_each = local.cluster_authenticator_security_group
content {
Expand Down
6 changes: 6 additions & 0 deletions autogen/main/main.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ locals {
cluster_workload_identity_config = ! local.workload_identity_enabled ? [] : var.identity_namespace == "enabled" ? [{
workload_pool = "${var.project_id}.svc.id.goog" }] : [{ workload_pool = var.identity_namespace
}]
{% if autopilot_cluster != true %}
cluster_mesh_certificates_config = local.workload_identity_enabled ? [{
enable_certificates = var.enable_mesh_certificates
}] : []
{% endif %}

{% if beta_cluster %}
# BETA features
cluster_istio_enabled = ! local.cluster_output_istio_disabled
Expand Down
11 changes: 11 additions & 0 deletions autogen/main/outputs.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,17 @@ output "identity_namespace" {
google_container_cluster.primary
]
}

{% if autopilot_cluster != true %}
output "mesh_certificates_config" {
description = "Mesh certificates configuration"
value = local.cluster_mesh_certificates_config
depends_on = [
google_container_cluster.primary
]
}
{% endif %}

{% if private_cluster %}

output "master_ipv4_cidr_block" {
Expand Down
9 changes: 8 additions & 1 deletion autogen/main/variables.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,14 @@ variable "identity_namespace" {
default = "enabled"
}

{% if autopilot_cluster != true %}
variable "enable_mesh_certificates" {
type = bool
default = false
description = "Controls the issuance of workload mTLS certificates. When enabled the GKE Workload Identity Certificates controller and node agent will be deployed in the cluster. Requires Workload Identity."
}
{% endif %}

variable "release_channel" {
type = string
description = "The release channel of this cluster. Accepted values are `UNSPECIFIED`, `RAPID`, `REGULAR` and `STABLE`. Defaults to `REGULAR`."
Expand Down Expand Up @@ -763,7 +771,6 @@ variable "enable_pod_security_policy" {
default = false
}


variable "enable_l4_ilb_subsetting" {
type = bool
description = "Enable L4 ILB Subsetting on the cluster"
Expand Down
3 changes: 3 additions & 0 deletions autogen/safer-cluster/main.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ module "gke" {
// We enable Workload Identity by default.
identity_namespace = "${var.project_id}.svc.id.goog"

// Enabling mesh certificates requires Workload Identity
enable_mesh_certificates = var.enable_mesh_certificates

authenticator_security_group = var.authenticator_security_group

enable_shielded_nodes = var.enable_shielded_nodes
Expand Down
5 changes: 5 additions & 0 deletions autogen/safer-cluster/outputs.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,8 @@ output "peering_name" {
description = "The name of the peering between this cluster and the Google owned VPC."
value = module.gke.peering_name
}

output "enable_mesh_certificates" {
description = "Mesh certificate configuration value"
value = var.enable_mesh_certificates
}
6 changes: 6 additions & 0 deletions autogen/safer-cluster/variables.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -484,3 +484,9 @@ variable "timeouts" {
error_message = "Only create, update, delete timeouts can be specified."
}
}

variable "enable_mesh_certificates" {
type = bool
default = false
description = "Controls the issuance of workload mTLS certificates. When enabled the GKE Workload Identity Certificates controller and node agent will be deployed in the cluster. Requires Workload Identity."
}
8 changes: 8 additions & 0 deletions cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,14 @@ resource "google_container_cluster" "primary" {
}
}

dynamic "mesh_certificates" {
for_each = local.cluster_mesh_certificates_config

content {
enable_certificates = mesh_certificates.value.enable_certificates
}
}

dynamic "authenticator_groups_config" {
for_each = local.cluster_authenticator_security_group
content {
Expand Down
4 changes: 4 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ locals {
cluster_workload_identity_config = !local.workload_identity_enabled ? [] : var.identity_namespace == "enabled" ? [{
workload_pool = "${var.project_id}.svc.id.goog" }] : [{ workload_pool = var.identity_namespace
}]
cluster_mesh_certificates_config = local.workload_identity_enabled ? [{
enable_certificates = var.enable_mesh_certificates
}] : []


cluster_maintenance_window_is_recurring = var.maintenance_recurrence != "" && var.maintenance_end_time != "" ? [1] : []
cluster_maintenance_window_is_daily = length(local.cluster_maintenance_window_is_recurring) > 0 ? [] : [1]
Expand Down
1 change: 1 addition & 0 deletions modules/beta-autopilot-private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ resource "google_container_cluster" "primary" {
}



dynamic "authenticator_groups_config" {
for_each = local.cluster_authenticator_security_group
content {
Expand Down
1 change: 1 addition & 0 deletions modules/beta-autopilot-private-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ locals {
cluster_workload_identity_config = !local.workload_identity_enabled ? [] : var.identity_namespace == "enabled" ? [{
workload_pool = "${var.project_id}.svc.id.goog" }] : [{ workload_pool = var.identity_namespace
}]

# BETA features
cluster_istio_enabled = !local.cluster_output_istio_disabled
cluster_dns_cache_enabled = var.dns_cache
Expand Down
2 changes: 2 additions & 0 deletions modules/beta-autopilot-private-cluster/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ output "identity_namespace" {
]
}



output "master_ipv4_cidr_block" {
description = "The IP range in CIDR notation used for the hosted master network"
value = var.master_ipv4_cidr_block
Expand Down
1 change: 1 addition & 0 deletions modules/beta-autopilot-private-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ variable "identity_namespace" {
default = "enabled"
}


variable "release_channel" {
type = string
description = "The release channel of this cluster. Accepted values are `UNSPECIFIED`, `RAPID`, `REGULAR` and `STABLE`. Defaults to `REGULAR`."
Expand Down
1 change: 1 addition & 0 deletions modules/beta-autopilot-public-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ resource "google_container_cluster" "primary" {
}



dynamic "authenticator_groups_config" {
for_each = local.cluster_authenticator_security_group
content {
Expand Down
1 change: 1 addition & 0 deletions modules/beta-autopilot-public-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ locals {
cluster_workload_identity_config = !local.workload_identity_enabled ? [] : var.identity_namespace == "enabled" ? [{
workload_pool = "${var.project_id}.svc.id.goog" }] : [{ workload_pool = var.identity_namespace
}]

# BETA features
cluster_istio_enabled = !local.cluster_output_istio_disabled
cluster_dns_cache_enabled = var.dns_cache
Expand Down
2 changes: 2 additions & 0 deletions modules/beta-autopilot-public-cluster/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ output "identity_namespace" {
]
}



output "cloudrun_enabled" {
description = "Whether CloudRun enabled"
value = false
Expand Down
1 change: 1 addition & 0 deletions modules/beta-autopilot-public-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ variable "identity_namespace" {
default = "enabled"
}


variable "release_channel" {
type = string
description = "The release channel of this cluster. Accepted values are `UNSPECIFIED`, `RAPID`, `REGULAR` and `STABLE`. Defaults to `REGULAR`."
Expand Down
2 changes: 2 additions & 0 deletions modules/beta-private-cluster-update-variant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ Then perform the following commands on the root folder:
| 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 |
| enable\_kubernetes\_alpha | Whether to enable Kubernetes Alpha features for this cluster. Note that when this option is enabled, the cluster cannot be upgraded and will be automatically deleted after 30 days. | `bool` | `false` | no |
| enable\_l4\_ilb\_subsetting | Enable L4 ILB Subsetting on the cluster | `bool` | `false` | no |
| enable\_mesh\_certificates | Controls the issuance of workload mTLS certificates. When enabled the GKE Workload Identity Certificates controller and node agent will be deployed in the cluster. Requires Workload Identity. | `bool` | `false` | no |
| enable\_network\_egress\_export | Whether to enable network egress metering for this cluster. If enabled, a daemonset will be created in the cluster to meter network egress traffic. | `bool` | `false` | no |
| enable\_pod\_security\_policy | enabled - Enable the PodSecurityPolicy controller for this cluster. If enabled, pods must be valid under a PodSecurityPolicy to be created. Pod Security Policy was removed from GKE clusters with version >= 1.25.0. | `bool` | `false` | no |
| enable\_private\_endpoint | (Beta) Whether the master's internal IP address is used as the cluster endpoint | `bool` | `false` | no |
Expand Down Expand Up @@ -296,6 +297,7 @@ Then perform the following commands on the root folder:
| master\_authorized\_networks\_config | Networks from which access to master is permitted |
| master\_ipv4\_cidr\_block | The IP range in CIDR notation used for the hosted master network |
| master\_version | Current master kubernetes version |
| mesh\_certificates\_config | Mesh certificates configuration |
| min\_master\_version | Minimum master kubernetes version |
| monitoring\_service | Monitoring service used |
| name | Cluster name |
Expand Down
8 changes: 8 additions & 0 deletions modules/beta-private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,14 @@ resource "google_container_cluster" "primary" {
}
}

dynamic "mesh_certificates" {
for_each = local.cluster_mesh_certificates_config

content {
enable_certificates = mesh_certificates.value.enable_certificates
}
}

dynamic "authenticator_groups_config" {
for_each = local.cluster_authenticator_security_group
content {
Expand Down
4 changes: 4 additions & 0 deletions modules/beta-private-cluster-update-variant/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ locals {
cluster_workload_identity_config = !local.workload_identity_enabled ? [] : var.identity_namespace == "enabled" ? [{
workload_pool = "${var.project_id}.svc.id.goog" }] : [{ workload_pool = var.identity_namespace
}]
cluster_mesh_certificates_config = local.workload_identity_enabled ? [{
enable_certificates = var.enable_mesh_certificates
}] : []

# BETA features
cluster_istio_enabled = !local.cluster_output_istio_disabled
cluster_dns_cache_enabled = var.dns_cache
Expand Down
9 changes: 9 additions & 0 deletions modules/beta-private-cluster-update-variant/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,15 @@ output "identity_namespace" {
]
}

output "mesh_certificates_config" {
description = "Mesh certificates configuration"
value = local.cluster_mesh_certificates_config
depends_on = [
google_container_cluster.primary
]
}


output "master_ipv4_cidr_block" {
description = "The IP range in CIDR notation used for the hosted master network"
value = var.master_ipv4_cidr_block
Expand Down
7 changes: 6 additions & 1 deletion modules/beta-private-cluster-update-variant/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,12 @@ variable "identity_namespace" {
default = "enabled"
}

variable "enable_mesh_certificates" {
type = bool
default = false
description = "Controls the issuance of workload mTLS certificates. When enabled the GKE Workload Identity Certificates controller and node agent will be deployed in the cluster. Requires Workload Identity."
}

variable "release_channel" {
type = string
description = "The release channel of this cluster. Accepted values are `UNSPECIFIED`, `RAPID`, `REGULAR` and `STABLE`. Defaults to `REGULAR`."
Expand Down Expand Up @@ -722,7 +728,6 @@ variable "enable_pod_security_policy" {
default = false
}


variable "enable_l4_ilb_subsetting" {
type = bool
description = "Enable L4 ILB Subsetting on the cluster"
Expand Down
2 changes: 2 additions & 0 deletions modules/beta-private-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ Then perform the following commands on the root folder:
| 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 |
| enable\_kubernetes\_alpha | Whether to enable Kubernetes Alpha features for this cluster. Note that when this option is enabled, the cluster cannot be upgraded and will be automatically deleted after 30 days. | `bool` | `false` | no |
| enable\_l4\_ilb\_subsetting | Enable L4 ILB Subsetting on the cluster | `bool` | `false` | no |
| enable\_mesh\_certificates | Controls the issuance of workload mTLS certificates. When enabled the GKE Workload Identity Certificates controller and node agent will be deployed in the cluster. Requires Workload Identity. | `bool` | `false` | no |
| enable\_network\_egress\_export | Whether to enable network egress metering for this cluster. If enabled, a daemonset will be created in the cluster to meter network egress traffic. | `bool` | `false` | no |
| enable\_pod\_security\_policy | enabled - Enable the PodSecurityPolicy controller for this cluster. If enabled, pods must be valid under a PodSecurityPolicy to be created. Pod Security Policy was removed from GKE clusters with version >= 1.25.0. | `bool` | `false` | no |
| enable\_private\_endpoint | (Beta) Whether the master's internal IP address is used as the cluster endpoint | `bool` | `false` | no |
Expand Down Expand Up @@ -274,6 +275,7 @@ Then perform the following commands on the root folder:
| master\_authorized\_networks\_config | Networks from which access to master is permitted |
| master\_ipv4\_cidr\_block | The IP range in CIDR notation used for the hosted master network |
| master\_version | Current master kubernetes version |
| mesh\_certificates\_config | Mesh certificates configuration |
| min\_master\_version | Minimum master kubernetes version |
| monitoring\_service | Monitoring service used |
| name | Cluster name |
Expand Down
8 changes: 8 additions & 0 deletions modules/beta-private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,14 @@ resource "google_container_cluster" "primary" {
}
}

dynamic "mesh_certificates" {
for_each = local.cluster_mesh_certificates_config

content {
enable_certificates = mesh_certificates.value.enable_certificates
}
}

dynamic "authenticator_groups_config" {
for_each = local.cluster_authenticator_security_group
content {
Expand Down
4 changes: 4 additions & 0 deletions modules/beta-private-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ locals {
cluster_workload_identity_config = !local.workload_identity_enabled ? [] : var.identity_namespace == "enabled" ? [{
workload_pool = "${var.project_id}.svc.id.goog" }] : [{ workload_pool = var.identity_namespace
}]
cluster_mesh_certificates_config = local.workload_identity_enabled ? [{
enable_certificates = var.enable_mesh_certificates
}] : []

# BETA features
cluster_istio_enabled = !local.cluster_output_istio_disabled
cluster_dns_cache_enabled = var.dns_cache
Expand Down
9 changes: 9 additions & 0 deletions modules/beta-private-cluster/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,15 @@ output "identity_namespace" {
]
}

output "mesh_certificates_config" {
description = "Mesh certificates configuration"
value = local.cluster_mesh_certificates_config
depends_on = [
google_container_cluster.primary
]
}


output "master_ipv4_cidr_block" {
description = "The IP range in CIDR notation used for the hosted master network"
value = var.master_ipv4_cidr_block
Expand Down
Loading

0 comments on commit b823eb5

Please sign in to comment.