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

+1
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

+2-10
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

+3-6
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

+1
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

-1
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

-1
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

+2
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

-2
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

-12
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

-12
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

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

-2
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ Then perform the following commands on the root folder:
8787
| enable\_confidential\_nodes | An optional flag to enable confidential node config. | `bool` | `false` | no |
8888
| 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 |
8989
| enable\_fqdn\_network\_policy | Enable FQDN Network Policies on the cluster | `bool` | `null` | no |
90-
| enable\_gcfs | Enable image streaming on cluster level. | `bool` | `true` | no |
9190
| enable\_l4\_ilb\_subsetting | Enable L4 ILB Subsetting on the cluster | `bool` | `false` | no |
9291
| 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 |
9392
| 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 |
@@ -114,7 +113,6 @@ Then perform the following commands on the root folder:
114113
| 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 |
115114
| 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 |
116115
| 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 |
117-
| 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 |
118116
| maintenance\_end\_time | Time window specified for recurring maintenance operations in RFC3339 format | `string` | `""` | no |
119117
| 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 |
120118
| maintenance\_recurrence | Frequency of the recurring maintenance window in RFC5545 format. | `string` | `""` | no |

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

-12
Original file line numberDiff line numberDiff line change
@@ -345,17 +345,5 @@ resource "google_container_cluster" "primary" {
345345
}
346346
}
347347

348-
node_pool_defaults {
349-
node_config_defaults {
350-
logging_variant = var.logging_variant
351-
dynamic "gcfs_config" {
352-
for_each = var.enable_gcfs != null ? [true] : []
353-
content {
354-
enabled = var.enable_gcfs
355-
}
356-
}
357-
}
358-
}
359-
360348
depends_on = [google_project_iam_member.service_agent]
361349
}

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

-12
Original file line numberDiff line numberDiff line change
@@ -358,12 +358,6 @@ variable "enable_confidential_nodes" {
358358
default = false
359359
}
360360

361-
variable "enable_gcfs" {
362-
type = bool
363-
description = "Enable image streaming on cluster level."
364-
default = true
365-
}
366-
367361
variable "enable_secret_manager_addon" {
368362
description = "Enable the Secret Manager add-on for this cluster"
369363
type = bool
@@ -568,12 +562,6 @@ variable "fleet_project_grant_service_agent" {
568562
default = false
569563
}
570564

571-
variable "logging_variant" {
572-
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."
573-
type = string
574-
default = null
575-
}
576-
577565
variable "monitoring_metric_writer_role" {
578566
description = "The monitoring metrics writer role to assign to the GKE node service account"
579567
type = string

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

+1
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ Then perform the following commands on the root folder:
244244
| 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 |
245245
| 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 |
246246
| 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 |
247+
| 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 |
247248
| maintenance\_end\_time | Time window specified for recurring maintenance operations in RFC3339 format | `string` | `""` | no |
248249
| 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 |
249250
| maintenance\_recurrence | Frequency of the recurring maintenance window in RFC5545 format. | `string` | `""` | no |

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

+1
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,7 @@ resource "google_container_cluster" "primary" {
612612

613613
node_pool_defaults {
614614
node_config_defaults {
615+
logging_variant = var.logging_variant
615616
gcfs_config {
616617
enabled = var.enable_gcfs
617618
}

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

+6
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,12 @@ variable "fleet_project_grant_service_agent" {
969969
default = false
970970
}
971971

972+
variable "logging_variant" {
973+
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."
974+
type = string
975+
default = null
976+
}
977+
972978
variable "monitoring_metric_writer_role" {
973979
description = "The monitoring metrics writer role to assign to the GKE node service account"
974980
type = string

modules/beta-private-cluster/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ Then perform the following commands on the root folder:
222222
| 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 |
223223
| 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 |
224224
| 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 |
225+
| 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 |
225226
| maintenance\_end\_time | Time window specified for recurring maintenance operations in RFC3339 format | `string` | `""` | no |
226227
| 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 |
227228
| maintenance\_recurrence | Frequency of the recurring maintenance window in RFC5545 format. | `string` | `""` | no |

modules/beta-private-cluster/cluster.tf

+1
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,7 @@ resource "google_container_cluster" "primary" {
612612

613613
node_pool_defaults {
614614
node_config_defaults {
615+
logging_variant = var.logging_variant
615616
gcfs_config {
616617
enabled = var.enable_gcfs
617618
}

modules/beta-private-cluster/variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,12 @@ variable "fleet_project_grant_service_agent" {
969969
default = false
970970
}
971971

972+
variable "logging_variant" {
973+
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."
974+
type = string
975+
default = null
976+
}
977+
972978
variable "monitoring_metric_writer_role" {
973979
description = "The monitoring metrics writer role to assign to the GKE node service account"
974980
type = string

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

+1
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ Then perform the following commands on the root folder:
236236
| 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 |
237237
| 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 |
238238
| 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 |
239+
| 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 |
239240
| maintenance\_end\_time | Time window specified for recurring maintenance operations in RFC3339 format | `string` | `""` | no |
240241
| 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 |
241242
| maintenance\_recurrence | Frequency of the recurring maintenance window in RFC5545 format. | `string` | `""` | no |

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

+1
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,7 @@ resource "google_container_cluster" "primary" {
582582

583583
node_pool_defaults {
584584
node_config_defaults {
585+
logging_variant = var.logging_variant
585586
gcfs_config {
586587
enabled = var.enable_gcfs
587588
}

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

+6
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,12 @@ variable "fleet_project_grant_service_agent" {
933933
default = false
934934
}
935935

936+
variable "logging_variant" {
937+
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."
938+
type = string
939+
default = null
940+
}
941+
936942
variable "monitoring_metric_writer_role" {
937943
description = "The monitoring metrics writer role to assign to the GKE node service account"
938944
type = string

modules/beta-public-cluster/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ Then perform the following commands on the root folder:
214214
| 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 |
215215
| 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 |
216216
| 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 |
217+
| 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 |
217218
| maintenance\_end\_time | Time window specified for recurring maintenance operations in RFC3339 format | `string` | `""` | no |
218219
| 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 |
219220
| maintenance\_recurrence | Frequency of the recurring maintenance window in RFC5545 format. | `string` | `""` | no |

0 commit comments

Comments
 (0)