K8SPSMDB-1572: Add revisionHistoryLimit option to PerconaServerMongoDB CRD#2219
K8SPSMDB-1572: Add revisionHistoryLimit option to PerconaServerMongoDB CRD#2219myJamong wants to merge 3 commits intopercona:mainfrom
Conversation
This allows users to control the number of ControllerRevision objects retained for StatefulSets managed by the operator. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
|
deploy/bundle.yaml
Outdated
| @@ -1,3 +1,4 @@ | |||
| # Warning: 'patchesStrategicMerge' is deprecated. Please use 'patches' instead. Run 'kustomize edit fix' to update your Kustomization automatically. | |||
There was a problem hiding this comment.
not sure if we should have this warning in CRD
pkg/psmdb/mongos.go
Outdated
| UpdateStrategy: updateStrategy, | ||
| Template: template, | ||
| UpdateStrategy: updateStrategy, | ||
| RevisionHistoryLimit: cr.Spec.RevisionHistoryLimit, |
There was a problem hiding this comment.
we need to add this field with version check to prevent unexpected restarts after operator upgrade. you can check cr.CompareVersion for examples. this will go into v1.23, so we need to check for "1.23.0"
There was a problem hiding this comment.
I added some changes and added a cr.CompareVersion logic to check for 1.23.0.
Thanks for your guide.
commit: b910275
pkg/psmdb/statefulset.go
Outdated
| }, | ||
| }, | ||
| UpdateStrategy: updateStrategy, | ||
| RevisionHistoryLimit: cr.Spec.RevisionHistoryLimit, |
There was a problem hiding this comment.
we need cr version check here as well
|
Hi @egegunes |
|
@myJamong no, they are not related to your changes. |
commit: 2808255 |
Due to the high volume of requests, we're unable to provide free service for this account. To continue using the service, please upgarde to a paid plan.
This allows users to control the number of ControllerRevision objects retained for StatefulSets managed by the operator.
CHANGE DESCRIPTION
Problem:
When StatefulSets are updated, Kubernetes creates ControllerRevision objects to track revision history. Without a limit, these objects accumulate indefinitely, cluttering the cluster
and making it harder to manage resources.
Cause:
The operator does not expose the
revisionHistoryLimitfield from StatefulSet spec, so users cannot control how many ControllerRevision objects are retained.Solution:
Add
revisionHistoryLimitoption to PerconaServerMongoDB CRD spec. This value is propagated to all StatefulSets (replsets and mongos) managed by the operator, allowing users to limitthe number of retained ControllerRevision objects.
CHECKLIST
Jira
Needs Doc) and QA (Needs QA)?Tests
compare/*-oc.yml)?Config/Logging/Testability