Skip to content

Commit 4df226d

Browse files
authored
fix!: re-align node_config_defaults to cluster types (#2256)
1 parent 4726ab2 commit 4df226d

File tree

39 files changed

+65
-77
lines changed

39 files changed

+65
-77
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ Then perform the following commands on the root folder:
203203
| 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 |
204204
| logging\_enabled\_components | List of services to monitor: SYSTEM\_COMPONENTS, APISERVER, CONTROLLER\_MANAGER, KCP\_CONNECTION, KCP\_SSHD, SCHEDULER, and WORKLOADS. Empty list is default GKE configuration. | `list(string)` | `[]` | no |
205205
| 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 |
206+
| logging\_variant | (Optional) The type of logging agent that is deployed by default for newly created node pools in the cluster. Valid values include DEFAULT and MAX\_THROUGHPUT. | `string` | `null` | no |
206207
| maintenance\_end\_time | Time window specified for recurring maintenance operations in RFC3339 format | `string` | `""` | no |
207208
| maintenance\_exclusions | List of maintenance exclusions. A cluster can have up to three | `list(object({ name = string, start_time = string, end_time = string, exclusion_scope = string }))` | `[]` | no |
208209
| maintenance\_recurrence | Frequency of the recurring maintenance window in RFC5545 format. | `string` | `""` | no |

autogen/main/cluster.tf.tmpl

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -706,26 +706,18 @@ resource "google_container_cluster" "primary" {
706706
}
707707
}
708708

709+
{% if autopilot_cluster != true %}
709710
node_pool_defaults {
710711
node_config_defaults {
711-
{% if autopilot_cluster %}
712712
logging_variant = var.logging_variant
713-
dynamic "gcfs_config" {
714-
for_each = var.enable_gcfs != null ? [true] : []
715-
content {
716-
enabled = var.enable_gcfs
717-
}
718-
}
719-
{% endif %}
720-
{% if autopilot_cluster != true %}
721713
gcfs_config {
722714
enabled = var.enable_gcfs
723715
}
724716
insecure_kubelet_readonly_port_enabled = var.insecure_kubelet_readonly_port_enabled != null ? upper(tostring(var.insecure_kubelet_readonly_port_enabled)) : null
725-
{% endif %}
726717
}
727718
}
728719

720+
{% endif %}
729721
{% if beta_cluster %}
730722
depends_on = [google_project_iam_member.service_agent]
731723
{% endif %}

autogen/main/variables.tf.tmpl

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -607,17 +607,14 @@ variable "enable_confidential_nodes" {
607607
description = "An optional flag to enable confidential node config."
608608
default = false
609609
}
610+
{% if autopilot_cluster != true %}
610611

611612
variable "enable_gcfs" {
612613
type = bool
613614
description = "Enable image streaming on cluster level."
614-
{% if autopilot_cluster != true %}
615615
default = false
616-
{% endif %}
617-
{% if autopilot_cluster %}
618-
default = true
619-
{% endif %}
620616
}
617+
{% endif %}
621618

622619
variable "enable_secret_manager_addon" {
623620
description = "Enable the Secret Manager add-on for this cluster"
@@ -1022,7 +1019,7 @@ variable "fleet_project_grant_service_agent" {
10221019
default = false
10231020
}
10241021
{% endif %}
1025-
{% if beta_cluster and autopilot_cluster %}
1022+
{% if autopilot_cluster != true %}
10261023

10271024
variable "logging_variant" {
10281025
description = "(Optional) The type of logging agent that is deployed by default for newly created node pools in the cluster. Valid values include DEFAULT and MAX_THROUGHPUT."

cluster.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,7 @@ resource "google_container_cluster" "primary" {
537537

538538
node_pool_defaults {
539539
node_config_defaults {
540+
logging_variant = var.logging_variant
540541
gcfs_config {
541542
enabled = var.enable_gcfs
542543
}

examples/island_cluster_anywhere_in_gcp_design/main.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ module "gke" {
6565
disk_size_gb = 100
6666
disk_type = "pd-standard"
6767
image_type = "COS_CONTAINERD"
68-
logging_variant = "DEFAULT"
6968
auto_repair = true
7069
auto_upgrade = true
7170
service_account = google_service_account.gke-sa[each.key].email

examples/island_cluster_with_vm_router/main.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ module "gke" {
181181
disk_size_gb = 100
182182
disk_type = "pd-standard"
183183
image_type = "COS_CONTAINERD"
184-
logging_variant = "DEFAULT"
185184
auto_repair = true
186185
auto_upgrade = true
187186
service_account = google_service_account.gke-sa.email

examples/node_pool/main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ module "gke" {
4444
cluster_autoscaling = var.cluster_autoscaling
4545
deletion_protection = false
4646
service_account = "default"
47+
logging_variant = "MAX_THROUGHPUT"
4748

4849
node_pools = [
4950
{
@@ -53,6 +54,7 @@ module "gke" {
5354
service_account = var.compute_engine_service_account
5455
auto_upgrade = true
5556
enable_gcfs = false
57+
logging_variant = "DEFAULT"
5658
},
5759
{
5860
name = "pool-02"

modules/beta-autopilot-private-cluster/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ Then perform the following commands on the root folder:
9393
| enable\_confidential\_nodes | An optional flag to enable confidential node config. | `bool` | `false` | no |
9494
| 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 |
9595
| enable\_fqdn\_network\_policy | Enable FQDN Network Policies on the cluster | `bool` | `null` | no |
96-
| enable\_gcfs | Enable image streaming on cluster level. | `bool` | `true` | no |
9796
| enable\_l4\_ilb\_subsetting | Enable L4 ILB Subsetting on the cluster | `bool` | `false` | no |
9897
| 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 |
9998
| enable\_private\_endpoint | Whether the master's internal IP address is used as the cluster endpoint | `bool` | `false` | no |
@@ -122,7 +121,6 @@ Then perform the following commands on the root folder:
122121
| 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 |
123122
| 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 |
124123
| logging\_enabled\_components | List of services to monitor: SYSTEM\_COMPONENTS, APISERVER, CONTROLLER\_MANAGER, KCP\_CONNECTION, KCP\_SSHD, SCHEDULER, and WORKLOADS. Empty list is default GKE configuration. | `list(string)` | `[]` | no |
125-
| logging\_variant | (Optional) The type of logging agent that is deployed by default for newly created node pools in the cluster. Valid values include DEFAULT and MAX\_THROUGHPUT. | `string` | `null` | no |
126124
| maintenance\_end\_time | Time window specified for recurring maintenance operations in RFC3339 format | `string` | `""` | no |
127125
| maintenance\_exclusions | List of maintenance exclusions. A cluster can have up to three | `list(object({ name = string, start_time = string, end_time = string, exclusion_scope = string }))` | `[]` | no |
128126
| maintenance\_recurrence | Frequency of the recurring maintenance window in RFC5545 format. | `string` | `""` | no |

modules/beta-autopilot-private-cluster/cluster.tf

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -375,17 +375,5 @@ resource "google_container_cluster" "primary" {
375375
}
376376
}
377377

378-
node_pool_defaults {
379-
node_config_defaults {
380-
logging_variant = var.logging_variant
381-
dynamic "gcfs_config" {
382-
for_each = var.enable_gcfs != null ? [true] : []
383-
content {
384-
enabled = var.enable_gcfs
385-
}
386-
}
387-
}
388-
}
389-
390378
depends_on = [google_project_iam_member.service_agent]
391379
}

modules/beta-autopilot-private-cluster/variables.tf

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -394,12 +394,6 @@ variable "enable_confidential_nodes" {
394394
default = false
395395
}
396396

397-
variable "enable_gcfs" {
398-
type = bool
399-
description = "Enable image streaming on cluster level."
400-
default = true
401-
}
402-
403397
variable "enable_secret_manager_addon" {
404398
description = "Enable the Secret Manager add-on for this cluster"
405399
type = bool
@@ -604,12 +598,6 @@ variable "fleet_project_grant_service_agent" {
604598
default = false
605599
}
606600

607-
variable "logging_variant" {
608-
description = "(Optional) The type of logging agent that is deployed by default for newly created node pools in the cluster. Valid values include DEFAULT and MAX_THROUGHPUT."
609-
type = string
610-
default = null
611-
}
612-
613601
variable "monitoring_metric_writer_role" {
614602
description = "The monitoring metrics writer role to assign to the GKE node service account"
615603
type = string

0 commit comments

Comments
 (0)