terraform-google-modules / terraform-google-kubernetes-engine

Configures opinionated GKE clusters
https://registry.terraform.io/modules/terraform-google-modules/kubernetes-engine/google
Apache License 2.0
1.15k stars 1.18k forks source link

GKE cluster forces replacement after updating DNS config #1744

Closed siva-spotdraft closed 7 months ago

siva-spotdraft commented 1 year ago

TL;DR

after adding

cluster_dns_provider   = "CLOUD_DNS"
  cluster_dns_scope      = "CLUSTER_SCOPE"

Screenshot 2023-09-21 at 11 12 27 AM

gcp terraform provider version: 4.82.0 gke version: 1.25.12-gke.500

module and version

source             = "terraform-google-modules/kubernetes-engine/google//modules/safer-cluster"
version            = "27.0.0"

Expected behavior

cluster should not be recreated by terraform

Observed behavior

TF forces replacement of clusterthe

Terraform Configuration

// GKE cluster EU

module "gke" {
  source             = "terraform-google-modules/kubernetes-engine/google//modules/safer-cluster"
  version            = "27.0.0"
  project_id         = module.enabled_google_apis.project_id
  name               = var.EU.cluster_name
  region             = var.EU.region
  regional           = false
  kubernetes_version = var.k8s_version_eu
  release_channel    = "STABLE"
  cluster_resource_labels = {
    "sprinto" = "notprod" #label to classify resources in sprinto
  }
  zones                        = var.gke-zones-eu
  network                      = module.vpc.network_name
  subnetwork                   = var.EU.subnet_name
  ip_range_pods                = var.EU.ip_range_pods_name
  dns_cache                    = true
  ip_range_services            = var.EU.ip_range_services_name
  datapath_provider            = "DATAPATH_PROVIDER_UNSPECIFIED"
  enable_private_endpoint      = true
  master_ipv4_cidr_block       = "172.0.0.0/28"
  authenticator_security_group = "gke-123@test.com"
  master_authorized_networks = [{
    cidr_block   = "${module.bastion-india.ip_address}/32"
    display_name = "Bastion Host"
  }]
  grant_registry_access  = true
  maintenance_start_time = "2023-01-17T00:01:00Z"
  maintenance_end_time   = "2023-01-17T06:01:00Z"
  maintenance_recurrence = "FREQ=WEEKLY;BYDAY=SU,SA"
  node_pools = [
    {
      name                      = "on-demand-4c-16gb-with-taints"
      machine_type              = "n2-standard-4"
      min_count                 = 0
      max_count                 = 2
      disk_size_gb              = 100
      disk_type                 = "pd-standard"
      image_type                = "COS_CONTAINERD"
      auto_repair               = true
      auto_upgrade              = true
      preemptible               = false
      initial_node_count        = 0
      node_metadata             = "GKE_METADATA"
      default_max_pods_per_node = 60
    },
    {
      name                      = "on-demand-4c-16gb-with-taints-1"
      machine_type              = "n2-standard-4"
      min_count                 = 0
      max_count                 = 1
      disk_size_gb              = 100
      disk_type                 = "pd-standard"
      image_type                = "COS_CONTAINERD"
      auto_repair               = true
      auto_upgrade              = true
      preemptible               = false
      initial_node_count        = 0
      node_metadata             = "GKE_METADATA"
      default_max_pods_per_node = 60
    },
    {
      name                      = "preemp-dev-n2standard4-1"
      machine_type              = "n2-standard-8"
      min_count                 = 0
      max_count                 = 5
      disk_size_gb              = 100
      disk_type                 = "pd-standard"
      image_type                = "COS_CONTAINERD"
      auto_repair               = true
      auto_upgrade              = true
      preemptible               = true
      initial_node_count        = 1
      enable_gcfs               = true
      node_metadata             = "GKE_METADATA"
      default_max_pods_per_node = 60
    },
    {
      name                      = "preemp-qa-n2standard4-1"
      machine_type              = "n2-standard-8"
      min_count                 = 0
      max_count                 = 4
      disk_size_gb              = 100
      disk_type                 = "pd-standard"
      image_type                = "COS_CONTAINERD"
      auto_repair               = true
      auto_upgrade              = true
      preemptible               = true
      initial_node_count        = 1
      node_metadata             = "GKE_METADATA"
      default_max_pods_per_node = 60
    },
    {
      name                      = "preemp-dev-n2dstandard4-1"
      machine_type              = "n2d-standard-8"
      min_count                 = 0
      max_count                 = 6
      disk_size_gb              = 100
      disk_type                 = "pd-standard"
      image_type                = "COS_CONTAINERD"
      auto_repair               = true
      auto_upgrade              = true
      preemptible               = true
      initial_node_count        = 1
      node_metadata             = "GKE_METADATA"
      default_max_pods_per_node = 60
    },
  ]
  node_pools_labels = {
    all = {}
    on-demand-4c-16gb-with-taints = {
      on-demand = "true"
    }
    on-demand-4c-16gb-with-taints-1 = {
      app = "qa"
    }
    preemp-dev-n2standard4-1 = {
      app         = "dev"
      preemptible = "true"
    }
    preemp-qa-n2standard4-1 = {
      app         = "qa"
      preemptible = "true"
    }
    preemp-dev-n2dstandard4-1 = {
      app         = "dev"
      preemptible = "true"
    }
  }
  node_pools_taints = {
    all = []

    on-demand-4c-16gb-with-taints = [
      {
        key    = "on-demand"
        value  = "true"
        effect = "NO_SCHEDULE"
      },
    ]
    on-demand-4c-16gb-with-taints-1 = [
      {
        key    = "on-demand"
        value  = "true"
        effect = "NO_SCHEDULE"
      },
    ]
    preemp-qa-n2standard4-1 = [
      {
        key    = "preemptible"
        value  = "true"
        effect = "NO_SCHEDULE"
      },
      {
        key    = "env"
        value  = "qa"
        effect = "NO_SCHEDULE"
      },
    ]

  }
}

Terraform Version

v0.14.9

Additional information

No response

54nd20 commented 1 year ago

I think this is related to the issue #1783

github-actions[bot] commented 10 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

54nd20 commented 10 months ago

Related to: #1833

github-actions[bot] commented 8 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days