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

Syncing latest changes from upstream main for kubernetes-csi-addons #243

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Changes from all commits
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
7 changes: 4 additions & 3 deletions internal/controller/csiaddons/csiaddonsnode_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ func (r *CSIAddonsNodeReconciler) Reconcile(ctx context.Context, req ctrl.Reques
logger = logger.WithValues("NodeID", nodeID, "DriverName", driverName)

podName, endPoint, err := r.resolveEndpoint(ctx, csiAddonsNode.Spec.Driver.EndPoint)
if err != nil {
// In case of CR is marked for deletion, we dont need the connection to be established.
if err != nil && podName == "" && csiAddonsNode.DeletionTimestamp.IsZero() {
logger.Error(err, "Failed to resolve endpoint")
return ctrl.Result{}, fmt.Errorf("failed to resolve endpoint %q: %w", csiAddonsNode.Spec.Driver.EndPoint, err)
}
Expand Down Expand Up @@ -340,9 +341,9 @@ func (r *CSIAddonsNodeReconciler) resolveEndpoint(ctx context.Context, rawURL st
Name: podname,
}, pod)
if err != nil {
return "", "", fmt.Errorf("failed to get pod %s/%s: %w", namespace, podname, err)
return podname, "", fmt.Errorf("failed to get pod %s/%s: %w", namespace, podname, err)
} else if pod.Status.PodIP == "" {
return "", "", fmt.Errorf("pod %s/%s does not have an IP-address", namespace, podname)
return podname, "", fmt.Errorf("pod %s/%s does not have an IP-address", namespace, podname)
}

return podname, fmt.Sprintf("%s:%s", pod.Status.PodIP, port), nil
Expand Down
Loading