Closed davidholsgrove closed 1 month ago
Seems like #1817 added this support in a narrower way for autopilot. High level, I think this plus an example based on your snippet could work, and I can open a draft PR, but may take a bit to get the tests working, and I'm not super familiar personally with the use case.
Guessing the fix is something like this?
diff --git a/autogen/main/cluster.tf.tmpl b/autogen/main/cluster.tf.tmpl
index 80200fe7..4223db7d 100644
--- a/autogen/main/cluster.tf.tmpl
+++ b/autogen/main/cluster.tf.tmpl
@@ -281,10 +281,10 @@ resource "google_container_cluster" "primary" {
{% if autopilot_cluster != true %}
dynamic "node_pool_auto_config" {
- for_each = var.cluster_autoscaling.enabled && length(var.network_tags) > 0 ? [1] : []
+ for_each = var.cluster_autoscaling.enabled && (length(var.network_tags) > 0 || var.add_cluster_firewall_rules) ? [1] : []
content {
network_tags {
- tags = var.network_tags
+ tags = var.add_cluster_firewall_rules ? (concat(var.network_tags, [local.cluster_network_tag])) : var.network_tags
}
}
}
TL;DR
The firewall rules created with
target_tags = [local.cluster_network_tag]
have an expectation that the nodepools will have this tag ("gke-${var.name}"
) applied.This tag should be added to
network_tags
to ensure it is set innode_pool_auto_config
for AutoProvisioned NodePools also.Expected behavior
The generated tags used by the firewall rules should be added to the
network_tags
for autoprovisioned nodepools the same as manual nodepoolsObserved behavior
Firewall rules for allowing admission webhook etc aren't applying to the autoprovisioned nodepools as targets
Terraform Configuration