-
Notifications
You must be signed in to change notification settings - Fork 157
K8SPSMDB-1339: add validation to .spec.pitr.date
#2039
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
Conversation
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" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this 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
commit: 368d0b2 |
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
Needs Doc
) and QA (Needs QA
)?Tests
compare/*-oc.yml
)?Config/Logging/Testability