From 45071dbd0527d228ee84252d46a16958ba1294cf Mon Sep 17 00:00:00 2001 From: aldernero Date: Wed, 9 Feb 2022 16:43:07 -0700 Subject: [PATCH] lifecycler uses interface autodetect --- ring/lifecycler.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ring/lifecycler.go b/ring/lifecycler.go index 68c012238..195dfe2af 100644 --- a/ring/lifecycler.go +++ b/ring/lifecycler.go @@ -19,6 +19,7 @@ import ( "github.com/grafana/dskit/flagext" "github.com/grafana/dskit/kv" + "github.com/grafana/dskit/netutil" "github.com/grafana/dskit/services" ) @@ -81,7 +82,7 @@ func (cfg *LifecyclerConfig) RegisterFlagsWithPrefix(prefix string, f *flag.Flag panic(fmt.Errorf("failed to get hostname %s", err)) } - cfg.InfNames = []string{"eth0", "en0"} + cfg.InfNames = netutil.PrivateNetworkInterfaces(log.NewLogfmtLogger(os.Stdout)) f.Var((*flagext.StringSlice)(&cfg.InfNames), prefix+"lifecycler.interface", "Name of network interface to read address from.") f.StringVar(&cfg.Addr, prefix+"lifecycler.addr", "", "IP address to advertise in the ring.") f.IntVar(&cfg.Port, prefix+"lifecycler.port", 0, "port to advertise in consul (defaults to server.grpc-listen-port).")