rancher / terraform-provider-rancher2

Terraform Rancher2 provider
https://www.terraform.io/docs/providers/rancher2/
Mozilla Public License 2.0
256 stars 222 forks source link

[BUG] Unable to deploy a machine pool of Windows nodes, only linux is available #1090

Open santimar opened 1 year ago

santimar commented 1 year ago

Rancher Server Setup

Provider Information

Describe the bug

I am creating a RKE2 cluster using rancher on a vsphere server and there is no way to set the OS of a given machine pool.

I am creating a machine pool like

resource "rancher2_machine_config_v2" "template-windows" {
  generate_name = "template-vm-windows"
  vsphere_config {
    clone_from    = var.vm_template_windows
    cpu_count     = var.cpu_count
    creation_type = "template"
    datacenter    = var.datacenter
    datastore     = var.datastore
    disk_size     = var.disk_size
    folder        = var.folder
    memory_size   = 4 * 1024
    network       = [var.network]
    pool          = var.vcenter-pool
    cfgparam      = []
  }
}

then I let rancher create a RKE2 cluster using the rancher2_cluster_v2 resource

resource "rancher2_cluster_v2" "cluster" {
  kubernetes_version           = "v1.24.9+rke2r2"
  name                         = "cluster"
  cloud_credential_secret_name = rancher2_cloud_credential.vsphere_credential.id
  rke_config {
    machine_selector_config {
      config = {
        cloud-provider-name = "rancher-vsphere"
      }
    }
    machine_global_config = <<EOF
cni: "calico"
disable-kube-proxy: false
etcd-expose-metrics: false
tls-san:
  - my-kubernetes-domain.com
EOF
    machine_pools {
      cloud_credential_secret_name = rancher2_cloud_credential.vsphere_credential.id
      name                         = "pool-control-plain"
      ...
    }
    machine_pools {
      cloud_credential_secret_name = rancher2_cloud_credential.vsphere_credential.id
      name                         = "pool-workers"
      ...
    }
    machine_pools {
      cloud_credential_secret_name = rancher2_cloud_credential.vsphere_credential.id
      name                         = "pool-windows"
      control_plane_role           = false
      etcd_role                    = false
      worker_role                  = true
      quantity                     = 1
      machine_config {
        kind = rancher2_machine_config_v2.template-windows.kind
        name = rancher2_machine_config_v2.template-windows.name
      }
    }

    chart_values = <<EOF
rke2-calico: {}
rancher-vsphere-cpi:
  ...
rancher-vsphere-csi:
  ...
EOF
    upgrade_strategy {
      control_plane_concurrency = "1"
      worker_concurrency = "1"
    }
  }
}

All the nodes gets created as linux nodes even the windows workers image

In rancher2_machine_config_v2 I can't find a way to pick the right OS, but here I can read that:

Windows features for RKE2 include:

  • Windows supports the vSphere node driver
  • Calico CNI for Windows RKE2 custom clusters
  • Project Network Isolation (PNI) for Calico
  • Windows Containers with RKE2 powered by containerd
  • Provisioning of Windows RKE2 clusters through Terraform
  • Provisioning of Windows RKE2 custom clusters directly from the Rancher UI

Am i missing something?

jasonhensley commented 1 year ago

Watching this as I am having a hard time finding this information as well.