Skip to content

Add wait functionality for deployments and daemonsets #215

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

Merged
merged 5 commits into from
Jan 22, 2023

Conversation

willthames
Copy link
Contributor

Allow terraform to correctly report whether a deployment or daemonset has timed out becoming ready (where ready means that all pods are up to date relative to the spec)

@willthames willthames force-pushed the wait branch 2 times, most recently from 0442ef7 to dfb782e Compare December 30, 2022 02:40
@pst
Copy link
Member

pst commented Jan 3, 2023

Thanks for the contribution. Generally this LGTM. I'm sure some users may find this useful. And since it's opt-in, there is no breaking change for everyone else.

I rebased this to be able to run the tests. Previously, the tests failed during state import due to some upstream issue with the Terraform SDK. Now they fail because there's a diff because the wait attribute isn't set (if I understand it correctly). I suppose you have to handle this condition during import?

https://github.com/kbst/terraform-provider-kustomization/actions/runs/3829517568/jobs/6516305125

Allow terraform to correctly report whether a deployment or
daemonset has timed out becoming ready (where ready means that
all pods are up to date relative to the spec)
@willthames
Copy link
Contributor Author

@pst - hopefully the tests should pass now - they do on my machine now (although I'm a little worried that the wait create timeout configured in the tests might still be too short, I've already bumped it once)

@willthames willthames force-pushed the wait branch 2 times, most recently from c54052e to 86271c3 Compare January 4, 2023 08:38
@willthames willthames marked this pull request as draft January 4, 2023 09:13
@willthames
Copy link
Contributor Author

I've converted this to draft as I'm getting a very unexpected retry failure even after bumping up timeouts and retries, so need to dig into it a bit harder

=== RUN   TestAccResourceKustomization_wait
    resource_kustomization_test.go:479: Step 1/2 error: Error running apply: exit status 1
        
        Error: github.com/kbst/terraform-provider-kustomize/kustomize.kustomizationResourceCreate: "apps/Deployment/test-wait/test": timed out creating/updating Deployment test-wait/test: couldn't find resource (32 retries)
        
          with kustomization_resource.dep1,
          on terraform_plugin_test.tf line 10, in resource "kustomization_resource" "dep1":
          10: resource "kustomization_resource" "dep1" {
        

@willthames willthames marked this pull request as ready for review January 9, 2023 13:52
@willthames
Copy link
Contributor Author

Tests now pass now that kind has been upgraded (the upgrade means that kind starts properly, allowing pods to be scheduled), and the test suite now runs faster (in spite of wait failure tests) because it doesn't wait five minutes for the kind startup timeout

willthames and others added 4 commits January 9, 2023 23:55
Set wait for resources during import based on the wait setting
configured (or based on default if not configured)
This is important for longer timeouts as max retries is only 20
by default
We expect successful waits to be quicker than timeout and
unsuccessful waits to take longer than timeout

This changes fixes the unsuccessful wait test which was
failing more quickly than expected because of too many
retries rather than timing out.
@pst
Copy link
Member

pst commented Jan 22, 2023

Sorry for the delay to merge this. I was traveling and only had access to a client provided computer that doesn't have access to my open source repositories.

@pst pst merged commit 67b5b31 into kbst:master Jan 22, 2023
@willthames
Copy link
Contributor Author

@pst no worries, it's that time of year, and you're allowed time away from the project any time!

@willthames
Copy link
Contributor Author

Could I request a new release version now that wait and replacements are both merged?

@pst
Copy link
Member

pst commented Jan 23, 2023

I'll work on cutting a release today.

@pst
Copy link
Member

pst commented Jan 23, 2023

v0.9.1 is out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants