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

Karpenter CRDs creation complete, when deletion hasn't finished yet #164

Closed
NicoForce opened this issue Aug 16, 2024 · 10 comments
Closed

Karpenter CRDs creation complete, when deletion hasn't finished yet #164

NicoForce opened this issue Aug 16, 2024 · 10 comments

Comments

@NicoForce
Copy link

For starters, thanks Alekc for keeping this project maintained.

I've been deploying Karpenter CRDs using the kubectl provider latest version. The karpenter ec2nodeclasses take a few minutes to be deleted, which have a finalizer that wait for the termination of related ec2 instances.

Due to the recent Karpenter version upgrade which changed the Api version for the nodepool and ec2nodeclass crds, resources needed to be replaced. Weirdly enough, terraform reports the deletion and creation of the CRDs successful and only takes a few seconds; however, the ec2nodeclasses for example are still on the deletion process.

I tried using the wait = true flag, but it gave the same result, also looked into the wait_for attribute, but I don't see anything in the CRD status that would be useful.

Is there any other attribute that I'm missing for this to work as expected?

@alekc
Copy link
Owner

alekc commented Aug 18, 2024 via email

@NicoForce
Copy link
Author

I will try to recreate the behavior and put it here, but tl;dr is terraform says kubectl_manifest resources has been destroyed and created succesfully, when in reality it hasn't even finished destroying.

@rlindsberg
Copy link

I encounter a similar issue when I try to do terraform destroy. It will try to delete Karpenter node class and node pools but don't wait until they are deleted.

Maybe we can backport this feature to this repo? kubernetes/kubernetes#64034

@stevehipwell
Copy link
Contributor

@NicoForce you need to use the wait = true argument so the provider actually waits for the delete to complete. However for something like the Karpenter resources you could be hit by #156 so you might need to wait for the next release where this has been fixed. In our use case this is all working correctly, but we've explicitly got all of the related resources being removed before the CRDs are deleted (with wait = true set).

@NicoForce
Copy link
Author

@stevehipwell I did use wait = true and saw the problem where it didn't wait for resources to be destroyed.

@stevehipwell
Copy link
Contributor

@NicoForce which provider version are you on?

@NicoForce
Copy link
Author

@stevehipwell 2.0.4

@stevehipwell
Copy link
Contributor

@NicoForce I think you might have to provide your config and the TF plan to figure out what's happening.

@alekc
Copy link
Owner

alekc commented Aug 27, 2024

Just FIY, a beta with latest merged PR has been released, you might want to try that.

terraform {
  required_providers {
    kubectl = {
      source = "alekc/kubectl"
      version = "2.1.0-beta1"
    }
  }
}

@alekc
Copy link
Owner

alekc commented Oct 17, 2024

Closing this off since 2.1.1 has been released. Please reopen if the issue still persists.

@alekc alekc closed this as completed Oct 17, 2024
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

No branches or pull requests

4 participants