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

CAPIProvider pre-delete hook is not working #704

Closed
hardys opened this issue Aug 29, 2024 · 0 comments · Fixed by #706
Closed

CAPIProvider pre-delete hook is not working #704

hardys opened this issue Aug 29, 2024 · 0 comments · Fixed by #706
Assignees

Comments

@hardys
Copy link
Contributor

hardys commented Aug 29, 2024

What steps did you take and what happened?

  • Install Turtles helm chart (I tested v0.11.0)
  • Observe capiprovider CRs until all default providers are installed
  • Uninstall the helm deployment

The uninstall completes without errors, and the job pod related to the pre-delete hook added in #508 did not have any errors, but the capiprovider resources are not deleted.

What did you expect to happen?

Based on #508 I expected the capiprovider resources to be purged on deletion, but it appears they remain indefinitely:

> kubectl get capiproviders -A
NAMESPACE                   NAME                 TYPE           PROVIDERNAME   INSTALLEDVERSION   PHASE
capi-system                 cluster-api          core           cluster-api                       Ready
rke2-bootstrap-system       rke2-bootstrap       bootstrap      rke2                              Ready
rke2-control-plane-system   rke2-control-plane   controlPlane   rke2                              Ready
> kubectl get capiproviders -A -o yaml | grep deletionTimestamp
    deletionTimestamp: "2024-08-29T14:30:02Z"
    deletionTimestamp: "2024-08-29T14:30:02Z"
    deletionTimestamp: "2024-08-29T14:30:02Z"

We can see the underlying providers are still present, with a deletionTimestamp set, but they won't delete due to the controller being removed and the CRs having a finalizer set.

kubectl get coreprovider,infrastructureprovider,controlplaneprovider -A
NAMESPACE     NAME                                                 INSTALLEDVERSION   READY
capi-system   coreprovider.operator.cluster.x-k8s.io/cluster-api                      

NAMESPACE                   NAME                                                  INSTALLEDVERSION   READY
rke2-control-plane-system   controlplaneprovider.operator.cluster.x-k8s.io/rke2                      

Removing the finalizer from the coreprovider means the delete of the corresponding capiprovider resource completes.

How to reproduce it?

  • Install Turtles helm chart (I tested v0.11.0)
  • Observe capiprovider CRs until all default providers are installed
  • Uninstall the helm deployment
  • kubectl get capiproviders -A

Rancher Turtles version

v0.11.0

Anything else you would like to add?

If we rework this deletion logic, it would be good to also address the issue mentioned in #627 - e.g if the pre-install hook fails we never install the capiprovider CRD, so it should be possible to fail gracefully in the pre-delete hook under those circumstances so installation may be retried (for example when deploying both Rancher and Turtles via the RKE2 helm controller, which doesn't enable control of ordering/dependencies so we must be able to retry e.g if Turtles tries to install before Rancher is installed and ready)

Label(s) to be applied

/kind bug

hardys added a commit to hardys/charts that referenced this issue Aug 29, 2024
This is a workaround for:
rancher/turtles#627

Also it appears this is not currently working correctly ref:
rancher/turtles#704
@Danil-Grigorev Danil-Grigorev self-assigned this Aug 30, 2024
@Danil-Grigorev Danil-Grigorev moved this from CAPI Backlog to PR to be reviewed in CAPI & Hosted Kubernetes providers (EKS/AKS/GKE) Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants