-
Notifications
You must be signed in to change notification settings - Fork 115
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
Destroying a resource fails with "timed out waiting to be Ready" #1418
Comments
FWIW - here's what the resource shows: status:
acceptedNames:
kind: Challenge
listKind: ChallengeList
plural: challenges
singular: challenge
conditions:
- lastTransitionTime: "2021-01-07T19:40:30Z"
message: no conflicts found
reason: NoConflicts
status: "True"
type: NamesAccepted
- lastTransitionTime: "2021-01-07T19:40:31Z"
message: the initial names have been accepted
reason: InitialNamesAccepted
status: "True"
type: Established
- lastTransitionTime: "2021-01-07T19:40:32Z"
message: protected groups must have approval annotation "api-approved.kubernetes.io",
see https://github.com/kubernetes/enhancements/pull/1111
reason: MissingAnnotation
status: "False"
type: KubernetesAPIApprovalPolicyConformant
- lastTransitionTime: "2021-01-07T21:36:40Z"
message: CustomResource deletion is in progress
reason: InstanceDeletionInProgress
status: "True"
type: Terminating
storedVersions:
- v1alpha1 |
Hmm - unfortunately
|
Hi ran into this issues with cert-manager today as well. Did you find any workarounds ? |
I've hit this issue before as well, and was able to work around it with kubectl. It has something to do with finalizers on that CRD. We should figure out how to fix in the provider, but you can work around in the meantime with this:
|
I am also seeing this issue with ArgoCD installed via Helm. I also tried rendering the Helm Chart and deploying standard K8s resources. Operation before timeout - timeout can be 10+ minutes depending on config:
Error
|
I solved this using a Github Action FYI:
|
Yeah, there are a lot of issues floating around like kubernetes/kubernetes#60538 and cert-manager/cert-manager#1582 which recommend deleting stuck finalizers, but the fact they are stuck is a symptom of something else -- like the thing responsible for finalizing getting deleted before it could finalize other resources. https://kubernetes.io/docs/concepts/overview/working-with-objects/finalizers/
What would an appropriate Pulumi fix look like in this situation? It feels like a dependency problem, like we should be able to delete the finali-zee before the finali-zer. But this doesn't work if there are any CRDs Pulumi doesn't know about, which is often the case with cert-manager and argo where this has come up. Even if we tear down everything we know about correctly, we can still deadlock while trying to delete a namespace because some unknown-to-us CRDs are stuck. An annotation like |
One additional thought - could we add a warning/error that indicates in the case of an await timeout on a delete, where we know there are finalizers on the resources, that the deletion may be blocked on finalizers? That might be the right improvement to make to help point users at where the underlying problem is so they can investigate using other tools, and then resolve this as otherwise by design? |
As a best practice, users should use Pulumi dependencies to ensure that custom resources have the operator and its CRDs as a dependency. One shouldn't delete an operator, or its namespace, or its CRDs, until all CRs are completely deleted. An easy way to do that is to install the operator in a separate component (e.g. a |
@EronWright while I agree best practice is something we should strive for, I think its unfortunately not always where we are at. I have done quite a bit of finalizer hacking on kubernetes to get destroys to work. Usually this has lead me to just delete the cluster in the cloud and then refresh the resource, to complete the destroy. I don't think this is a workflow we want to encourage and I think @lukehoban's comment about a help message, possibly with a helpful kubectl command to fix it, and a "Are you missing a dependency on" would be a great addition and really helpful to users. I am not sure this is possible, but would be pretty awesome, is if we could detect the missing dependency and suggest that like: |
Cannot close issue:
Please fix these problems and try again. |
1 similar comment
Cannot close issue:
Please fix these problems and try again. |
- The new `enableSecretMutable` provider configuration option treats changes to `Secrets` as updates instead of replacements (similar to the `enableConfigMapMutable` option). The default replacement behavior can be preserved for a particular `Secret` by setting its `immutable` field to `true`. (#2291) **Note:** These options (`enableSecretMutable` and `enableConfigMapMutable`) may become the default behavior in a future v5 release of the provider. Programs that depend on the replacement of `Secrets` and `ConfigMaps` (e.g. to trigger updates for downstream dependencies like `Deployments`) are recommended to explicitly specify `immutable: true`. - A warning is now emitted if an object has finalizers which might be blocking deletion. (#1418) - **EXPERIMENTAL**: Generic await logic is now available as an opt-in feature. Running a program with `PULUMI_K8S_AWAIT_ALL=true` will now cause Pulumi to await readiness for _all_ resources, including custom resources. Generic readiness is determined according to some well-known conventions (like the "Ready" condition) as determined by [cli-utils](https://github.com/kubernetes-sigs/cli-utils/tree/master/pkg/kstatus). Pulumi's current behavior, without this feature enabled, is to assume some resources are immediately available, which can cause downstream resources to fail. Existing readiness logic is unaffected by this setting. (#2996) - **EXPERIMENTAL**: The `pulumi.com/waitFor` annotation was introduced to allow for custom readiness checks. This override Pulumi's own await logic for the resource (however the `pulumi.com/skipAwait` annotation still takes precedence). The value of this annotation can take 3 forms: 1. A string prefixed with `jsonpath=` followed by a [JSONPath](https://kubernetes.io/docs/reference/kubectl/jsonpath/) expression and an optional value. The JSONPath expression accepts the same syntax as `kubectl get -o jsonpath={...}`. If a value is provided, the resource is considered ready when the JSONPath expression evaluates to the same value. For example this resource expects its "phase" field to have a value of "Running": `pulumi.com/waitFor: "jsonpath={.status.phase}=Running"` If a value is not provided, the resource will be considered ready when any value exists at the given path, similar to `kubectl wait --for jsonpath=...`. This resource will wait until it has a webhook configured with a CA bundle: `pulumi.com/waitFor: "jsonpath={.webhooks[*].clientConfig.caBundle}"` 2. A string prefixed with `condition=` followed by the type of the condition and an optional status. This matches the behavior of `kubectl wait --for=condition=...` and will wait until the resource has a matching condition. The expected status defaults to "True" if not specified. `pulumi.com/waitFor: "condition=Synced"` `pulumi.com/waitFor: "condition=Reconciling=False"` 3. A string containing a JSON array of multiple `jsonpath=` and `condition=` expressions. `pulumi.com/waitFor: '["jsonpath={.foo}", "condition=Bar"]'` - Pulumi will now emit logs for any Kubernetes "Warning" Events associated with resources being created, updated or deleted. (https://github.com/pulumi/pulumi-kubernetes/pull/3135/files) - The `immutable` field is now respected for `ConfigMaps` when the provider is configured with `enableConfigMapMutable`. (#3181) - Fixed a panic that could occur during deletion. (#3157)
>[!IMPORTANT] > The `enableSecretMutable` and `enableConfigMapMutable` options may become the default behavior in a future v5 release of the provider. Programs that depend on the replacement of `Secrets` and `ConfigMaps` (e.g. to trigger updates for downstream dependencies like `Deployments`) are recommended to explicitly specify `immutable: true`. ### Added - The new `enableSecretMutable` provider configuration option treats changes to `Secrets` as updates instead of replacements (similar to the `enableConfigMapMutable` option). The default replacement behavior can be preserved for a particular `Secret` by setting its `immutable` field to `true`. (#2291) - A warning is now emitted if an object has finalizers which might be blocking deletion. (#1418) - **EXPERIMENTAL**: Generic await logic is now available as an opt-in feature. Running a program with `PULUMI_K8S_AWAIT_ALL=true` will now cause Pulumi to await readiness for _all_ resources, including custom resources. Generic readiness is determined according to some well-known conventions (like the "Ready" condition) as determined by [cli-utils](https://github.com/kubernetes-sigs/cli-utils/tree/master/pkg/kstatus). Pulumi's current behavior without this feature enabled is to assume some resources are immediately available, which can cause downstream resources to fail. Existing readiness logic is unaffected by this setting. (#2996) - **EXPERIMENTAL**: The `pulumi.com/waitFor` annotation was introduced to allow for custom readiness checks. This override Pulumi's own await logic for the resource (however the `pulumi.com/skipAwait` annotation still takes precedence). The value of this annotation can take 3 forms: 1. A string prefixed with `jsonpath=` followed by a [JSONPath](https://kubernetes.io/docs/reference/kubectl/jsonpath/) expression and an optional value. The JSONPath expression accepts the same syntax as `kubectl get -o jsonpath={...}`. If a value is provided, the resource is considered ready when the JSONPath expression evaluates to the same value. For example this resource expects its "phase" field to have a value of "Running": `pulumi.com/waitFor: "jsonpath={.status.phase}=Running"` If a value is not provided, the resource will be considered ready when any value exists at the given path, similar to `kubectl wait --for jsonpath=...`. This resource will wait until it has a webhook configured with a CA bundle: `pulumi.com/waitFor: "jsonpath={.webhooks[*].clientConfig.caBundle}"` 2. A string prefixed with `condition=` followed by the type of the condition and an optional status. This matches the behavior of `kubectl wait --for=condition=...` and will wait until the resource has a matching condition. The expected status defaults to "True" if not specified. `pulumi.com/waitFor: "condition=Synced"` `pulumi.com/waitFor: "condition=Reconciling=False"` 3. A string containing a JSON array of multiple `jsonpath=` and `condition=` expressions. `pulumi.com/waitFor: '["jsonpath={.foo}", "condition=Bar"]'` - Pulumi will now emit logs for any Kubernetes "Warning" Events associated with resources being created, updated or deleted. (https://github.com/pulumi/pulumi-kubernetes/pull/3135/files) ### Fixed - The `immutable` field is now respected for `ConfigMaps` when the provider is configured with `enableConfigMapMutable`. (#3181) - Fixed a panic that could occur during deletion. (#3157)
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@pulumi/kubernetes](https://pulumi.com) ([source](https://github.com/pulumi/pulumi-kubernetes)) | dependencies | minor | [`4.17.1` -> `4.18.1`](https://renovatebot.com/diffs/npm/@pulumi%2fkubernetes/4.17.1/4.18.1) | --- ### Release Notes <details> <summary>pulumi/pulumi-kubernetes (@​pulumi/kubernetes)</summary> ### [`v4.18.1`](https://github.com/pulumi/pulumi-kubernetes/blob/HEAD/CHANGELOG.md#4181-September-13-2024) [Compare Source](https://github.com/pulumi/pulumi-kubernetes/compare/v4.18.0...v4.18.1) ##### Added - Schemagen is now a library that can be consumed by other packages. ([https://github.com/pulumi/pulumi-kubernetes/pull/3187](https://github.com/pulumi/pulumi-kubernetes/pull/3187)) ##### Changed - Updated beta Kubernetes client libraries to stable v1.31 release. ([https://github.com/pulumi/pulumi-kubernetes/pull/3196](https://github.com/pulumi/pulumi-kubernetes/pull/3196)) ### [`v4.18.0`](https://github.com/pulumi/pulumi-kubernetes/blob/HEAD/CHANGELOG.md#4180-September-3-2024) [Compare Source](https://github.com/pulumi/pulumi-kubernetes/compare/v4.17.1...v4.18.0) ##### Added - The new `enableSecretMutable` provider configuration option treats changes to `Secrets` as updates instead of replacements (similar to the `enableConfigMapMutable` option). The default replacement behavior can be preserved for a particular `Secret` by setting its `immutable` field to `true`. [https://github.com/pulumi/pulumi-kubernetes/issues/2291](https://github.com/pulumi/pulumi-kubernetes/issues/2291)2291) **Note:** These options (`enableSecretMutable` and `enableConfigMapMutable`) may become the default behavior in a future v5 release of the provider. Programs that depend on the replacement of `Secrets` and `ConfigMaps` (e.g. to trigger updates for downstream dependencies like `Deployments`) are recommended to explicitly specify `immutable: true`. - A warning is now emitted if an object has finalizers which might be blocking deletio[https://github.com/pulumi/pulumi-kubernetes/issues/1418](https://github.com/pulumi/pulumi-kubernetes/issues/1418)1418) - **EXPERIMENTAL**: Generic await logic is now available as an opt-in feature. Running a program with `PULUMI_K8S_AWAIT_ALL=true` will now cause Pulumi to await readiness for *all* resources, including custom resources. Generic readiness is determined according to some well-known conventions (like the "Ready" condition) as determined by [cli-utils](https://github.com/kubernetes-sigs/cli-utils/tree/master/pkg/kstatus). Pulumi's current behavior, without this feature enabled, is to assume some resources are immediately available, which can cause downstream resources to fail. Existing readiness logic is unaffected by this setting. [https://github.com/pulumi/pulumi-kubernetes/issues/2996](https://github.com/pulumi/pulumi-kubernetes/issues/2996)2996) - **EXPERIMENTAL**: The `pulumi.com/waitFor` annotation was introduced to allow for custom readiness checks. This override Pulumi's own await logic for the resource (however the `pulumi.com/skipAwait` annotation still takes precedence). The value of this annotation can take 3 forms: 1. A string prefixed with `jsonpath=` followed by a [JSONPath](https://kubernetes.io/docs/reference/kubectl/jsonpath/) expression and an optional value. The JSONPath expression accepts the same syntax as `kubectl get -o jsonpath={...}`. If a value is provided, the resource is considered ready when the JSONPath expression evaluates to the same value. For example this resource expects its "phase" field to have a value of "Running": `pulumi.com/waitFor: "jsonpath={.status.phase}=Running"` If a value is not provided, the resource will be considered ready when any value exists at the given path, similar to `kubectl wait --for jsonpath=...`. This resource will wait until it has a webhook configured with a CA bundle: `pulumi.com/waitFor: "jsonpath={.webhooks[*].clientConfig.caBundle}"` 2. A string prefixed with `condition=` followed by the type of the condition and an optional status. This matches the behavior of `kubectl wait --for=condition=...` and will wait until the resource has a matching condition. The expected status defaults to "True" if not specified. `pulumi.com/waitFor: "condition=Synced"` `pulumi.com/waitFor: "condition=Reconciling=False"` 3. A string containing a JSON array of multiple `jsonpath=` and `condition=` expressions. `pulumi.com/waitFor: '["jsonpath={.foo}", "condition=Bar"]'` - Pulumi will now emit logs for any Kubernetes "Warning" Events associated with resources being created, updated or delete[https://github.com/pulumi/pulumi-kubernetes/pull/3135](https://github.com/pulumi/pulumi-kubernetes/pull/3135)ull/3135/files) ##### Fixed - The `immutable` field is now respected for `ConfigMaps` when the provider is configured with `enableConfigMapMutable`. [https://github.com/pulumi/pulumi-kubernetes/issues/3181](https://github.com/pulumi/pulumi-kubernetes/issues/3181)3181) - Fixed a panic that could occur during deletion. ([https://github.com/pulumi/pulumi-kubernetes/issues/3157](https://github.com/pulumi/pulumi-kubernetes/issues/3157)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC43Ny4wIiwidXBkYXRlZEluVmVyIjoiMzguNzcuNiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsidHlwZS9taW5vciJdfQ==--> Co-authored-by: lumiere-bot[bot] <98047013+lumiere-bot[bot]@users.noreply.github.com>
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@pulumi/kubernetes](https://pulumi.com) ([source](https://github.com/pulumi/pulumi-kubernetes)) | dependencies | minor | [`4.17.1` -> `4.18.1`](https://renovatebot.com/diffs/npm/@pulumi%2fkubernetes/4.17.1/4.18.1) | --- ### Release Notes <details> <summary>pulumi/pulumi-kubernetes (@​pulumi/kubernetes)</summary> ### [`v4.18.1`](https://github.com/pulumi/pulumi-kubernetes/blob/HEAD/CHANGELOG.md#4181-September-13-2024) [Compare Source](https://github.com/pulumi/pulumi-kubernetes/compare/v4.18.0...v4.18.1) ##### Added - Schemagen is now a library that can be consumed by other packages. ([https://github.com/pulumi/pulumi-kubernetes/pull/3187](https://github.com/pulumi/pulumi-kubernetes/pull/3187)) ##### Changed - Updated beta Kubernetes client libraries to stable v1.31 release. ([https://github.com/pulumi/pulumi-kubernetes/pull/3196](https://github.com/pulumi/pulumi-kubernetes/pull/3196)) ### [`v4.18.0`](https://github.com/pulumi/pulumi-kubernetes/blob/HEAD/CHANGELOG.md#4180-September-3-2024) [Compare Source](https://github.com/pulumi/pulumi-kubernetes/compare/v4.17.1...v4.18.0) ##### Added - The new `enableSecretMutable` provider configuration option treats changes to `Secrets` as updates instead of replacements (similar to the `enableConfigMapMutable` option). The default replacement behavior can be preserved for a particular `Secret` by setting its `immutable` field to `true`. [https://github.com/pulumi/pulumi-kubernetes/issues/2291](https://github.com/pulumi/pulumi-kubernetes/issues/2291)2291) **Note:** These options (`enableSecretMutable` and `enableConfigMapMutable`) may become the default behavior in a future v5 release of the provider. Programs that depend on the replacement of `Secrets` and `ConfigMaps` (e.g. to trigger updates for downstream dependencies like `Deployments`) are recommended to explicitly specify `immutable: true`. - A warning is now emitted if an object has finalizers which might be blocking deletio[https://github.com/pulumi/pulumi-kubernetes/issues/1418](https://github.com/pulumi/pulumi-kubernetes/issues/1418)1418) - **EXPERIMENTAL**: Generic await logic is now available as an opt-in feature. Running a program with `PULUMI_K8S_AWAIT_ALL=true` will now cause Pulumi to await readiness for *all* resources, including custom resources. Generic readiness is determined according to some well-known conventions (like the "Ready" condition) as determined by [cli-utils](https://github.com/kubernetes-sigs/cli-utils/tree/master/pkg/kstatus). Pulumi's current behavior, without this feature enabled, is to assume some resources are immediately available, which can cause downstream resources to fail. Existing readiness logic is unaffected by this setting. [https://github.com/pulumi/pulumi-kubernetes/issues/2996](https://github.com/pulumi/pulumi-kubernetes/issues/2996)2996) - **EXPERIMENTAL**: The `pulumi.com/waitFor` annotation was introduced to allow for custom readiness checks. This override Pulumi's own await logic for the resource (however the `pulumi.com/skipAwait` annotation still takes precedence). The value of this annotation can take 3 forms: 1. A string prefixed with `jsonpath=` followed by a [JSONPath](https://kubernetes.io/docs/reference/kubectl/jsonpath/) expression and an optional value. The JSONPath expression accepts the same syntax as `kubectl get -o jsonpath={...}`. If a value is provided, the resource is considered ready when the JSONPath expression evaluates to the same value. For example this resource expects its "phase" field to have a value of "Running": `pulumi.com/waitFor: "jsonpath={.status.phase}=Running"` If a value is not provided, the resource will be considered ready when any value exists at the given path, similar to `kubectl wait --for jsonpath=...`. This resource will wait until it has a webhook configured with a CA bundle: `pulumi.com/waitFor: "jsonpath={.webhooks[*].clientConfig.caBundle}"` 2. A string prefixed with `condition=` followed by the type of the condition and an optional status. This matches the behavior of `kubectl wait --for=condition=...` and will wait until the resource has a matching condition. The expected status defaults to "True" if not specified. `pulumi.com/waitFor: "condition=Synced"` `pulumi.com/waitFor: "condition=Reconciling=False"` 3. A string containing a JSON array of multiple `jsonpath=` and `condition=` expressions. `pulumi.com/waitFor: '["jsonpath={.foo}", "condition=Bar"]'` - Pulumi will now emit logs for any Kubernetes "Warning" Events associated with resources being created, updated or delete[https://github.com/pulumi/pulumi-kubernetes/pull/3135](https://github.com/pulumi/pulumi-kubernetes/pull/3135)ull/3135/files) ##### Fixed - The `immutable` field is now respected for `ConfigMaps` when the provider is configured with `enableConfigMapMutable`. [https://github.com/pulumi/pulumi-kubernetes/issues/3181](https://github.com/pulumi/pulumi-kubernetes/issues/3181)3181) - Fixed a panic that could occur during deletion. ([https://github.com/pulumi/pulumi-kubernetes/issues/3157](https://github.com/pulumi/pulumi-kubernetes/issues/3157)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC43Ny4wIiwidXBkYXRlZEluVmVyIjoiMzguNzcuNiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsidHlwZS9taW5vciJdfQ==--> Co-authored-by: lumiere-bot[bot] <98047013+lumiere-bot[bot]@users.noreply.github.com>
I am unable to destroy a Kubernetes
CustomResourceDefinition
resource, and get a failure that says "timed out waiting to be Ready", even though there is no need to wait for it to be ready to delete it. This blocs me from doing anything with my stack.The text was updated successfully, but these errors were encountered: