Skip to content

Commit d8ed87d

Browse files
Update dskit version (#5392)
* Update dskit version Signed-off-by: Michel Hollands <[email protected]> * update changelog Signed-off-by: Michel Hollands <[email protected]> * Add debug printing to see interfaces in CI. This will be reverted Signed-off-by: Michel Hollands <[email protected]> * Add comment to remember to remove Signed-off-by: Michel Hollands <[email protected]> * Use netutil.PrivateNetworkInterfacesWithFallback for the other rings Signed-off-by: Michel Hollands <[email protected]> * Move import to place indicated by linter Signed-off-by: Michel Hollands <[email protected]> * Remove debug printing Signed-off-by: Michel Hollands <[email protected]> * Determine local interfaces in tests Signed-off-by: Michel Hollands <[email protected]> * Rearrange import to satify linter Signed-off-by: Michel Hollands <[email protected]> * Update build image in CircleCI Signed-off-by: Michel Hollands <[email protected]> * Change changelegog message to show customer visible changes Signed-off-by: Michel Hollands <[email protected]> * Add doc tag and use private network interfaces in common config Signed-off-by: Michel Hollands <[email protected]> * Add comment about filtered out non private IP addresses Signed-off-by: Michel Hollands <[email protected]> * Update the documentation of the interface names settings Signed-off-by: Michel Hollands <[email protected]>
1 parent b4bb8a1 commit d8ed87d

File tree

20 files changed

+118
-41
lines changed

20 files changed

+118
-41
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ workflows:
4040
# https://circleci.com/blog/circleci-hacks-reuse-yaml-in-your-circleci-config-with-yaml/
4141
.defaults: &defaults
4242
docker:
43-
- image: grafana/loki-build-image:0.13.0
43+
- image: grafana/loki-build-image:0.19.0
4444
working_directory: /src/loki
4545

4646
jobs:

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## Main
22

3+
* [5392](https://github.com/grafana/loki/pull/5392) **MichelHollands**: Etcd credentials are parsed as secrets instead of plain text now.
34
* [5361](https://github.com/grafana/loki/pull/5361) **ctovena**: Add usage report to grafana.com.
45
* [5289](https://github.com/grafana/loki/pull/5289) **ctovena**: Fix deduplication bug in queries when mutating labels.
56
* [5302](https://github.com/grafana/loki/pull/5302) **MasslessParticle** Update azure blobstore client to use new sdk.

docs/sources/configuration/_index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ ring:
704704

705705
# Name of network interface to read addresses from.
706706
# CLI flag: -<prefix>.instance-interface-names
707-
[instance_interface_names: <list of string> | default = [eth0 en0]]
707+
[instance_interface_names: <list of string> | default = [<private network interfaces>]]
708708

709709
# The number of tokens the lifecycler will generate and put into the ring if
710710
# it joined without transferring tokens from another lifecycler.
@@ -1079,7 +1079,7 @@ lifecycler:
10791079
# CLI flag: -ingester.lifecycler.interface
10801080
interface_names:
10811081
1082-
- [<string> ... | default = ["eth0", "en0"]]
1082+
- [<string> ... | default = [<private network interfaces>]]
10831083
10841084
# Duration to sleep before exiting to ensure metrics are scraped.
10851085
# CLI flag: -ingester.final-sleep
@@ -2483,7 +2483,7 @@ This way, one doesn't have to replicate configuration in multiple places.
24832483
# If "instance_interface_names" under the common ring section is configured,
24842484
# this common "instance_interface_names" is only applied to the frontend, but not for
24852485
# ring related components (ex: distributor, ruler, etc).
2486-
[instance_interface_names: <list of string>]
2486+
[instance_interface_names: <list of string> | default = [<private network interfaces>]]
24872487
24882488
# A common address used by Loki components to advertise their address.
24892489
# If a more specific "instance_addr" is set, this is ignored.
@@ -2609,7 +2609,7 @@ kvstore:
26092609
26102610
# Name of network interface to read addresses from.
26112611
# CLI flag: -<prefix>.instance-interface-names
2612-
[instance_interface_names: <list of string> | default = [eth0 en0]]
2612+
[instance_interface_names: <list of string> | default = [<private network interfaces>]]
26132613
26142614
# IP address to advertise in the ring.
26152615
# CLI flag: -<prefix>.instance-addr

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ require (
4242
github.com/google/go-cmp v0.5.6
4343
github.com/gorilla/mux v1.8.0
4444
github.com/gorilla/websocket v1.4.2
45-
github.com/grafana/dskit v0.0.0-20220209070952-ea22a8f662d0
45+
github.com/grafana/dskit v0.0.0-20220211095946-19921f863583
4646
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
4747
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645
4848
github.com/hashicorp/consul/api v1.12.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,8 +1032,8 @@ github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0U
10321032
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
10331033
github.com/gotestyourself/gotestyourself v2.2.0+incompatible/go.mod h1:zZKM6oeNM8k+FRljX1mnzVYeS8wiGgQyvST1/GafPbY=
10341034
github.com/grafana/dskit v0.0.0-20211021180445-3bd016e9d7f1/go.mod h1:uPG2nyK4CtgNDmWv7qyzYcdI+S90kHHRWvHnBtEMBXM=
1035-
github.com/grafana/dskit v0.0.0-20220209070952-ea22a8f662d0 h1:R0Pw7VjouhYSS7bsMdxEidcJbCq1KUBCzPgsh7805NM=
1036-
github.com/grafana/dskit v0.0.0-20220209070952-ea22a8f662d0/go.mod h1:Q9WmQ9cVkrHx6g4KSl6TN+N3vEOkDZd9RtyXCHd5OPQ=
1035+
github.com/grafana/dskit v0.0.0-20220211095946-19921f863583 h1:UCLVGNJptATClAs4CbClVmn5b4YA6GTG3yoCObI//0E=
1036+
github.com/grafana/dskit v0.0.0-20220211095946-19921f863583/go.mod h1:q51XdMLLHNZJSG6KOGujC20ed2OoLFdx0hBmOEVfRs0=
10371037
github.com/grafana/go-gelf v0.0.0-20211112153804-126646b86de8 h1:aEOagXOTqtN9gd4jiDuP/5a81HdoJBqkVfn8WaxbsK4=
10381038
github.com/grafana/go-gelf v0.0.0-20211112153804-126646b86de8/go.mod h1:QAvS2C7TtQRhhv9Uf/sxD+BUhpkrPFm5jK/9MzUiDCY=
10391039
github.com/grafana/gocql v0.0.0-20200605141915-ba5dc39ece85 h1:xLuzPoOzdfNb/RF/IENCw+oLVdZB4G21VPhkHBgwSHY=

pkg/distributor/distributor_ring.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"github.com/go-kit/log/level"
99
"github.com/grafana/dskit/flagext"
1010
"github.com/grafana/dskit/kv"
11+
"github.com/grafana/dskit/netutil"
1112
"github.com/grafana/dskit/ring"
1213

1314
util_log "github.com/grafana/loki/pkg/util/log"
@@ -24,7 +25,7 @@ type RingConfig struct {
2425

2526
// Instance details
2627
InstanceID string `yaml:"instance_id" doc:"hidden"`
27-
InstanceInterfaceNames []string `yaml:"instance_interface_names"`
28+
InstanceInterfaceNames []string `yaml:"instance_interface_names" doc:"default=[<private network interfaces>]"`
2829
InstancePort int `yaml:"instance_port" doc:"hidden"`
2930
InstanceAddr string `yaml:"instance_addr" doc:"hidden"`
3031

@@ -46,7 +47,7 @@ func (cfg *RingConfig) RegisterFlags(f *flag.FlagSet) {
4647
f.DurationVar(&cfg.HeartbeatTimeout, "distributor.ring.heartbeat-timeout", time.Minute, "The heartbeat timeout after which distributors are considered unhealthy within the ring. 0 = never (timeout disabled).")
4748

4849
// Instance flags
49-
cfg.InstanceInterfaceNames = []string{"eth0", "en0"}
50+
cfg.InstanceInterfaceNames = netutil.PrivateNetworkInterfacesWithFallback([]string{"eth0", "en0"}, util_log.Logger)
5051
f.Var((*flagext.StringSlice)(&cfg.InstanceInterfaceNames), "distributor.ring.instance-interface-names", "Name of network interface to read address from.")
5152
f.StringVar(&cfg.InstanceAddr, "distributor.ring.instance-addr", "", "IP address to advertise in the ring.")
5253
f.IntVar(&cfg.InstancePort, "distributor.ring.instance-port", 0, "Port to advertise in the ring (defaults to server.grpc-listen-port).")

pkg/ingester/ingester.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ type Config struct {
103103

104104
// RegisterFlags registers the flags.
105105
func (cfg *Config) RegisterFlags(f *flag.FlagSet) {
106-
cfg.LifecyclerConfig.RegisterFlags(f)
106+
cfg.LifecyclerConfig.RegisterFlags(f, util_log.Logger)
107107
cfg.WAL.RegisterFlags(f)
108108

109109
f.IntVar(&cfg.MaxTransferRetries, "ingester.max-transfer-retries", 0, "Number of times to try and transfer chunks before falling back to flushing. If set to 0 or negative value, transfers are disabled.")

pkg/loki/common/common.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@ import (
44
"flag"
55

66
"github.com/grafana/dskit/flagext"
7+
"github.com/grafana/dskit/netutil"
78

89
"github.com/grafana/loki/pkg/storage/chunk/aws"
910
"github.com/grafana/loki/pkg/storage/chunk/azure"
1011
"github.com/grafana/loki/pkg/storage/chunk/gcp"
1112
"github.com/grafana/loki/pkg/storage/chunk/hedging"
1213
"github.com/grafana/loki/pkg/storage/chunk/openstack"
1314
"github.com/grafana/loki/pkg/util"
15+
16+
util_log "github.com/grafana/loki/pkg/util/log"
1417
)
1518

1619
// Config holds common config that can be shared between multiple other config sections.
@@ -27,7 +30,8 @@ type Config struct {
2730
//
2831
// Internally, addresses will be resolved in the order that this is configured.
2932
// By default, the list of used interfaces are, in order: "eth0", "en0", and your loopback net interface (probably "lo").
30-
InstanceInterfaceNames []string `yaml:"instance_interface_names"`
33+
// If an interface does not have a private IP address it is filtered out, falling back to "eth0" and "en0" if none are left.
34+
InstanceInterfaceNames []string `yaml:"instance_interface_names" doc:"default=[<private network interfaces>]"`
3135

3236
// InstanceAddr represents a common ip used by instances to advertise their address.
3337
//
@@ -44,7 +48,7 @@ func (c *Config) RegisterFlags(_ *flag.FlagSet) {
4448
c.Ring.RegisterFlagsWithPrefix("", "collectors/", throwaway)
4549

4650
// instance related flags.
47-
c.InstanceInterfaceNames = []string{"eth0", "en0"}
51+
c.InstanceInterfaceNames = netutil.PrivateNetworkInterfacesWithFallback([]string{"eth0", "en0"}, util_log.Logger)
4852
throwaway.StringVar(&c.InstanceAddr, "common.instance-addr", "", "Default advertised address to be used by Loki components.")
4953
throwaway.Var((*flagext.StringSlice)(&c.InstanceInterfaceNames), "common.instance-interface-names", "List of network interfaces to read address from.")
5054
}

pkg/loki/config_wrapper_test.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"testing"
1111
"time"
1212

13+
"github.com/grafana/dskit/netutil"
1314
"github.com/stretchr/testify/assert"
1415
"github.com/stretchr/testify/require"
1516

@@ -22,6 +23,7 @@ import (
2223
"github.com/grafana/loki/pkg/storage/chunk/storage"
2324
"github.com/grafana/loki/pkg/util"
2425
"github.com/grafana/loki/pkg/util/cfg"
26+
util_log "github.com/grafana/loki/pkg/util/log"
2527
loki_net "github.com/grafana/loki/pkg/util/net"
2628
)
2729

@@ -1101,7 +1103,9 @@ query_scheduler:
11011103
assert.Equal(t, config.Distributor.DistributorRing.InstanceInterfaceNames, []string{"distributoriface"})
11021104
assert.Equal(t, config.QueryScheduler.SchedulerRing.InstanceInterfaceNames, []string{"scheduleriface"})
11031105
assert.Equal(t, config.Ruler.Ring.InstanceInterfaceNames, []string{"ruleriface"})
1104-
assert.Equal(t, config.Ingester.LifecyclerConfig.InfNames, []string{"eth0", "en0", defaultIface})
1106+
expectedInterfaces := netutil.PrivateNetworkInterfacesWithFallback([]string{"eth0", "en0"}, util_log.Logger)
1107+
expectedInterfaces = append(expectedInterfaces, defaultIface)
1108+
assert.Equal(t, config.Ingester.LifecyclerConfig.InfNames, expectedInterfaces)
11051109
})
11061110
}
11071111

@@ -1113,9 +1117,11 @@ func TestLoopbackAppendingToFrontendV2(t *testing.T) {
11131117
t.Run("when using common or ingester ring configs, loopback should be added to interface names", func(t *testing.T) {
11141118
config, _, err := configWrapperFromYAML(t, minimalConfig, []string{})
11151119
assert.NoError(t, err)
1116-
assert.Equal(t, []string{"eth0", "en0", defaultIface}, config.Frontend.FrontendV2.InfNames)
1117-
assert.Equal(t, []string{"eth0", "en0", defaultIface}, config.Ingester.LifecyclerConfig.InfNames)
1118-
assert.Equal(t, []string{"eth0", "en0", defaultIface}, config.Common.Ring.InstanceInterfaceNames)
1120+
expectedInterfaces := netutil.PrivateNetworkInterfacesWithFallback([]string{"eth0", "en0"}, util_log.Logger)
1121+
expectedInterfaces = append(expectedInterfaces, defaultIface)
1122+
assert.Equal(t, expectedInterfaces, config.Frontend.FrontendV2.InfNames)
1123+
assert.Equal(t, expectedInterfaces, config.Ingester.LifecyclerConfig.InfNames)
1124+
assert.Equal(t, expectedInterfaces, config.Common.Ring.InstanceInterfaceNames)
11191125
})
11201126

11211127
t.Run("loopback shouldn't be in FrontendV2 interface names if set by user", func(t *testing.T) {

pkg/lokifrontend/frontend/v2/frontend.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/go-kit/log/level"
1414
"github.com/grafana/dskit/flagext"
1515
"github.com/grafana/dskit/grpcclient"
16+
"github.com/grafana/dskit/netutil"
1617
"github.com/grafana/dskit/ring"
1718
"github.com/grafana/dskit/services"
1819
"github.com/opentracing/opentracing-go"
@@ -26,6 +27,7 @@ import (
2627
"github.com/grafana/loki/pkg/querier/stats"
2728
"github.com/grafana/loki/pkg/tenant"
2829
lokigrpc "github.com/grafana/loki/pkg/util/httpgrpc"
30+
util_log "github.com/grafana/loki/pkg/util/log"
2931
)
3032

3133
// Config for a Frontend.
@@ -48,7 +50,7 @@ func (cfg *Config) RegisterFlags(f *flag.FlagSet) {
4850
f.DurationVar(&cfg.DNSLookupPeriod, "frontend.scheduler-dns-lookup-period", 10*time.Second, "How often to resolve the scheduler-address, in order to look for new query-scheduler instances. Also used to determine how often to poll the scheduler-ring for addresses if the scheduler-ring is configured.")
4951
f.IntVar(&cfg.WorkerConcurrency, "frontend.scheduler-worker-concurrency", 5, "Number of concurrent workers forwarding queries to single query-scheduler.")
5052

51-
cfg.InfNames = []string{"eth0", "en0"}
53+
cfg.InfNames = netutil.PrivateNetworkInterfacesWithFallback([]string{"eth0", "en0"}, util_log.Logger)
5254
f.Var((*flagext.StringSlice)(&cfg.InfNames), "frontend.instance-interface-names", "Name of network interface to read address from. This address is sent to query-scheduler and querier, which uses it to send the query response back to query-frontend.")
5355
f.StringVar(&cfg.Addr, "frontend.instance-addr", "", "IP address to advertise to querier (via scheduler) (resolved via interfaces by default).")
5456
f.IntVar(&cfg.Port, "frontend.instance-port", 0, "Port to advertise to querier (via scheduler) (defaults to server.grpc-listen-port).")

0 commit comments

Comments
 (0)