Skip to content

Conversation

pooknull
Copy link
Contributor

@pooknull pooknull commented Sep 9, 2025

K8SPSMDB-1339 Powered by Pull Request Badge

https://perconadev.atlassian.net/browse/K8SPSMDB-1339

DESCRIPTION

This PR adds the following validation rules to the psmdb-restore custom resource:

  • .spec.pitr.date: Time should be in format YYYY-MM-DD HH:MM:SS
  • .spec.pitr.date: Date should not be used when 'latest' type is used

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?

return json.Marshal(t.Time.Format("2006-01-02 15:04:05"))
}

// +kubebuilder:validation:XValidation:rule="self.type != 'date' || (has(self.date) && self.date.matches('^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$'))",message="Time should be in format YYYY-MM-DD HH:MM:SS"
Copy link
Contributor

Choose a reason for hiding this comment

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

We can create a small test for ensuring that in our controller test file. Mainly checking that with the right configuration is passes and with wrong the expected error message is triggered.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@egegunes egegunes left a comment

Choose a reason for hiding this comment

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

@pooknull please add tests

@pull-request-size pull-request-size bot added size/L 100-499 lines and removed size/M 30-99 lines labels Sep 10, 2025
@pooknull pooknull requested review from egegunes and gkech September 10, 2025 11:24
@github-actions github-actions bot added the dependencies Pull requests that update a dependency file label Sep 11, 2025
egegunes
egegunes previously approved these changes Sep 15, 2025
gkech
gkech previously approved these changes Sep 15, 2025
@pooknull pooknull dismissed stale reviews from gkech and egegunes via 1830572 September 15, 2025 07:26
@JNKPercona
Copy link
Collaborator

Test name Status
arbiter passed
balancer passed
cross-site-sharded passed
custom-replset-name passed
custom-tls passed
custom-users-roles passed
custom-users-roles-sharded passed
data-at-rest-encryption passed
data-sharded passed
demand-backup passed
demand-backup-eks-credentials-irsa passed
demand-backup-fs passed
demand-backup-incremental passed
demand-backup-incremental-sharded passed
demand-backup-physical-parallel passed
demand-backup-physical-aws passed
demand-backup-physical-azure passed
demand-backup-physical-gcp passed
demand-backup-physical-minio passed
demand-backup-physical-sharded-parallel passed
demand-backup-physical-sharded-aws passed
demand-backup-physical-sharded-azure passed
demand-backup-physical-sharded-gcp passed
demand-backup-physical-sharded-minio passed
demand-backup-sharded passed
expose-sharded passed
finalizer passed
ignore-labels-annotations passed
init-deploy passed
ldap passed
ldap-tls passed
limits passed
liveness passed
mongod-major-upgrade passed
mongod-major-upgrade-sharded passed
monitoring-2-0 passed
monitoring-pmm3 passed
multi-cluster-service passed
multi-storage passed
non-voting-and-hidden passed
one-pod passed
operator-self-healing-chaos passed
pitr passed
pitr-physical passed
pitr-sharded passed
pitr-physical-backup-source passed
preinit-updates passed
pvc-resize passed
recover-no-primary passed
replset-overrides passed
rs-shard-migration passed
scaling passed
scheduled-backup passed
security-context passed
self-healing-chaos passed
service-per-pod passed
serviceless-external-nodes passed
smart-update passed
split-horizon passed
stable-resource-version passed
storage passed
tls-issue-cert-manager passed
upgrade passed
upgrade-consistency passed
upgrade-consistency-sharded-tls passed
upgrade-sharded passed
users passed
version-service passed
We run 68 out of 68

commit: 368d0b2
image: perconalab/percona-server-mongodb-operator:PR-2039-368d0b21

@egegunes egegunes merged commit 0ec1425 into main Sep 16, 2025
19 checks passed
@egegunes egegunes deleted the K8SPSMDB-1339 branch September 16, 2025 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build ci dependencies Pull requests that update a dependency file size/L 100-499 lines tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants