dragonflydb / dragonfly-operator

A Kubernetes operator to install and manage Dragonfly instances.
https://www.dragonflydb.io/docs/managing-dragonfly/operator/installation
Apache License 2.0
132 stars 28 forks source link

Operator does not support IPv6 first environments #192

Open tomtom5152 opened 4 months ago

tomtom5152 commented 4 months ago

I'm currently attempting to run dragonfly with operator in an IPv6 first k3s cluster (it's a complicated setup, I cluster wide IPv4 first isn't an option, and I can't seem to convince calico to use IPv4 only or IPv4 first). The ability to automatically setup a HA setup without having to worry about separate sentinels is very helpful as I would like a HA backend for services depending on redis but also cannot modify them to use the sentinel system.

It would appear that the use of Sprintf in dragonfly_instance.go is preventing the operator from connecting to the node with "too many colons in address" as documented in redis/go-redis#2467.

It would appear this would be preferable for either a headless service similar to how cockroachdb performs discovery, or the address should be parsed with net/JoinHostPort (probably in a util function because that's getting into DRY territory).

I'm happy to have a go at implementing either of these methods however before I do I wanted to get a bit of feedback about which method would be considered the best for this circumstance. Both implementations would make everything more robust, personally I'm in favour of the simpler JoinHostPort method, however it may cause issues with TLS if this is later enabled on the admin port, using DNS would prevent this being an issue, but that could also be premature optimisation.

Given this is currently stopping me deploying HA dragonfly I would like to test one of these methods soon and then submit a PR once I've deployed it internally and confirmed the stability, so early feedback is appreciated :)

Abhra303 commented 3 months ago

I am also in favour of JoinHostPort method. Feel free to experiment and submit a PR!