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

Add ForceNew: true to controller field in IngressClass resource #2629

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

SaadAssaf
Copy link

@SaadAssaf SaadAssaf commented Nov 21, 2024

Description

This PR fixes an issue where changes to the controller field in the IngressClass resource fail because it is immutable in Kubernetes (Kubernetes API). When attempting to update the controller value, Kubernetes rejects the change with an error:

spec.controller: Invalid value: "new-controller": field is immutable

The fix adds the ForceNew: true attribute to the controller field. Doing so makes sure that every change to the controller value forces Terraform to recreate the resource.

Acceptance tests

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

Output from acceptance testing:

make testacc TESTARGS='-run=TestAccKubernetesIngressClassV1_ControllerImmutable'
==> Checking that code complies with gofmt requirements...
go vet ./...
TF_ACC=1 go test "/home/saad/nine-Repos/PT-Repo/terraform-provider-kubernetes/kubernetes" -v -vet=off -run=TestAccKubernetesIngressClassV1_ControllerImmutable -parallel 8 
-timeout 3h
=== RUN   TestAccKubernetesIngressClassV1_ControllerImmutable
=== PAUSE TestAccKubernetesIngressClassV1_ControllerImmutable
=== CONT  TestAccKubernetesIngressClassV1_ControllerImmutable
--- PASS: TestAccKubernetesIngressClassV1_ControllerImmutable (2.74s)
PASS
ok      github.com/hashicorp/terraform-provider-kubernetes/kubernetes   2.774s

Release Note

Release note for CHANGELOG:

`Fix: Add ForceNew to the controller field of IngressClass to handle immutability and ensure resource recreation when controller value changes.`

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

@SaadAssaf SaadAssaf requested a review from a team as a code owner November 21, 2024 15:07
Copy link

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes

Have you signed the CLA already but the status is still pending? Recheck it.

@github-actions github-actions bot added size/S and removed size/XS labels Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants