openebs / mayastor

Dynamically provision Stateful Persistent Replicated Cluster-wide Fabric Volumes & Filesystems for Kubernetes that is provisioned from an optimized NVME SPDK backend data storage stack.
Apache License 2.0
729 stars 106 forks source link

Components fail to listen on IPv6 Pod IPs #1731

Open michaelbeaumont opened 3 weeks ago

michaelbeaumont commented 3 weeks ago

Describe the bug Some components directly embed the Pod IP into strings like:

- "--grpc-endpoint=$(MY_POD_IP):10199"

which results in invalid URIs like 2001::1:10199 which should be [2001::1]:10199.

I don't know of a particularly clever way of solving this, unfortunately IPv4 IPs can't be parsed inside [], maybe the host needs to be passed separately from the port and parsed into IPv4/IPv6.

To Reproduce Deploy OpenEBS on a cluster where PodIP is IPv6

Expected behavior These components should work independent of the IP family.

OS info (please complete the following information):

tiagolobocastro commented 3 weeks ago

This is rather unfortunate :(

So probably we have 2 ways here:

  1. add wrapper of SocketAddr to support IPv4 with brackets
  2. add extra optional argument for port

CC @Abhinandan-Purkait

Abhinandan-Purkait commented 2 weeks ago

@tiagolobocastro The approach 1 sounds reasonable to me.

tiagolobocastro commented 2 weeks ago

@michaelbeaumont what do you think, does 1 sound viable? Something like this: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=d7fc4a7afb0734b6a6a68a56445061c8

michaelbeaumont commented 2 weeks ago

I personally would slightly prefer separate arguments I think, just because seeing an IPv4 address inside [ ] might be confusing and seem like a mistake. I'd be curious how other rust-based projects solve this but I wasn't able to find anything. But of course whatever gets the job done IMO

tiagolobocastro commented 1 week ago

an IPv4 address inside [ ] might be confusing and seem like a mistake

It's a fair point. Alright, seems like this is the way to go then.