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

[RS-1818] Update ILM policy when warm index readonly setting changes #3336

Merged
merged 1 commit into from
Apr 30, 2024

Conversation

gantony
Copy link
Contributor

@gantony gantony commented Apr 30, 2024

Description

Further testing around #3325 showed that the operator does not update the ILM policy when the value of readOnlyAfterRollover changes.

The code responsible for updating the ILM policy only do so if there is a change warranting an update. That check does not generically compare the old policy to the new one, but instead only looks at a handful of relevant parameters and tirggers an update only when one of these relevant parameters changes. This PR adds readOnlyAfterRollover to that logic and updates the tests to cover that logic.

For PR author

  • Tests for change.
  • If changing pkg/apis/, run make gen-files
  • If changing versions, run make gen-versions

For PR reviewers

A note for code reviewers - all pull requests must have the following:

  • Milestone set according to targeted release.
  • Appropriate labels:
    • kind/bug if this is a bugfix.
    • kind/enhancement if this is a a new feature.
    • enterprise if this PR applies to Calico Enterprise only.

}

currentMaxAge := existingPolicy.Phases.Hot.Actions.Rollover.MaxAge
currentMaxSize := existingPolicy.Phases.Hot.Actions.Rollover.MaxSize
currentMinAge := existingPolicy.Phases.Delete.MinAge
return currentMaxAge, currentMaxSize, currentMinAge, nil
readOnlyAfterRollover := existingPolicy.Phases.Warm.Actions.Readonly != nil
return currentMaxAge, currentMaxSize, currentMinAge, readOnlyAfterRollover, nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know why we don't just do a rollover if anything has changed, i.e. do some sort of deep equal?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That was my thought too when I first saw this, seems like it would be a lot simpler and better long term. But a bigger change could expose me to more unforeseen issues and wanted to keep the change straightforward.

The main issue I could foresee would be sensitivity to json formatting or ordering mismatch could cause the comparison to "fail" and the policy to be continuously updated. This could be avoided with proper testing.

Would be happy to clean that up further if you think that's a good change?

@tmjd tmjd merged commit faa24b8 into tigera:release-v1.34 Apr 30, 2024
2 checks passed
gantony pushed a commit to gantony/operator that referenced this pull request May 1, 2024
…s-1.34

[RS-1818] Update ILM policy when warm index readonly setting changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants