Skip to content

fix(config_wrapper): apply instance_enable_ipv6 from common to all components #18254

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
9 changes: 9 additions & 0 deletions pkg/loki/config_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ func applyConfigToRings(r, defaults *ConfigWrapper, rc lokiring.RingConfig, merg
r.Ingester.LifecyclerConfig.Zone = rc.InstanceZone
r.Ingester.LifecyclerConfig.ListenPort = rc.ListenPort
r.Ingester.LifecyclerConfig.ObservePeriod = rc.ObservePeriod
r.Ingester.LifecyclerConfig.EnableInet6 = rc.EnableIPv6
r.Ingester.KafkaIngestion.PartitionRingConfig.KVStore = rc.KVStore
}

Expand All @@ -260,6 +261,7 @@ func applyConfigToRings(r, defaults *ConfigWrapper, rc lokiring.RingConfig, merg
r.Pattern.LifecyclerConfig.Zone = rc.InstanceZone
r.Pattern.LifecyclerConfig.ListenPort = rc.ListenPort
r.Pattern.LifecyclerConfig.ObservePeriod = rc.ObservePeriod
r.Pattern.LifecyclerConfig.EnableInet6 = rc.EnableIPv6
}

// IngestLimits
Expand All @@ -276,6 +278,7 @@ func applyConfigToRings(r, defaults *ConfigWrapper, rc lokiring.RingConfig, merg
r.IngestLimits.LifecyclerConfig.Zone = rc.InstanceZone
r.IngestLimits.LifecyclerConfig.ListenPort = rc.ListenPort
r.IngestLimits.LifecyclerConfig.ObservePeriod = rc.ObservePeriod
r.IngestLimits.LifecyclerConfig.EnableInet6 = rc.EnableIPv6
}

// IngestLimitsFrontend
Expand All @@ -292,6 +295,7 @@ func applyConfigToRings(r, defaults *ConfigWrapper, rc lokiring.RingConfig, merg
r.IngestLimitsFrontend.LifecyclerConfig.Zone = rc.InstanceZone
r.IngestLimitsFrontend.LifecyclerConfig.ListenPort = rc.ListenPort
r.IngestLimitsFrontend.LifecyclerConfig.ObservePeriod = rc.ObservePeriod
r.IngestLimitsFrontend.LifecyclerConfig.EnableInet6 = rc.EnableIPv6
}

// Distributor
Expand All @@ -303,6 +307,7 @@ func applyConfigToRings(r, defaults *ConfigWrapper, rc lokiring.RingConfig, merg
r.Distributor.DistributorRing.InstanceID = rc.InstanceID
r.Distributor.DistributorRing.InstanceInterfaceNames = rc.InstanceInterfaceNames
r.Distributor.DistributorRing.KVStore = rc.KVStore
r.Distributor.DistributorRing.EnableIPv6 = rc.EnableIPv6
}

// Ruler
Expand All @@ -314,6 +319,7 @@ func applyConfigToRings(r, defaults *ConfigWrapper, rc lokiring.RingConfig, merg
r.Ruler.Ring.InstanceID = rc.InstanceID
r.Ruler.Ring.InstanceInterfaceNames = rc.InstanceInterfaceNames
r.Ruler.Ring.KVStore = rc.KVStore
r.Ruler.Ring.EnableIPv6 = rc.EnableIPv6
}

// Query Scheduler
Expand All @@ -327,6 +333,7 @@ func applyConfigToRings(r, defaults *ConfigWrapper, rc lokiring.RingConfig, merg
r.QueryScheduler.SchedulerRing.InstanceZone = rc.InstanceZone
r.QueryScheduler.SchedulerRing.ZoneAwarenessEnabled = rc.ZoneAwarenessEnabled
r.QueryScheduler.SchedulerRing.KVStore = rc.KVStore
r.QueryScheduler.SchedulerRing.EnableIPv6 = rc.EnableIPv6
}

// Compactor
Expand All @@ -340,6 +347,7 @@ func applyConfigToRings(r, defaults *ConfigWrapper, rc lokiring.RingConfig, merg
r.CompactorConfig.CompactorRing.InstanceZone = rc.InstanceZone
r.CompactorConfig.CompactorRing.ZoneAwarenessEnabled = rc.ZoneAwarenessEnabled
r.CompactorConfig.CompactorRing.KVStore = rc.KVStore
r.CompactorConfig.CompactorRing.EnableIPv6 = rc.EnableIPv6
}

// IndexGateway
Expand All @@ -353,6 +361,7 @@ func applyConfigToRings(r, defaults *ConfigWrapper, rc lokiring.RingConfig, merg
r.IndexGateway.Ring.InstanceZone = rc.InstanceZone
r.IndexGateway.Ring.ZoneAwarenessEnabled = rc.ZoneAwarenessEnabled
r.IndexGateway.Ring.KVStore = rc.KVStore
r.IndexGateway.Ring.EnableIPv6 = rc.EnableIPv6
}
}

Expand Down
18 changes: 18 additions & 0 deletions pkg/loki/config_wrapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2297,6 +2297,24 @@ common:
assert.Equal(t, []string{"ringsshouldntusethis"}, config.Frontend.FrontendV2.InfNames) // not a ring.
assert.Equal(t, []string{"ringsshouldusethis"}, config.CompactorConfig.CompactorRing.InstanceInterfaceNames)
})

t.Run("enable_ipv6 setting is propagated from common ring to all component rings", func(t *testing.T) {
yamlContent := `common:
ring:
instance_enable_ipv6: true`

config, _, err := configWrapperFromYAML(t, yamlContent, nil)
assert.NoError(t, err)
assert.True(t, config.Distributor.DistributorRing.EnableIPv6)
assert.True(t, config.Ingester.LifecyclerConfig.EnableInet6)
assert.True(t, config.IngestLimits.LifecyclerConfig.EnableInet6)
assert.True(t, config.IngestLimitsFrontend.LifecyclerConfig.EnableInet6)
assert.True(t, config.Ruler.Ring.EnableIPv6)
assert.True(t, config.QueryScheduler.SchedulerRing.EnableIPv6)
assert.True(t, config.CompactorConfig.CompactorRing.EnableIPv6)
assert.True(t, config.IndexGateway.Ring.EnableIPv6)
assert.True(t, config.Pattern.LifecyclerConfig.EnableInet6)
})
}

func TestNamedStores_applyDefaults(t *testing.T) {
Expand Down
Loading