Skip to content

K8SPSMDB-1572: Add revisionHistoryLimit option to PerconaServerMongoDB CRD#2219

Open
myJamong wants to merge 5 commits intopercona:mainfrom
myJamong:add-revisionhistorylimit
Open

K8SPSMDB-1572: Add revisionHistoryLimit option to PerconaServerMongoDB CRD#2219
myJamong wants to merge 5 commits intopercona:mainfrom
myJamong:add-revisionhistorylimit

Conversation

@myJamong
Copy link

@myJamong myJamong commented Jan 29, 2026

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 revisionHistoryLimit field from StatefulSet spec, so users cannot control how many ControllerRevision objects are retained.

Solution:
Add revisionHistoryLimit option to PerconaServerMongoDB CRD spec. This value is propagated to all StatefulSets (replsets and mongos) managed by the operator, allowing users to limit
the number of retained ControllerRevision objects.

CHECKLIST

Jira

  • Is the Jira ticket created and referenced properly?
  • Does the Jira ticket have the proper statuses for documentation (Needs Doc) and QA (Needs QA)?
  • Does the Jira ticket link to the proper milestone (Fix Version field)?

Tests

  • Is an E2E test/test case added for the new feature/change?
  • Are unit tests added where appropriate?
  • Are OpenShift compare files changed for E2E tests (compare/*-oc.yml)?

Config/Logging/Testability

  • Are all needed new/changed options added to default YAML files?
  • Are all needed new/changed options added to the Helm Chart?
  • Did we add proper logging messages for operator actions?
  • Did we ensure compatibility with the previous version or cluster upgrade process?
  • Does the change support oldest and newest supported MongoDB version?
  • Does the change support oldest and newest supported Kubernetes version?

@CLAassistant
Copy link

CLAassistant commented Jan 29, 2026

CLA assistant check
All committers have signed the CLA.

@egegunes egegunes changed the title Add revisionHistoryLimit option to PerconaServerMongoDB CRD K8SPSMDB-1572: Add revisionHistoryLimit option to PerconaServerMongoDB CRD Feb 3, 2026
@@ -1,3 +1,4 @@
# Warning: 'patchesStrategicMerge' is deprecated. Please use 'patches' instead. Run 'kustomize edit fix' to update your Kustomization automatically.
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure if we should have this warning in CRD

Copy link
Author

@myJamong myJamong Feb 3, 2026

Choose a reason for hiding this comment

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

I removed all the comments.

commit: b910275

UpdateStrategy: updateStrategy,
Template: template,
UpdateStrategy: updateStrategy,
RevisionHistoryLimit: cr.Spec.RevisionHistoryLimit,
Copy link
Contributor

Choose a reason for hiding this comment

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

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"

Copy link
Author

@myJamong myJamong Feb 3, 2026

Choose a reason for hiding this comment

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

I added some changes and added a cr.CompareVersion logic to check for 1.23.0.
Thanks for your guide.

commit: b910275

},
},
UpdateStrategy: updateStrategy,
RevisionHistoryLimit: cr.Spec.RevisionHistoryLimit,
Copy link
Contributor

Choose a reason for hiding this comment

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

we need cr version check here as well

Copy link
Author

@myJamong myJamong Feb 3, 2026

Choose a reason for hiding this comment

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

I also changed this part.

commit: b910275

@egegunes egegunes added this to the v1.23.0 milestone Feb 3, 2026
@pull-request-size pull-request-size bot added size/M 30-99 lines and removed size/S 10-29 lines labels Feb 3, 2026
@myJamong myJamong requested a review from egegunes February 3, 2026 23:29
@myJamong
Copy link
Author

myJamong commented Feb 9, 2026

Hi @egegunes
I've been looking into the CI failures, but they don't seem to be caused by my changes.
I could be wrong though — is there anything I might have missed or should fix on my end?

@egegunes
Copy link
Contributor

egegunes commented Feb 9, 2026

@myJamong no, they are not related to your changes.

myJamong and others added 2 commits March 7, 2026 10:30
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>
@myJamong myJamong force-pushed the add-revisionhistorylimit branch from 2808255 to 6edbacf Compare March 7, 2026 01:31
@myJamong
Copy link
Author

myJamong commented Mar 7, 2026

My previous commits were authored with my company email by mistake, so I wasn't able to sign the CLA. I've updated the commit author to my personal GitHub account(myJamong) and force-pushed. The CLA should be resolved now.

@JNKPercona
Copy link
Collaborator

Test Name Result Time
arbiter passed 00:12:18
balancer failure 00:20:27
cross-site-sharded passed 00:23:46
custom-replset-name passed 00:10:50
custom-tls passed 00:22:29
custom-users-roles passed 00:10:23
custom-users-roles-sharded failure 00:08:41
data-at-rest-encryption passed 00:12:47
data-sharded passed 00:24:56
demand-backup passed 00:20:40
demand-backup-eks-credentials-irsa passed 00:00:08
demand-backup-fs passed 00:29:29
demand-backup-if-unhealthy passed 00:10:40
demand-backup-incremental-aws passed 00:11:58
demand-backup-incremental-azure failure 00:30:29
demand-backup-incremental-gcp-native failure 00:14:51
demand-backup-incremental-gcp-s3 passed 00:10:57
demand-backup-incremental-minio passed 00:26:10
demand-backup-incremental-sharded-aws passed 00:24:24
demand-backup-incremental-sharded-azure passed 00:21:45
demand-backup-incremental-sharded-gcp-native passed 00:17:50
demand-backup-incremental-sharded-gcp-s3 passed 00:18:11
demand-backup-incremental-sharded-minio passed 00:28:36
demand-backup-physical-parallel passed 00:08:48
demand-backup-physical-aws passed 00:16:17
demand-backup-physical-azure passed 00:12:39
demand-backup-physical-gcp-s3 passed 00:12:34
demand-backup-physical-gcp-native passed 00:12:41
demand-backup-physical-minio passed 00:21:20
demand-backup-physical-minio-native failure 00:20:12
demand-backup-physical-minio-native-tls passed 00:21:07
demand-backup-physical-sharded-parallel passed 00:11:23
demand-backup-physical-sharded-aws passed 00:18:57
demand-backup-physical-sharded-azure passed 00:18:57
demand-backup-physical-sharded-gcp-native passed 00:20:44
demand-backup-physical-sharded-minio passed 00:17:58
demand-backup-physical-sharded-minio-native passed 00:18:28
demand-backup-sharded passed 00:27:10
demand-backup-snapshot failure 01:30:10
demand-backup-snapshot-vault failure 00:15:40
disabled-auth passed 00:17:05
expose-sharded failure 00:05:29
finalizer passed 00:11:01
ignore-labels-annotations passed 00:07:55
init-deploy passed 00:13:05
ldap passed 00:09:03
ldap-tls passed 00:13:37
limits passed 00:06:40
liveness passed 00:09:20
mongod-major-upgrade passed 00:12:00
mongod-major-upgrade-sharded passed 00:21:33
monitoring-2-0 passed 00:28:31
monitoring-pmm3 passed 00:28:08
multi-cluster-service passed 00:14:09
multi-storage passed 00:19:14
non-voting-and-hidden passed 00:20:42
one-pod failure 00:05:07
operator-self-healing-chaos passed 00:14:03
pitr passed 00:33:03
pitr-physical passed 01:04:25
pitr-sharded passed 00:21:41
pitr-to-new-cluster passed 00:26:37
pitr-physical-backup-source passed 01:02:17
preinit-updates passed 00:06:33
pvc-auto-resize passed 00:15:06
pvc-resize passed 00:16:17
recover-no-primary passed 00:28:57
replset-overrides passed 00:18:29
replset-remapping passed 00:17:16
replset-remapping-sharded passed 00:18:08
rs-shard-migration passed 00:14:51
scaling passed 00:11:16
scheduled-backup passed 00:12:13
security-context passed 00:07:31
self-healing-chaos passed 00:15:14
service-per-pod passed 00:19:11
serviceless-external-nodes passed 00:07:33
smart-update passed 00:08:55
split-horizon passed 00:14:35
stable-resource-version passed 00:05:08
storage passed 00:07:39
tls-issue-cert-manager passed 00:34:23
unsafe-psa passed 00:07:44
upgrade passed 00:10:26
upgrade-consistency passed 00:08:44
upgrade-consistency-sharded-tls failure 00:54:14
upgrade-sharded passed 00:22:38
upgrade-partial-backup passed 00:16:06
users passed 00:18:20
users-vault passed 00:13:37
version-service passed 00:28:31
Summary Value
Tests Run 91/91
Job Duration 04:13:50
Total Test Time 28:23:00

commit: d7e802d
image: perconalab/percona-server-mongodb-operator:PR-2219-d7e802db

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.

6 participants