Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for tainting kubernetes nodes #1932

Closed
partcyborg opened this issue Dec 10, 2022 · 1 comment · Fixed by #1921
Closed

Support for tainting kubernetes nodes #1932

partcyborg opened this issue Dec 10, 2022 · 1 comment · Fixed by #1921

Comments

@partcyborg
Copy link
Contributor

partcyborg commented Dec 10, 2022

Description

Our Kubernetes upgrade path involves the following steps:

  1. Upgrade control plane
  2. Spin up new worker nodes on new version
  3. Taint existing worker nodes
  4. Wait for all workloads to migrate
  5. Remove nodes on previous version

We want to automate this workflow using Terraform. There is support for each of these steps except for the tainting of existing worker nodes.

To accomplish this, we need two things:

  • New data source: kubernetes_nodes. This lets us find all nodes in CSP autoscaling group with a specific label.

  • New resource: kubernetes_node_taint. This lets us apply a taint to all nodes returned by kubernetes_nodes data source.

Potential Terraform Configuration

data "kubernetes_nodes" "example" {
  metadata {
    labels = {
      "node-role.kubernetes.io/group" = "group1"
    }
  }
}

resource "kubernetes_node_taint" "example" {
  for_each = toset(data.kubernetes_nodes.example.nodes)

  taint {
    key = "node-role.kubernetes.io/retired"
    value = "true"
    effect = "NoSchedule"
  }
}

References

The kubernetes_nodes data source and kubernetes_node_taint resource have been implemented and are ready for review: #1921

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
@partcyborg
Copy link
Contributor Author

Any chance someone could take a look? This is already implemented, I just need a review for the pull request.

Thanks!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
1 participant