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

Feat: Ignore revisionHistoryLimit field in StatefulSet for Prometheus, Alertmanager& ThanosRuler #5773

Merged
merged 7 commits into from
Aug 8, 2023

Conversation

Azanul
Copy link
Contributor

@Azanul Azanul commented Jul 27, 2023

Description

Fixes #5712

Type of change

What type of changes does your code introduce to the Prometheus operator? Put an x in the box that apply.

  • CHANGE (fix or feature that would cause existing functionality to not work as expected)
  • FEATURE (non-breaking change which adds functionality)
  • BUGFIX (non-breaking change which fixes an issue)
  • ENHANCEMENT (non-breaking change which improves existing functionality)
  • NONE (if none of the other choices apply. Example, tooling, build system, CI, docs, etc.)

Changelog entry

Please put a one-line changelog entry below. This will be copied to the changelog file during the release process.

Ignore updates revisionHistoryLimit field in the underlying StatefulSet allowing external services to manage revisionHistoryLimit

@Azanul Azanul requested a review from a team as a code owner July 27, 2023 10:14
@Azanul
Copy link
Contributor Author

Azanul commented Jul 27, 2023

@rouke-broersma
Copy link

My issue is with alertmanager, could you add the same for them?

@pull-request-size pull-request-size bot added size/L and removed size/M labels Jul 27, 2023
Copy link
Contributor

@simonpasquier simonpasquier left a comment

Choose a reason for hiding this comment

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

I'm not sure that we need to expose a revisionHistoryLimit field in the existing CRDs. IIUC the issue is that the Kubernetes API always returns a default value of 10 in the statefulset spec and if something/someone modifies the value then createSSetInputHash() generates a new hash value triggering a statefulset update.
I assume that if createSSetInputHash sets RevisionHistoryLimit to nil before generating the sts hash, it would solve the issue too.

@Azanul
Copy link
Contributor Author

Azanul commented Jul 27, 2023

if createSSetInputHash sets RevisionHistoryLimit to nil before generating the sts hash, it would solve the issue too.

Purposefully ignoring any changes to RevisionHistoryLimit, I think that will work.

@Azanul
Copy link
Contributor Author

Azanul commented Jul 27, 2023

@simonpasquier Why does the spec goes as an interface in Thanos createSSetInputHash?

Signed-off-by: Azanul <azanulhaque@gmail.com>
@simonpasquier
Copy link
Contributor

@simonpasquier Why does the spec goes as an interface in Thanos createSSetInputHash?

No concrete reason I believe. bd658c5#diff-c8f4eb63862907c2cd9e067b2cf70e03f4e134075bd28f507dade553850d4fa3L1627 is where we changed it for Prometheus.
And I'd even recommend to apply the same change to Thanos Ruler as it should help reducing the number of sync loops.

@Azanul
Copy link
Contributor Author

Azanul commented Jul 27, 2023

I'd even recommend to apply the same change to Thanos Ruler as it should help reducing the number of sync loops.

Shall I do it in the same PR?

@rouke-broersma
Copy link

rouke-broersma commented Jul 27, 2023

I'm not sure that we need to expose a revisionHistoryLimit field in the existing CRDs. IIUC the issue is that the Kubernetes API always returns a default value of 10 in the statefulset spec and if something/someone modifies the value then createSSetInputHash() generates a new hash value triggering a statefulset update.
I assume that if createSSetInputHash sets RevisionHistoryLimit to nil before generating the sts hash, it would solve the issue too.

I agree but note that it was your own comment that led to this solution instead of just ignoring the field 😜

#5712 (comment)

@Azanul Azanul changed the title Feat: Add revisionHistoryLimit field to the ThanosRuler CRD Feat: Ignore revisionHistoryLimit field in StatefulSet for Prometheus, Alertmanager& ThanosRuler Jul 28, 2023
@simonpasquier
Copy link
Contributor

@rouke-broersma yes I sometimes contradicts myself ;)

@Azanul
Copy link
Contributor Author

Azanul commented Aug 1, 2023

Shall I do it in the same PR?

@simonpasquier

@simonpasquier
Copy link
Contributor

@Azanul sorry for the late reply. Can you open another PR to update the Thanos Ruler's createSSetInputHash() method? I'd prefer to merge it first then you can rebase this PR...

Copy link
Contributor

@simonpasquier simonpasquier left a comment

Choose a reason for hiding this comment

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

can you do the same change here?

@Azanul
Copy link
Contributor Author

Azanul commented Aug 1, 2023

@Azanul sorry for the late reply. Can you open another PR to update the Thanos Ruler's createSSetInputHash() method? I'd prefer to merge it first then you can rebase this PR...

check out #5784

Co-authored-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Azanul <azanulhaque@gmail.com>
pkg/prometheus/agent/operator.go Outdated Show resolved Hide resolved
pkg/prometheus/server/operator.go Outdated Show resolved Hide resolved
pkg/thanos/operator.go Outdated Show resolved Hide resolved
Signed-off-by: Azanul <azanulhaque@gmail.com>
@Azanul
Copy link
Contributor Author

Azanul commented Aug 8, 2023

@simonpasquier You didn't really have to point out comment's every instance, I'd have fixed it before re-requesting review 😅

Copy link
Contributor

@simonpasquier simonpasquier left a comment

Choose a reason for hiding this comment

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

Thanks!

@simonpasquier simonpasquier enabled auto-merge (squash) August 8, 2023 12:09
@simonpasquier simonpasquier merged commit 4e37c62 into prometheus-operator:main Aug 8, 2023
16 checks passed
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.

AlertManager Continuous reconcile loop when setting revision history limit
4 participants