Skip to content

Commit c1a720a

Browse files
authored
fix(autopilot): option to configure gcfs (#2052)
1 parent 8dfb209 commit c1a720a

File tree

8 files changed

+38
-12
lines changed

8 files changed

+38
-12
lines changed

autogen/main/cluster.tf.tmpl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -480,11 +480,6 @@ resource "google_container_cluster" "primary" {
480480
ignore_changes = [node_pool, initial_node_count, resource_labels["asmv"]]
481481
}
482482
{% endif %}
483-
{% if autopilot_cluster == true %}
484-
lifecycle {
485-
ignore_changes = [node_pool_defaults[0].node_config_defaults[0].gcfs_config[0]]
486-
}
487-
{% endif %}
488483

489484
{% if autopilot_cluster != true %}
490485
dynamic "dns_config" {
@@ -671,6 +666,12 @@ resource "google_container_cluster" "primary" {
671666
node_config_defaults {
672667
{% if autopilot_cluster %}
673668
logging_variant = var.logging_variant
669+
dynamic "gcfs_config" {
670+
for_each = var.enable_gcfs != null ? [true] : []
671+
content {
672+
enabled = var.enable_gcfs
673+
}
674+
}
674675
{% endif %}
675676
{% if autopilot_cluster != true %}
676677
gcfs_config {

autogen/main/variables.tf.tmpl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -941,13 +941,18 @@ variable "sandbox_enabled" {
941941
description = "(Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` to use it)."
942942
default = false
943943
}
944+
{% endif %}
944945

945946
variable "enable_gcfs" {
946947
type = bool
947948
description = "(Beta) Enable image streaming on cluster level."
949+
{% if autopilot_cluster != true %}
948950
default = false
949-
}
950951
{% endif %}
952+
{% if autopilot_cluster %}
953+
default = null
954+
{% endif %}
955+
}
951956
{% endif %}
952957

953958
{% if autopilot_cluster != true %}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ 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 | (Beta) Enable image streaming on cluster level. | `bool` | `null` | no |
9697
| enable\_l4\_ilb\_subsetting | Enable L4 ILB Subsetting on the cluster | `bool` | `false` | no |
9798
| 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 |
9899
| enable\_private\_endpoint | Whether the master's internal IP address is used as the cluster endpoint | `bool` | `false` | no |

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,6 @@ resource "google_container_cluster" "primary" {
261261
}
262262
}
263263

264-
lifecycle {
265-
ignore_changes = [node_pool_defaults[0].node_config_defaults[0].gcfs_config[0]]
266-
}
267264

268265
timeouts {
269266
create = lookup(var.timeouts, "create", "45m")
@@ -352,6 +349,12 @@ resource "google_container_cluster" "primary" {
352349
node_pool_defaults {
353350
node_config_defaults {
354351
logging_variant = var.logging_variant
352+
dynamic "gcfs_config" {
353+
for_each = var.enable_gcfs != null ? [true] : []
354+
content {
355+
enabled = var.enable_gcfs
356+
}
357+
}
355358
}
356359
}
357360

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,12 @@ variable "enable_l4_ilb_subsetting" {
524524
default = false
525525
}
526526

527+
variable "enable_gcfs" {
528+
type = bool
529+
description = "(Beta) Enable image streaming on cluster level."
530+
default = null
531+
}
532+
527533
variable "allow_net_admin" {
528534
description = "(Optional) Enable NET_ADMIN for the cluster."
529535
type = bool

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ Then perform the following commands on the root folder:
8686
| enable\_confidential\_nodes | An optional flag to enable confidential node config. | `bool` | `false` | no |
8787
| 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 |
8888
| enable\_fqdn\_network\_policy | Enable FQDN Network Policies on the cluster | `bool` | `null` | no |
89+
| enable\_gcfs | (Beta) Enable image streaming on cluster level. | `bool` | `null` | no |
8990
| enable\_l4\_ilb\_subsetting | Enable L4 ILB Subsetting on the cluster | `bool` | `false` | no |
9091
| 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 |
9192
| 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 |

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,6 @@ resource "google_container_cluster" "primary" {
261261
}
262262
}
263263

264-
lifecycle {
265-
ignore_changes = [node_pool_defaults[0].node_config_defaults[0].gcfs_config[0]]
266-
}
267264

268265
timeouts {
269266
create = lookup(var.timeouts, "create", "45m")
@@ -331,6 +328,12 @@ resource "google_container_cluster" "primary" {
331328
node_pool_defaults {
332329
node_config_defaults {
333330
logging_variant = var.logging_variant
331+
dynamic "gcfs_config" {
332+
for_each = var.enable_gcfs != null ? [true] : []
333+
content {
334+
enabled = var.enable_gcfs
335+
}
336+
}
334337
}
335338
}
336339

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,12 @@ variable "enable_l4_ilb_subsetting" {
488488
default = false
489489
}
490490

491+
variable "enable_gcfs" {
492+
type = bool
493+
description = "(Beta) Enable image streaming on cluster level."
494+
default = null
495+
}
496+
491497
variable "allow_net_admin" {
492498
description = "(Optional) Enable NET_ADMIN for the cluster."
493499
type = bool

0 commit comments

Comments
 (0)