Skip to content

Commit

Permalink
fix(autopilot): option to configure gcfs (#2052)
Browse files Browse the repository at this point in the history
  • Loading branch information
apeabody authored Aug 22, 2024
1 parent 8dfb209 commit c1a720a
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 12 deletions.
11 changes: 6 additions & 5 deletions autogen/main/cluster.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -480,11 +480,6 @@ resource "google_container_cluster" "primary" {
ignore_changes = [node_pool, initial_node_count, resource_labels["asmv"]]
}
{% endif %}
{% if autopilot_cluster == true %}
lifecycle {
ignore_changes = [node_pool_defaults[0].node_config_defaults[0].gcfs_config[0]]
}
{% endif %}

{% if autopilot_cluster != true %}
dynamic "dns_config" {
Expand Down Expand Up @@ -671,6 +666,12 @@ resource "google_container_cluster" "primary" {
node_config_defaults {
{% if autopilot_cluster %}
logging_variant = var.logging_variant
dynamic "gcfs_config" {
for_each = var.enable_gcfs != null ? [true] : []
content {
enabled = var.enable_gcfs
}
}
{% endif %}
{% if autopilot_cluster != true %}
gcfs_config {
Expand Down
7 changes: 6 additions & 1 deletion autogen/main/variables.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -941,13 +941,18 @@ variable "sandbox_enabled" {
description = "(Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` to use it)."
default = false
}
{% endif %}

variable "enable_gcfs" {
type = bool
description = "(Beta) Enable image streaming on cluster level."
{% if autopilot_cluster != true %}
default = false
}
{% endif %}
{% if autopilot_cluster %}
default = null
{% endif %}
}
{% endif %}

{% if autopilot_cluster != true %}
Expand Down
1 change: 1 addition & 0 deletions modules/beta-autopilot-private-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ Then perform the following commands on the root folder:
| enable\_confidential\_nodes | An optional flag to enable confidential node config. | `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\_fqdn\_network\_policy | Enable FQDN Network Policies on the cluster | `bool` | `null` | no |
| enable\_gcfs | (Beta) Enable image streaming on cluster level. | `bool` | `null` | no |
| enable\_l4\_ilb\_subsetting | Enable L4 ILB Subsetting on the cluster | `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\_private\_endpoint | Whether the master's internal IP address is used as the cluster endpoint | `bool` | `false` | no |
Expand Down
9 changes: 6 additions & 3 deletions modules/beta-autopilot-private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,6 @@ resource "google_container_cluster" "primary" {
}
}

lifecycle {
ignore_changes = [node_pool_defaults[0].node_config_defaults[0].gcfs_config[0]]
}

timeouts {
create = lookup(var.timeouts, "create", "45m")
Expand Down Expand Up @@ -352,6 +349,12 @@ resource "google_container_cluster" "primary" {
node_pool_defaults {
node_config_defaults {
logging_variant = var.logging_variant
dynamic "gcfs_config" {
for_each = var.enable_gcfs != null ? [true] : []
content {
enabled = var.enable_gcfs
}
}
}
}

Expand Down
6 changes: 6 additions & 0 deletions modules/beta-autopilot-private-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,12 @@ variable "enable_l4_ilb_subsetting" {
default = false
}

variable "enable_gcfs" {
type = bool
description = "(Beta) Enable image streaming on cluster level."
default = null
}

variable "allow_net_admin" {
description = "(Optional) Enable NET_ADMIN for the cluster."
type = bool
Expand Down
1 change: 1 addition & 0 deletions modules/beta-autopilot-public-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ Then perform the following commands on the root folder:
| enable\_confidential\_nodes | An optional flag to enable confidential node config. | `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\_fqdn\_network\_policy | Enable FQDN Network Policies on the cluster | `bool` | `null` | no |
| enable\_gcfs | (Beta) Enable image streaming on cluster level. | `bool` | `null` | no |
| enable\_l4\_ilb\_subsetting | Enable L4 ILB Subsetting on the cluster | `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 |
Expand Down
9 changes: 6 additions & 3 deletions modules/beta-autopilot-public-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,6 @@ resource "google_container_cluster" "primary" {
}
}

lifecycle {
ignore_changes = [node_pool_defaults[0].node_config_defaults[0].gcfs_config[0]]
}

timeouts {
create = lookup(var.timeouts, "create", "45m")
Expand Down Expand Up @@ -331,6 +328,12 @@ resource "google_container_cluster" "primary" {
node_pool_defaults {
node_config_defaults {
logging_variant = var.logging_variant
dynamic "gcfs_config" {
for_each = var.enable_gcfs != null ? [true] : []
content {
enabled = var.enable_gcfs
}
}
}
}

Expand Down
6 changes: 6 additions & 0 deletions modules/beta-autopilot-public-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,12 @@ variable "enable_l4_ilb_subsetting" {
default = false
}

variable "enable_gcfs" {
type = bool
description = "(Beta) Enable image streaming on cluster level."
default = null
}

variable "allow_net_admin" {
description = "(Optional) Enable NET_ADMIN for the cluster."
type = bool
Expand Down

0 comments on commit c1a720a

Please sign in to comment.