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

Stop dropping status.FloatingID when OpenStack API returns 404 #449

Merged
merged 3 commits into from
Dec 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve error handling
Raphael Groemmer authored and Kumm-Kai committed Dec 4, 2024

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
commit 92b586b9f7bd8ee8b816e554278c68055eb000a2
Original file line number Diff line number Diff line change
@@ -42,6 +42,7 @@ import (
const (
DefaultRequeueTime = 10 * time.Millisecond
ServiceFinalizer = "yawol.stackit.cloud/controller2"
HTTP_NOT_FOUND int = 404
)

// LoadBalancerReconciler reconciles service Objects with type LoadBalancer
@@ -421,15 +422,20 @@ func (r *Reconciler) reconcileFIP(
// Get FIP
var fip *floatingips.FloatingIP
if fip, err = openstackhelper.GetFIPByID(ctx, fipClient, *lb.Status.FloatingID); err != nil {
switch err.(type) {
case gophercloud.ErrResourceNotFound:
r.Log.Info("fip not found in openstack", "fip", *lb.Status.FloatingID)
// FIP not found by ID. Unable to determine if is's due to an OpenStack API outage or a legitimate issue.
// legitimate issue.
return false, err
default:
r.Log.Info("unexpected error occurred")
return false, kubernetes.SendErrorAsEvent(r.RecorderLB, err, lb)
switch e := err.(type) {
case gophercloud.ErrUnexpectedResponseCode:
code := e.GetStatusCode()
if code == 404 {
// FIP not found by ID. Unable to determine if is's due to an OpenStack API outage or a legitimate issue.
// legitimate issue.
r.Log.Info("fip not found in openstack", "fip", *lb.Status.FloatingID)
} else {
r.Log.Info("unexpected gophercloud error occurred", "error: ", err)
}
return false, err
default:
r.Log.Info("unexpected go error occurred", "error: ", err)
return false, kubernetes.SendErrorAsEvent(r.RecorderLB, err, lb)
}
}