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

loki: Fix common config net interface name overwritten by ring common config #5888

Merged
merged 1 commit into from
Apr 13, 2022

Conversation

Papawy
Copy link
Contributor

@Papawy Papawy commented Apr 12, 2022

What this PR does / why we need it:
In the case where instance_interface_names is declared in the common
configuration AND the common ring configuration is also present,
instance_interface_names from common configuration is overwritten by
default ring configuration for all ring components.

This behavior is not the one described in documentation.

This commit fix this issue by overwriting common ring net interface
config IF it is deeply equal to the default one.

Example:

common:
  instance_interface_names:
  - interface
  ring:
    kvstore:
      store: inmemory

Then (example with Distributor configuration),

Distributor.DistributorRing.InstanceInterfaceNames == defaults.Common.Ring.InstanceInterfaceNames

but should be

Distributor.DistributorRing.InstanceInterfaceNames == []string{"interface"}

Which issue(s) this PR fixes:
None.

Special notes for your reviewer:

Checklist

  • Documentation added
  • Tests updated
  • Add an entry in the CHANGELOG.md about the changes.

@Papawy Papawy requested a review from a team as a code owner April 12, 2022 13:36
@DylanGuedes
Copy link
Contributor

Hey thanks for catching this, we noticed that this also happened for the replication factor so we're fixing this for the replication factor on another PR.

r.Distributor.DistributorRing.InstanceAddr = r.Common.InstanceAddr
r.Ruler.Ring.InstanceAddr = r.Common.InstanceAddr
r.QueryScheduler.SchedulerRing.InstanceAddr = r.Common.InstanceAddr
if reflect.DeepEqual(r.Common.Ring.InstanceAddr, defaults.Common.Ring.InstanceAddr) {
Copy link
Contributor

Choose a reason for hiding this comment

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

hey this was really smart 😄

… config

In the case where `instance_interface_names` is declared in the common
configuration AND the common ring configuration is also present,
`instance_interface_names` from common configuration is overwritten by
default ring configuration for all ring components.

This commit fix this issue by overwriting common ring net interface
config IF it is deeply equal to the default one.

Example:

```
common:
  instance_interface_names:
  - interface
  ring:
    kvstore:
      store: inmemory
```

Then,
```
Distributor.DistributorRing.InstanceInterfaceNames ==
defaults.Common.Ring.InstanceInterfaceNames
```

but should be

```
Distributor.DistributorRing.InstanceInterfaceNames == []string{"interface"}
```
@Papawy Papawy force-pushed the fix-common-config-if-overwritten branch from 4fc174c to 3dd80cc Compare April 12, 2022 13:48
@CLAassistant
Copy link

CLAassistant commented Apr 12, 2022

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@kavirajk kavirajk left a comment

Choose a reason for hiding this comment

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

LGMT 👍

@kavirajk kavirajk merged commit e5ed157 into grafana:main Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants