Skip to content

Commit

Permalink
fix(controller): ipv6 addresses were unsupported by the controller
Browse files Browse the repository at this point in the history
Signed-off-by: SKALA NETWORKS <contact@skala.network>
  • Loading branch information
SkalaNetworks committed Feb 13, 2025
1 parent 509ea1a commit c9250df
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion internal/controller/csiaddons/csiaddonsnode_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,15 @@ func (r *CSIAddonsNodeReconciler) resolveEndpoint(ctx context.Context, rawURL st
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
ip := pod.Status.PodIP

// Detect if the IP has more than one colon in it, indicating an IPv6
// We need this check to format it correctly, as we will append a port to the IP
if strings.Count(ip, ":") >= 2 {
ip = fmt.Sprintf("[%s]", ip)
}

return podname, fmt.Sprintf("%s:%s", ip, port), nil
}

// parseEndpoint returns the rawURL if it is in the legacy <IP-address>:<port>
Expand Down

0 comments on commit c9250df

Please sign in to comment.