You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
csiaddonsnode: delete the object after max connection retries
This patch adds the functionality to retry for a maximum of
`CSIAddonsNodeConnectionMaxRetries` to connect to the sidecar.
If the connection attempt is not successful, the object is considered
obsolete and is deleted.
An in-memory retry counter is used to keep things simple and to avoid
updating the object's status/annotations.
Signed-off-by: Niraj Yadav <niryadav@redhat.com>
csiAddonsNode.Status.Message=fmt.Sprintf("Failed to establish connection with sidecar: %v", errMessage)
137
-
statusErr:=r.Status().Update(ctx, csiAddonsNode)
138
-
ifstatusErr!=nil {
139
-
logger.Error(statusErr, "Failed to update status")
150
+
// Do not spam the socket
151
+
ifi<CSIAddonsNodeConnectionMaxRetries-1 {
152
+
time.Sleep(CSIAddonsNodeConnectionSleepInterval)
153
+
}
154
+
}
140
155
141
-
return ctrl.Result{}, statusErr
156
+
// If we were still unable to connect after max retries
157
+
ifconnErr!=nil {
158
+
logger.Error(connErr, fmt.Sprintf("Failed to establish connection with sidecar after %d attempts, deleting the object", CSIAddonsNodeConnectionMaxRetries))
159
+
160
+
// We do not update the status anymore as we consider deletion
0 commit comments