terraform-provider-kubernetes icon indicating copy to clipboard operation
terraform-provider-kubernetes copied to clipboard

🐛 Fix Pod spec toleration when the spec is a template

Open arybolovlev opened this issue 1 year ago • 1 comments

Description

This PR updates the logic of resources that use the Pod specification template and now the provider will keep all tolerations(spec.toleration) returned by Kubernetes. The same is applicable for the data sources kubernetes_pod_v1 and kubernetes_pod. The behavior of resources kubernetes_pod_v1 and kubernetes_pod remains unchanged, i.e. the provider will keep removing tolerations with well-known taints since they might be attached to the object by Kubernetes controller and could lead to a perpetual diff.

Affected resources and data sources:

  • resource/kubernetes_replication_controller
  • resource/kubernetes_replication_controller_v1
  • resource/kubernetes_stateful_set
  • resource/kubernetes_stateful_set_v1
  • resource/kubernetes_deployment
  • resource/kubernetes_deployment_v1
  • resource/kubernetes_daemonset
  • resource/kubernetes_daemon_set_v1
  • resource/kubernetes_cron_job
  • resource/kubernetes_cron_job_v1
  • resource/kubernetes_job
  • resource/kubernetes_job_v1
  • data_source/kubernetes_pod
  • data_source/kubernetes_pod_v1

Acceptance tests

  • [X] Have you added an acceptance test for the functionality being added?
  • [X] Have you run the acceptance tests on this branch?

Release Note

Release note for CHANGELOG:

We have updated the logic of resources that use the Pod specification template, such as `kubernetes_deployment_v1`, `kubernetes_stateful_set_v1`, etc, and now the provider will keep all tolerations(`spec.toleration`) returned by Kubernetes. The same is applicable for the data sources `kubernetes_pod_v1` and `kubernetes_pod`. The behavior of resources `kubernetes_pod_v1` and `kubernetes_pod` remains unchanged, i.e. the provider will keep removing tolerations with well-known [taints](https://kubernetes.io/docs/reference/labels-annotations-taints/) since they might be attached to the object by Kubernetes controller and could lead to a perpetual diff.

Fix an issue when the provider cuts out toleration under pod spec template(`*.template.spec.toleration`) if it uses a well-known [taint](https://kubernetes.io/docs/reference/labels-annotations-taints/). That could lead to a perpetual diff behavior.

References

Fix: https://github.com/hashicorp/terraform-provider-kubernetes/issues/2376

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

arybolovlev avatar Jan 02 '24 16:01 arybolovlev

Hello @arybolovlev

Any expected date for when this will be merged? Will it be for v2.26 only or as a patch to v2.25?

Best regards

Restless-ET avatar Feb 14 '24 13:02 Restless-ET