Skip to content

Commit 07c1e14

Browse files
committed
added comment for the naming logic
1 parent 7291c6b commit 07c1e14

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

  • modules/compute/gke-node-pool

modules/compute/gke-node-pool/main.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,13 @@ locals {
386386
supported_machine_types_for_install_dependencies = ["a3-highgpu-8g", "a3-megagpu-8g"]
387387
}
388388

389+
# Replicates GKE's naming logic for its instance templates. The full
390+
# pattern is "gke-{cluster_name}-{nodepool_name}-{hash}".
391+
#
392+
# This code builds the "{cluster_name}-{nodepool_name}" prefix, which is
393+
# capped at 32 characters plus a dash '-' in between, by truncating names if needed:
394+
# - If both names > 16 chars, both are cut to 16.
395+
# - If one name > 16, it's shortened so the combined name length is 32.
389396
data "google_compute_region_instance_template" "instance_template" {
390397
for_each = { for idx, np in google_container_node_pool.node_pool : idx => np }
391398
project = var.project_id

0 commit comments

Comments
 (0)