rancher / terraform-provider-rancher2

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

[RFE] Support node_taints on machine_config_v2 #1146

Open nicleary opened 1 year ago

nicleary commented 1 year ago

Is your feature request related to a problem? Please describe.

I'd like to be able to provision a node pool with taints via TF, but that does not seem to be possible. The docs here state that "labels and node_taints will be applied to nodes deployed using the Machine Config V2", however, when adding a node_taints block, the provider returns the error Blocks of type "node_taints" are not expected here.

Looking at the schema, node_taints is never referenced.

Describe the solution you'd like

Support for node_taints to be added or more fully documented.

Describe alternatives you've considered

Creating the node pool without the node_taint, and then applying it afterwards manually, but this is far less clean.

angeloudy commented 3 months ago

I want to express my support for the addition of this feature. The ability to manage Rancher resources effectively through Terraform is crucial for streamlined infrastructure management and automation.

Additionally, I would like to address the documentation quality for the Rancher Terraform provider. Clear, comprehensive, and up-to-date documentation is essential for users to effectively utilize and integrate these tools into their workflows. Unfortunately, the current documentation often lacks detail and clarity, making it challenging to implement and troubleshoot configurations. Improving the documentation would significantly enhance the user experience and facilitate wider adoption of the Rancher ecosystem.

pvbouwel commented 3 months ago

Is there a reason why you want these on machine_config? It is possible to create a rancher2_cluster_v2 and specify taints per machine_pools block

angeloudy commented 2 months ago

@pvbouwel machine_pools make sense to me, but still not supported.

pvbouwel commented 2 months ago

@angeloudy I am using the following (replaced environment details) and I do bootstrap nodes which have taints that way:

resource "rancher2_cluster_v2" "my_cluster" {
  name               = "notImportant"
  kubernetes_version = var.kubernetes_version
  rke_config {

  machine_pools {
      name               = "my-workers"
      control_plane_role = false
      etcd_role          = false
      worker_role        = true
      quantity           = 3
      machine_config {
        kind = rancher2_machine_config_v2.dedicated_worker["my-workers"].kind
        name = rancher2_machine_config_v2.dedicated_worker["my-workers"].name
      }
      annotations = {
        "cluster.provisioning.cattle.io/autoscaler-min-size" = 0
        "cluster.provisioning.cattle.io/autoscaler-max-size" = 5
      }

      machine_labels = {
        my_id = my-workers"
      }

      taints {
        key    = "my_id"
        value  = "my-workers"
        effect = "NoSchedule"
      }
    }

    ...
}