Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added autodetect of interfaces on private networks #893

Closed
wants to merge 169 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
169 commits
Select commit Hold shift + click to select a range
48bc7ae
added autodetect of interfaces on private networks
aldernero Jan 26, 2022
6a616ce
Remove sharding strategy from store-gateway. (#891)
pstibrany Jan 26, 2022
5c24428
Fix TestBlocksCleaner_ShouldRemoveBlocksOutsideRetentionPeriod flakyn…
pracucci Jan 26, 2022
d290d3a
Remove -ruler.sharding-strategy from ruler. (#889)
pstibrany Jan 26, 2022
32843e5
Remove distributor.sharding-strategy option. (#888)
pstibrany Jan 26, 2022
f301cab
Rename default image config field from 'cortex' to 'mimir' (#896)
pracucci Jan 26, 2022
e4ac570
Rename entrypoint jsonnet from cortex.libsonnet to mimir.libsonnet (#…
pracucci Jan 26, 2022
7f776cc
Removed prefix at all (#898)
pracucci Jan 26, 2022
af3a3b5
Populate maintainers list (#792)
replay Jan 26, 2022
d96dac8
Mimir: Refactor test code to use t.TempDir (#900)
aknuds1 Jan 26, 2022
91f04d2
Rename the default overrides mountpoint from /etc/cortex to /etc/mimi…
pracucci Jan 26, 2022
469934e
Change default `server.http-listen-port` to 8080 (#871)
dimitarvdimitrov Jan 26, 2022
cad5243
Add shuffle-sharding support to jsonnet (#902)
pracucci Jan 26, 2022
34cae90
Upstream jsonnet config used at Grafana Labs (#905)
pracucci Jan 26, 2022
37e3816
Change the default of ignore_deletion_mark_delay to 1h (#892)
andyasp Jan 26, 2022
f2ca89c
Implement configuration parameter categorization (#840)
aknuds1 Jan 27, 2022
f88f9d6
Dynamically compute -compactor.deletion-delay setting in jsonnet (#907)
pracucci Jan 27, 2022
7f0f268
Fix jsonnet after PRs 892 and 907 (#908)
pracucci Jan 27, 2022
7edb67d
Set server port when mimir image is overridden (#915)
dimitarvdimitrov Jan 27, 2022
f779130
Ignore Vim swap files (#923)
RichiH Jan 27, 2022
b9dc577
Enable resources dashboards by default (#920)
pracucci Jan 27, 2022
f5781b4
Mimir: Tweak -help-all flag description (#914)
aknuds1 Jan 27, 2022
7a4c334
Mimir: Tweak help output (#917)
aknuds1 Jan 27, 2022
b2ee51c
Added 'mimir' to default job names in the mixin (#921)
pracucci Jan 27, 2022
9ab387c
Fix code of conduct (#922)
RichiH Jan 27, 2022
3ad728f
Add tool for analyse query step alignmnet (#392)
simonswine Jan 27, 2022
559f96d
Mimir: Don't unquote usage in help output (#919)
aknuds1 Jan 27, 2022
f5633f2
Fix 'make docs' to show doc compilation errors (#926)
pracucci Jan 28, 2022
f2bae6a
Update dskit (#935)
pstibrany Jan 28, 2022
208782a
Remove storage engine from bug report template (#940)
pracucci Jan 28, 2022
291bbe4
Replce cortex with mimir in mimirtool (#883)
dimitarvdimitrov Jan 28, 2022
d0f904d
Classify ingester flags (#942)
simonswine Jan 28, 2022
e787f47
Remove -querier.at-modifier-enabled and enable it by default (#941)
pracucci Jan 28, 2022
6047d69
Chore: Move index and bucket cache to dedicated packages (#890)
pracucci Jan 28, 2022
ebd461e
flusher: Tag advanced config parameters (#950)
aknuds1 Jan 28, 2022
d6cc594
update vendored mimir-prometheus (#932)
replay Jan 28, 2022
25ad3d0
Push images to docker hub (#946)
simonswine Jan 28, 2022
76da7c6
distributor: Tag advanced config parameters (#948)
aknuds1 Jan 28, 2022
e81c339
compactor: Tag advanced config parameters (#947)
aknuds1 Jan 28, 2022
64713e0
Build mimirtool binaries for different architectures (#884)
simonswine Jan 28, 2022
3142120
frontend: Tag advanced config parameters (#949)
aknuds1 Jan 28, 2022
a5c5158
distributor: Make MaxIngestionRate and MaxInflightPushRequests basic …
aknuds1 Jan 28, 2022
679e14e
Docs: Write Getting started with Mimir guide (#877)
jdbaldry Jan 28, 2022
6166796
Set `ruler.alertmanager-use-v2` default to `true` (#954)
dimitarvdimitrov Jan 28, 2022
bc66a33
Expose `listblocks` as store-gateway http endpoint (#911)
colega Jan 28, 2022
ef835a9
Change default settings for memcached client (#959)
pracucci Jan 31, 2022
e4f0e09
Removed -querier.worker-match-max-concurrent and -querier.worker-para…
pracucci Jan 31, 2022
775097d
Removed `-compactor.sharding-enabled`, changed default backend for c…
pstibrany Jan 31, 2022
ddb0e68
Removed -ruler.enable-sharding and made memberlist the default value …
pstibrany Jan 31, 2022
0fde0fa
Change default of distributor max-inflight-push-requests to 2000 (#964)
dimitarvdimitrov Jan 31, 2022
1788e41
Use sentence case in dashboards (#944)
pracucci Jan 31, 2022
0cdd91f
Categorize TLS configuration parameters as advanced (#972)
aknuds1 Jan 31, 2022
f2109c3
Change default value of -distributor.remote-timeout from 2s to 20s (#…
pracucci Jan 31, 2022
3e4e533
Upgrade to latest dskit (#974)
aknuds1 Jan 31, 2022
0afeb6e
Ensure a latest docker tag is pushed when on latest git tag (#975)
simonswine Jan 31, 2022
599c6d4
Make env var prefix configurable in mimirtool (#945)
dimitarvdimitrov Jan 31, 2022
30d8407
Fix links in store-gateway list blocks page (#973)
colega Jan 31, 2022
844dc6d
Docs/auto assign pr only to project (#978)
tolzhabayev Feb 1, 2022
1dd5a34
Document dashboards and alerts offered by the mixin (#925)
pracucci Feb 1, 2022
73b94ed
Vendor latest dskit with ingester flag changes (#981)
dimitarvdimitrov Feb 1, 2022
78275bf
Remove `-alertmanager.configs.auto-webhook-root` (#977)
Logiraptor Feb 1, 2022
f672f96
Refresh experimental features (#913)
pracucci Feb 1, 2022
f99dcea
Update shuffle sharding documentation. (#903)
pstibrany Feb 1, 2022
56dccbf
Removed optional sharding from store gateway. (#976)
pstibrany Feb 1, 2022
3da17b6
Changed -querier.query-ingesters-within and -blocks-storage.tsdb.clos…
pracucci Feb 1, 2022
d47c230
Fix query sharding jsonnet if queriers are autoscaling (#988)
pracucci Feb 1, 2022
bee4cb0
Categorize advanced api parameters (#986)
Logiraptor Feb 1, 2022
744b75d
Move YAML out of website sources (#982)
jdbaldry Feb 1, 2022
2a8e3ab
Categorize alertmanager.* parameters (#984)
Logiraptor Feb 1, 2022
0210659
Wait for ruler ring client to self-detect during startup (#990)
pracucci Feb 1, 2022
6c7863a
Remove `api.response_compression_enabled` flag (#880)
ortuman Feb 1, 2022
d867e99
Categorize storage-related parameters (#985)
Logiraptor Feb 1, 2022
1135cb1
Add integration test that validates dev.yaml configuration (#979)
jdbaldry Feb 1, 2022
0574908
Categorize blocks_storage related parameters (#994)
Logiraptor Feb 2, 2022
f86fc35
Renamed distributorConfig jsonnet config to ingesterRingClientConfig …
pracucci Feb 2, 2022
8cc7468
queier_test: be more specific with assertion (#998)
krajorama Feb 2, 2022
b8f67f4
Docs: Provide OS and architecture specific binary download instructio…
jdbaldry Feb 2, 2022
80d849a
Mark querier tenant federation as stable (#1002)
pracucci Feb 2, 2022
431065b
Mention activity tracker in playbooks. (#1005)
pstibrany Feb 2, 2022
af1f249
Change memcached client default timeout setting (#1000)
ortuman Feb 2, 2022
f4a866e
Re-order documentation for an "Operating Grafana Mimir" section (#1010)
jdbaldry Feb 3, 2022
91b235e
Added querier autoscaling panels and alerts to mixin (#1006)
pracucci Feb 3, 2022
95a9a06
Remove obsolete information to eliminate confusion. (#1011)
osg-grafana Feb 3, 2022
1f504dc
Fix autoscaling dashboard (#1016)
pracucci Feb 3, 2022
0080ea8
Re-order architectural documentation (#1007)
jdbaldry Feb 3, 2022
491a2fc
operations: Remove gossip_ring_member selector from services (#1008)
aknuds1 Feb 3, 2022
b1082f3
Tenant federation implementation of exemplar query interfaces (#927)
56quarters Feb 3, 2022
e4a4cef
Add Grafana Labs SECURITY.md (#1019)
RichiH Feb 3, 2022
0e2ef9b
Krajo/blocks store graceful query errorhandling (#1003)
krajorama Feb 3, 2022
bc4b8e9
Explicitly set SHELL to bash as the Makefile recipes are not written …
jdbaldry Feb 3, 2022
37cc738
Move tools into a tools subdirectory. (#1030)
osg-grafana Feb 4, 2022
8e2b2e5
Add "About Grafana Mimir tools" index page (#1031)
jdbaldry Feb 4, 2022
64a1235
Docs: Add section on configuration parameter categories (#938)
aknuds1 Feb 4, 2022
3ae9013
Move mimirtool README into technical documentation (#1032)
jdbaldry Feb 4, 2022
ec0b1c3
Global markers bucket now deletes both markers, and only reports "Exi…
pstibrany Feb 4, 2022
2bd377e
Docs: Add documentation for auth-injector, compaction-planner and lis…
pstibrany Feb 4, 2022
f6369f8
docs: Rename from configuration parameter lifecycle to categories (#1…
aknuds1 Feb 4, 2022
e020e13
Fix rendering of sections (#1039)
jdbaldry Feb 4, 2022
952e248
Remove tools/LICENSE, add license and provenance headers where needed…
pstibrany Feb 4, 2022
8665be9
Add docs for TSDB tools. (#1038)
pstibrany Feb 4, 2022
8b7f340
Move remaining tools docs to correct location. (#1045)
pstibrany Feb 4, 2022
a9dcbb2
Simplify alertmanager discovery (#993)
dimitarvdimitrov Feb 4, 2022
27492b3
Replace cortex with mimir in mimirtool help texts and errors (#983)
dimitarvdimitrov Feb 4, 2022
5bcdd60
Categorize advanced ruler configuration parameters (#1026)
andyasp Feb 4, 2022
3302af4
Docs: add Mimir dashboards example screenshots to doc (#992)
pracucci Feb 7, 2022
d9428fc
Docs: Update the templated configuration prose (#1027)
KMiller-Grafana Feb 7, 2022
75693e2
Add stub pages for hash ring and key-value store (#1037)
jdbaldry Feb 7, 2022
bb843d6
Enable bucket index by default (#924)
andyasp Feb 7, 2022
cf83787
Add metrics to ruler and create ruleMetrics struct (#906)
grobinson-grafana Feb 7, 2022
84cb23d
Setup multikv runtime config in all ring configs. (#1047)
pstibrany Feb 7, 2022
3a215e1
Docs: Rename directory to match _index title slug (#1054)
jdbaldry Feb 7, 2022
b4cf398
Change default KV store for ingesters and distributors to be memberli…
pstibrany Feb 7, 2022
4632837
Make overrides-exporter work even if runtime config is not set (#1056)
pracucci Feb 7, 2022
3df790a
Alertmanager: Remove ability to run without clustering. (#1044)
stevesg Feb 7, 2022
c52aa99
Makefile: skip mimir-mixin-tools Dockerfile (#1060)
pracucci Feb 7, 2022
c686755
Fix mimir-mixin-tools/screenshots/Dockerfile (#1061)
pracucci Feb 7, 2022
01ae728
Rename auth-injector to tenant-injector. (#1062)
pstibrany Feb 7, 2022
077a992
Do not log 'unable to read rules directory' at startup if directory h…
pracucci Feb 7, 2022
fe7fe60
Fixed Alertmanager dashboard when alertmanager is running as part of …
pracucci Feb 7, 2022
2db99f2
Enable ruler and alertmanager API by default (#1065)
pracucci Feb 7, 2022
43262b8
Changed -alertmanager.web.external-url default (#1067)
pracucci Feb 8, 2022
54f3e84
Cleanup ringConfig and fix gossip.libsonnet to modify all rings. (#1057)
pstibrany Feb 8, 2022
50ceeb7
Fix rendering of table of contents using the local web server (#1043)
jdbaldry Feb 8, 2022
96c0775
Docs: change parameter delimiter to parentheses (#1068)
KMiller-Grafana Feb 8, 2022
d17bba6
Docs: Re-order migrating from Prometheus or Thanos documentation (#1053)
jdbaldry Feb 8, 2022
a6504ef
Run make build-jsonnet-tests (#1077)
jdbaldry Feb 8, 2022
5a06393
Rename "fake" tenant that is used with no auth to "anonymous", and ma…
pstibrany Feb 8, 2022
79f1790
Re-order "Reference: HTTP API" (#1069)
jdbaldry Feb 8, 2022
a4045ec
Re-order configuration documentation (#1070)
jdbaldry Feb 8, 2022
6dd6ad3
Remove Alertmanager configuration guide (#1071)
jdbaldry Feb 8, 2022
08682ed
Fix removal of consul hostname option. (#1099)
pstibrany Feb 8, 2022
58ff956
Add Trafficdump tool (#1004)
pstibrany Feb 8, 2022
36fa2b0
Remove `ruler.alertmanager-use-v2` (#1100)
dimitarvdimitrov Feb 8, 2022
408807f
Re-order "About authentication and authorization" (#1073)
jdbaldry Feb 8, 2022
ed81b39
Re-order glossary (#1074)
jdbaldry Feb 8, 2022
7b5818a
Re-order ingester operations documentation (#1076)
jdbaldry Feb 8, 2022
3cf36f7
Alertmanager: Remove commented line from unit test. (#1122)
stevesg Feb 8, 2022
5a0c400
Change default values for local directories (#1072)
pracucci Feb 8, 2022
24faedb
Rename thanosconvert to metaconvert, simplify the tool, and fix bug w…
pstibrany Feb 8, 2022
e9d95d2
Docs: no code font for config block markdown headers (#1129)
KMiller-Grafana Feb 9, 2022
cf75315
Remove tsdb-blocks-storage-s3 flag from blocks-s3 microservice config…
Feb 9, 2022
fedd698
Docs: Incorporate parameter categories into the config reference (#1128)
KMiller-Grafana Feb 9, 2022
859fbb3
Add mimir_build_info (#1022)
andyasp Feb 9, 2022
9251587
Remove mentions of obsolete sharding-enabled flags. (#1123)
pstibrany Feb 9, 2022
790c8a9
Fill in version information (#962)
andyasp Feb 9, 2022
f6b7b47
Changed -frontend.split-queries-by-interval default from 0s to 24h (#…
pracucci Feb 9, 2022
882422d
Rename `auth_enabled` to `multitenancy_enabled` (#1130)
pstibrany Feb 9, 2022
863246f
Remove list of adopters (#1136)
pracucci Feb 9, 2022
cfa5550
Remove automation to build rpm and deb packages (#1138)
pracucci Feb 9, 2022
171d57b
Remove old website (#1135)
pracucci Feb 9, 2022
509ccbf
Removed test-exporter (#1133)
pracucci Feb 9, 2022
a0caafa
Server flags categorization (#1125)
andyasp Feb 9, 2022
dda976e
Add activity tracking to queries in ingester. (#1121)
pstibrany Feb 9, 2022
0fe836a
Add exemplars documentation (#1143)
jdbaldry Feb 9, 2022
76f5b0b
Remove cortexmetrics references (#1140)
pracucci Feb 9, 2022
7dc2ead
Add Makefile and ignore binary output. (#1146)
pstibrany Feb 9, 2022
7e0a4c4
Remove security documentation (#1118)
jdbaldry Feb 9, 2022
ee2fb84
Re-order "About tenant IDs" (#1119)
jdbaldry Feb 9, 2022
161d711
Re-order "Mirror requests to a second cluster" (#1116)
jdbaldry Feb 9, 2022
da34538
Upgrade dskit (#1152)
pracucci Feb 10, 2022
53255cd
Removed deprecated config (#1132)
pracucci Feb 10, 2022
4288152
Remove low level ingester client settings (#1153)
pracucci Feb 10, 2022
d8816b4
Remove sharded ruler documentation (#1117)
jdbaldry Feb 10, 2022
038efd1
Update mimir-prometheus to bring back old chunks mapper (without queu…
pstibrany Feb 10, 2022
6395ee0
Mark TSDB snapshot at shutdown as experimental (#1161)
pracucci Feb 10, 2022
3cb865a
Upgrade mimir-prometheus (#1162)
pracucci Feb 10, 2022
a380d30
Alertmanager: Remove upstream clustering (gossip) operation. (#1126)
stevesg Feb 10, 2022
c4716a6
added autodetect of interfaces on private networks
aldernero Jan 26, 2022
488bb65
Merge branch 'autodetect-rfc1918-interfaces' of github.com:grafana/mi…
aldernero Feb 10, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pkg/alertmanager/alertmanager_ring.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/grafana/dskit/kv"
"github.com/grafana/dskit/ring"

"github.com/grafana/mimir/pkg/util"
util_log "github.com/grafana/mimir/pkg/util/log"
)

Expand Down Expand Up @@ -88,7 +89,7 @@ func (cfg *RingConfig) RegisterFlags(f *flag.FlagSet) {
f.BoolVar(&cfg.ZoneAwarenessEnabled, rfprefix+"zone-awareness-enabled", false, "True to enable zone-awareness and replicate alerts across different availability zones.")

// Instance flags
cfg.InstanceInterfaceNames = []string{"eth0", "en0"}
cfg.InstanceInterfaceNames = util.PrivateNetworkInterfaces()
f.Var((*flagext.StringSlice)(&cfg.InstanceInterfaceNames), rfprefix+"instance-interface-names", "Name of network interface to read address from.")
f.StringVar(&cfg.InstanceAddr, rfprefix+"instance-addr", "", "IP address to advertise in the ring.")
f.IntVar(&cfg.InstancePort, rfprefix+"instance-port", 0, "Port to advertise in the ring (defaults to server.grpc-listen-port).")
Expand Down
3 changes: 2 additions & 1 deletion pkg/compactor/compactor_ring.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/grafana/dskit/kv"
"github.com/grafana/dskit/ring"

"github.com/grafana/mimir/pkg/util"
util_log "github.com/grafana/mimir/pkg/util/log"
)

Expand Down Expand Up @@ -63,7 +64,7 @@ func (cfg *RingConfig) RegisterFlags(f *flag.FlagSet) {
f.DurationVar(&cfg.WaitStabilityMaxDuration, "compactor.ring.wait-stability-max-duration", 5*time.Minute, "Maximum time to wait for ring stability at startup. If the compactor ring keeps changing after this period of time, the compactor will start anyway.")

// Instance flags
cfg.InstanceInterfaceNames = []string{"eth0", "en0"}
cfg.InstanceInterfaceNames = util.PrivateNetworkInterfaces()
f.Var((*flagext.StringSlice)(&cfg.InstanceInterfaceNames), "compactor.ring.instance-interface-names", "Name of network interface to read address from.")
f.StringVar(&cfg.InstanceAddr, "compactor.ring.instance-addr", "", "IP address to advertise in the ring.")
f.IntVar(&cfg.InstancePort, "compactor.ring.instance-port", 0, "Port to advertise in the ring (defaults to server.grpc-listen-port).")
Expand Down
3 changes: 2 additions & 1 deletion pkg/distributor/distributor_ring.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/grafana/dskit/flagext"
"github.com/grafana/dskit/kv"
"github.com/grafana/dskit/ring"
"github.com/grafana/mimir/pkg/util"

util_log "github.com/grafana/mimir/pkg/util/log"
)
Expand Down Expand Up @@ -51,7 +52,7 @@ func (cfg *RingConfig) RegisterFlags(f *flag.FlagSet) {
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).")

// Instance flags
cfg.InstanceInterfaceNames = []string{"eth0", "en0"}
cfg.InstanceInterfaceNames = util.PrivateNetworkInterfaces()
f.Var((*flagext.StringSlice)(&cfg.InstanceInterfaceNames), "distributor.ring.instance-interface-names", "Name of network interface to read address from.")
f.StringVar(&cfg.InstanceAddr, "distributor.ring.instance-addr", "", "IP address to advertise in the ring.")
f.IntVar(&cfg.InstancePort, "distributor.ring.instance-port", 0, "Port to advertise in the ring (defaults to server.grpc-listen-port).")
Expand Down
3 changes: 2 additions & 1 deletion pkg/frontend/v2/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/grafana/mimir/pkg/frontend/v2/frontendv2pb"
"github.com/grafana/mimir/pkg/querier/stats"
"github.com/grafana/mimir/pkg/tenant"
"github.com/grafana/mimir/pkg/util"
"github.com/grafana/mimir/pkg/util/httpgrpcutil"
)

Expand All @@ -52,7 +53,7 @@ func (cfg *Config) RegisterFlags(f *flag.FlagSet) {
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.")
f.IntVar(&cfg.WorkerConcurrency, "frontend.scheduler-worker-concurrency", 5, "Number of concurrent workers forwarding queries to single query-scheduler.")

cfg.InfNames = []string{"eth0", "en0"}
cfg.InfNames = util.PrivateNetworkInterfaces()
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.")
f.StringVar(&cfg.Addr, "frontend.instance-addr", "", "IP address to advertise to querier (via scheduler) (resolved via interfaces by default).")
f.IntVar(&cfg.Port, "frontend.instance-port", 0, "Port to advertise to querier (via scheduler) (defaults to server.grpc-listen-port).")
Expand Down
3 changes: 2 additions & 1 deletion pkg/ruler/ruler_ring.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/grafana/dskit/flagext"
"github.com/grafana/dskit/kv"
"github.com/grafana/dskit/ring"
"github.com/grafana/mimir/pkg/util"
)

const (
Expand Down Expand Up @@ -66,7 +67,7 @@ func (cfg *RingConfig) RegisterFlags(f *flag.FlagSet) {
f.DurationVar(&cfg.HeartbeatTimeout, "ruler.ring.heartbeat-timeout", time.Minute, "The heartbeat timeout after which rulers are considered unhealthy within the ring. 0 = never (timeout disabled).")

// Instance flags
cfg.InstanceInterfaceNames = []string{"eth0", "en0"}
cfg.InstanceInterfaceNames = util.PrivateNetworkInterfaces()
f.Var((*flagext.StringSlice)(&cfg.InstanceInterfaceNames), "ruler.ring.instance-interface-names", "Name of network interface to read address from.")
f.StringVar(&cfg.InstanceAddr, "ruler.ring.instance-addr", "", "IP address to advertise in the ring.")
f.IntVar(&cfg.InstancePort, "ruler.ring.instance-port", 0, "Port to advertise in the ring (defaults to server.grpc-listen-port).")
Expand Down
3 changes: 2 additions & 1 deletion pkg/storegateway/gateway_ring.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/grafana/dskit/flagext"
"github.com/grafana/dskit/kv"
"github.com/grafana/dskit/ring"
"github.com/grafana/mimir/pkg/util"

util_log "github.com/grafana/mimir/pkg/util/log"
)
Expand Down Expand Up @@ -109,7 +110,7 @@ func (cfg *RingConfig) RegisterFlags(f *flag.FlagSet) {
f.DurationVar(&cfg.WaitStabilityMaxDuration, ringFlagsPrefix+"wait-stability-max-duration", 5*time.Minute, "Maximum time to wait for ring stability at startup. If the store-gateway ring keeps changing after this period of time, the store-gateway will start anyway.")

// Instance flags
cfg.InstanceInterfaceNames = []string{"eth0", "en0"}
cfg.InstanceInterfaceNames = util.PrivateNetworkInterfaces()
f.Var((*flagext.StringSlice)(&cfg.InstanceInterfaceNames), ringFlagsPrefix+"instance-interface-names", "Name of network interface to read address from.")
f.StringVar(&cfg.InstanceAddr, ringFlagsPrefix+"instance-addr", "", "IP address to advertise in the ring.")
f.IntVar(&cfg.InstancePort, ringFlagsPrefix+"instance-port", 0, "Port to advertise in the ring (defaults to server.grpc-listen-port).")
Expand Down
33 changes: 33 additions & 0 deletions pkg/util/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,36 @@ func filterIPs(addrs []net.Addr) string {
}
return ipAddr
}

// Parses network interfaces and returns those having an address conformant to RFC1918
func PrivateNetworkInterfaces() []string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you feel about putting this into dskit so other project can reuse the function?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I started a PR like this a while ago, but forgot about it: grafana/dskit#100

var privInts []string
ints, err := net.Interfaces()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would move the logic to a private function that takes the list of interfaces in input, so that you can test it. My comment is about adding unit tests to this function :)

if err != nil {
level.Warn(util_log.Logger).Log("msg", "error getting interfaces", "err", err)
}
for _, i := range ints {
fmt.Println(i.Index, i.Name)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be removed.

addrs, err := i.Addrs()
if err != nil {
level.Warn(util_log.Logger).Log("msg", "error getting addresses", "inf", i.Name, "err", err)
}
for _, a := range addrs {
s := a.String()
ip, _, err := net.ParseCIDR(s)
if err != nil {
level.Warn(util_log.Logger).Log("msg", "error getting ip address", "inf", i.Name, "addr", s, "err", err)
}
if ip.IsPrivate() {
privInts = append(privInts, i.Name)
break
}
}
}
if len(privInts) == 0 {
level.Warn(util_log.Logger).Log("msg", "couldn't find any interfaces on private networks, defaulting to [eth0 en0]")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit dubious about this log because:

  1. It gets logged each time we call PrivateNetworkInterfaces()
  2. It gets logged even if the user overrides the config, so the result of PrivateNetworkInterfaces() doesn't really matter for them (this comment applies to other logs too)

return []string{"eth0", "en0"}
}
level.Info(util_log.Logger).Log("msg", "found interfaces on private networks:", "["+strings.Join(privInts, ", ")+"]")
return privInts
}
3 changes: 2 additions & 1 deletion vendor/github.com/grafana/dskit/ring/lifecycler.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.