kubernetes-sigs / cluster-api-provider-openstack

Cluster API implementation for OpenStack
https://cluster-api-openstack.sigs.k8s.io/
Apache License 2.0
289 stars 253 forks source link

🐛 Wait and requeue if LB + its ports not deleted #2122

Open EmilienM opened 3 months ago

EmilienM commented 3 months ago

What this PR does / why we need it:

Wait and requeue if LB is in PENDING_DELETE

If the LB that is being deleted when a cluster is deleted, it'll go through the PENDING_DELETE state and at this stage there is nothing we can do but wait for the LB to be actually deleted.

If the LB is in that state during the deletion, let's just return no error but request a reconcile after some time.

Wait for Octavia-managed ports to be removed

In a best-effort mode, when cleaning a load-balancer, wait for the ports with a device ID (mapped with the LB ID) and a certain prefix is deleted (by Octavia itself, not CAPO managed) before claiming the LB is really deleted.

This will avoid the reconcile to fail later when trying to remove the network while some ports are still attached.

Which issue(s) this PR fixes: Fixes #2124 Fixes #2121

k8s-ci-robot commented 3 months ago

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Once this PR has been reviewed and has the lgtm label, please ask for approval from emilienm. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files: - **[OWNERS](https://github.com/kubernetes-sigs/cluster-api-provider-openstack/blob/main/OWNERS)** Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
netlify[bot] commented 3 months ago

Deploy Preview for kubernetes-sigs-cluster-api-openstack ready!

Name Link
Latest commit 9705a4f69a7c35d6b116b0db618836b47041f2ef
Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-openstack/deploys/66f5961d1a0f7f0008a7a865
Deploy Preview https://deploy-preview-2122--kubernetes-sigs-cluster-api-openstack.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

EmilienM commented 3 months ago

/hold I want to confirm we don't see the error in the logs.

EmilienM commented 3 months ago

/hold cancel I checked the logs and no more error of that type.

https://storage.googleapis.com/kubernetes-jenkins/pr-logs/pull/kubernetes-sigs_cluster-api-provider-openstack/2122/pull-cluster-api-provider-openstack-e2e-test/1800607078713135104/artifacts/clusters/bootstrap/logs/capo-system/capo-controller-manager/capo-controller-manager-7d957cb6cd-5dgc2/manager.log

jichenjc commented 3 months ago

/test pull-cluster-api-provider-openstack-e2e-test

jichenjc commented 3 months ago

/lgtm

k8s-ci-robot commented 3 months ago

New changes are detected. LGTM label has been removed.

EmilienM commented 3 months ago

@mdbooth ready for review when time permits. Maybe over-engineered but it does the job apparently. Feedback is open.