Terraform-provider-kubernetes: Removal of default pod deployment template namespace forces resource recreation in v1.10.0

Created on 14 Nov 2019  ·  5Comments  ·  Source: hashicorp/terraform-provider-kubernetes

Affected Resource(s)

Please list the resources as a list, for example:

  • kubernetes_deployment

Terraform Version

Terraform v0.12.8
+ provider.aws v2.35.0
+ provider.kubernetes v1.10.0

Expected Behavior

What should have happened?
There was a kubernetes_deployment resource applied on 1.9.0 of the provider. It had been using the default namespace for the deployment pod template. When reapplying the resource on 1.10.0, there should have been an update on the resource to remove this namespace value.

Actual Behavior

What actually happened?
The resource (kubernetes deployment) had to be destroyed and recreated entirely.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. Create a kubernetes deployment on 1.9.0. Do not set a namespace for the template; it should use the default value in the Terraform plan.
  2. Re-plan the resource on 1.10.0. It should show that a recreation is required.

References

Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:

                  - namespace        = "default" -> null # forces replacement

for plans using 1.10.0 on resources that had been applied on 1.9.0 that did not set a namespace for the template.

All 5 comments

Yeah, sorry about that.

It was already reported in a comment on the PR: https://github.com/terraform-providers/terraform-provider-kubernetes/pull/275#issuecomment-552588625

Thanks for opening the issue to track this.

You should be able to work it around by specifying the default namespace in the configuration.

Edit: fixed the typo on namespace.

You should be able to work it around by specifying the defaut namespace in the configuration.

That's default in case it's not clear to somebody.

As mentioned in the PR, another way to work around this is to remove the default namespace by editing your deployments with kubectl. For example:

kubectl -n your-namespace edit deployment yourdeployment

and simply remove the line in spec.template.metadata which says namespace: default.

WARNING: This will replace the pods for each of the edited deployments

If that's unacceptable for you, then follow the previous workaround.

just to verify, we experienced this recently because we had some leftover 1.9.0's in caches. Once everything is on 1.10.0, and all of the deployments have that namespace removed, things are clean.

I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

Was this page helpful?
0 / 5 - 0 ratings