siderolabs / terraform-provider-talos

Mozilla Public License 2.0
117 stars 15 forks source link

talos_machine_configuration_apply doesn't work for new nodes #131

Closed kelt1k closed 6 months ago

kelt1k commented 10 months ago

Hi I'm using this resource to add nodes to existing cluster like this (for hetzner)

resource "talos_machine_configuration_apply" "worker" {
  for_each = { for idx, wn in local.all_workers : "${idx.name}-${idx.index}" => wn }

  client_configuration        = talos_machine_secrets.this.client_configuration
  apply_mode = "reboot"
  machine_configuration_input = data.talos_machine_configuration.worker.machine_configuration
  node                        = hcloud_server.worker["${each.value.name}-${each.value.index}"].ipv4_address
  config_patches = [
    yamlencode({
      machine = {
        kubelet = {
          defaultRuntimeSeccompProfileEnabled = false,
          extraArgs = {
            cloud-provider = "external"
            rotate-server-certificates = true
            node_labels = "${each.value.labels}"
            register-with-taints = "${each.value.taints}"
          }
        }
      }
      cluster ={
        apiServer = {
          disablePodSecurityPolicy = true
        }
      }
    })
  ]
}

if I create and bootstrap new cluster all nodes have expected labels and taints but when I'm adding a new node or new nodepool new nodes ignoring this patches Maybe it's not related to terraform directly, because when I try to apply the same patch manually using talosctl - it returns me nothing to patch

smira commented 6 months ago

This is probably Talos/Kubernetes issue - if the machine config contains expected values, there's nothing this provider can do.