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

fix: Introduces wait polling in case we are waiting for the deletion.… #153

Merged
merged 1 commit into from
Jun 30, 2022

Conversation

alekc
Copy link
Contributor

@alekc alekc commented Jan 31, 2022

Introduces wait for deletion polling.

Fixes #109

@alekc
Copy link
Contributor Author

alekc commented Jan 31, 2022

It looks like kubectl provider does the right job by setting a proper propagation policy, the issue is that we are not waiting for resource to be deleted.

This patch introduce polling operation, in case there is a wait flag, it will poll upstream and wait for deletion of the object indefinitely (until default TF timeout kicks in)

I am having a bit of an issue with the test though, because i am not sure that we can change timeout dynamically?
this is my attempt

func TestKubectlManifest_WaitForFinalizer(t *testing.T) {
	t.Parallel()
	cmName := "dev-cm-" + acctest.RandString(10)

	// language=HCL
	config := fmt.Sprintf(`
resource "kubectl_manifest" "test" {
	wait = true
	yaml_body = <<YAML
apiVersion: v1
kind: ConfigMap
metadata:
  finalizers:
  - fake.com/finalizer
  name: %s
YAML
}
	`, cmName)

	resource.Test(t, resource.TestCase{
		Providers: testAccProviders,
		Steps: []resource.TestStep{
			// create CM
			{
				Config: config,
			},
			// try to destroy it, we should get an error
			{
				Config:  config,
				Destroy: true,
			},
		},
	})
}

@gavinbunney

@stevehipwell
Copy link

@gavinbunney could you take a look at this?

@patst
Copy link

patst commented Jun 28, 2022

@gavinbunney sorry to bug you too. Would be great to get some feedback if there is the chance to get this merged or if there should be some adjustment to the code.

@gavinbunney
Copy link
Owner

Thanks LGTM!

@gavinbunney gavinbunney merged commit 8e4af59 into gavinbunney:master Jun 30, 2022
@stevehipwell
Copy link

@gavinbunney could you cut a release so this can be used?

@alekc alekc deleted the wait-for-delete branch September 13, 2022 15:46
@valorl
Copy link

valorl commented Nov 25, 2022

@gavinbunney sorry for the ping, but I'm hoping making a release isn't too much effort. This could really unblock things for me 😇 🙏

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.

Wait=true does not appear to be working as intended...
5 participants