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

StatefulSet with "OnDelete" update strategy now errors

Open d-shi opened this issue 3 years ago • 5 comments

Terraform Version, Provider Version and Kubernetes Version

Terraform version: 0.13.5
Kubernetes provider version: 2.0.1
Kubernetes version: 1.18

Affected Resource(s)

kubernetes_stateful_set

Terraform Configuration Files

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key.

Debug Output

Panic Output

Steps to Reproduce

Create a kubernetes_stateful_set resource with the following and apply:

    update_strategy {
      type = "OnDelete"
    }

Expected Behavior

What should have happened? The statefulset should be created.

Actual Behavior

What actually happened? Terraform errors with the following message:

Error: rollout status is only available for RollingUpdate strategy type

Important Factoids

Reverting to the kubernetes provider version 1.13.3 allows this to succeed.

References

I believe this change fixed one bug but introduced this bug: https://github.com/hashicorp/terraform-provider-kubernetes/pull/1097/commits/3d2ed301b7794bdb2db834df0ac67dc7772491c5

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

d-shi avatar Feb 15 '21 22:02 d-shi

Thanks for reporting this. I can reproduce the issue and it looks like it's indeed a problem in the provider.

Note to fixer: it looks like we can't really use the polymorphic status viewers from kubectl for StatefulSets that are not using RollingUpdate strategy. Error comes from here: https://github.com/hashicorp/terraform-provider-kubernetes/blob/cbe392a099bf3a6f7e9981e58cb53be0cdee97c6/vendor/k8s.io/kubectl/pkg/polymorphichelpers/rollout_status.go#L128

alexsomesan avatar Feb 23 '21 16:02 alexsomesan

You can temporarily work around this issue by setting wait_for_rollout = false on the affected resource. For example:

resource "kubernetes_stateful_set" "test" {
  metadata {
    name = "test-1166"
  }
  wait_for_rollout = false
  spec {
...

alexsomesan avatar Feb 23 '21 16:02 alexsomesan

Ah, good to know. Thanks for the workaround!

d-shi avatar Feb 23 '21 18:02 d-shi

Encountering this still, versions are:

Terraform v1.0.3 on linux_amd64

  • provider registry.terraform.io/hashicorp/kubernetes v2.3.2

Kubernetes version 1.18

gibsonje avatar Aug 10 '21 13:08 gibsonje

Marking this issue as stale due to inactivity. If this issue receives no comments in the next 30 days it will automatically be closed. If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. This helps our maintainers find and focus on the active issues. Maintainers may also remove the stale label at their discretion. Thank you!

github-actions[bot] avatar Aug 11 '22 00:08 github-actions[bot]

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

github-actions[bot] avatar Oct 20 '22 02:10 github-actions[bot]