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

Resource kubernetes_node_taint incorrectly denies the creation of multiple taints that share the same key but different effects #2662

Open
xinkechen-evernorth opened this issue Jan 5, 2025 · 0 comments
Assignees
Labels

Comments

@xinkechen-evernorth
Copy link

xinkechen-evernorth commented Jan 5, 2025

Terraform Version, Provider Version and Kubernetes Version

Terraform version: v1.10.3
Kubernetes provider version: v2.35.1
Kubernetes version: 1.31.2 (KinD)

Affected Resource(s)

  • kubernetes_node_taint

Terraform Configuration Files

# Minimum reproducible example with KinD or any cluster
terraform {
  required_providers {
    kubernetes = {
      source = "hashicorp/kubernetes"
    }
  }
}


data "kubernetes_nodes" "cluster_nodes" {}

resource "kubernetes_node_taint" "multiple_effects_same_key" {
  metadata {
    name = data.kubernetes_nodes.cluster_nodes.nodes[0].metadata[0].name
  }

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

  taint {
    key    = "node-role.kubernetes.io/ingress"
    value  = "reserved"
    effect = "NoExecute"
  }
}

Debug Output

https://gist.github.com/xinkechen-evernorth/4e72460bbfc50510915a497506ca4291

Panic Output

N/A

Steps to Reproduce

From personal research, this behavior of allowing taints over the same key but different effects has been part of K8S since about 2016 (see upstream PR) and should be applicable for all versions since then.

As another example, the docs for a popular Kubernetes distribution, OKD/Red Hat OpenShift, also has the explicit instruction to users to create dedicated "infrastructure" nodes of the following specification:

spec:
  taints:
    - key: node-role.kubernetes.io/infra
      effect: NoSchedule
      value: reserved
    - key: node-role.kubernetes.io/infra
      effect: NoExecute
      value: reserved

References

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants