Repository navigation
Conversation
Add V1Duration, an annotated timedelta type for GEP-2257 durations in custom objects, and add type hints to parse_duration. Also export format_duration from kubernetes.utils. Signed-off-by: Michael Fruchtman <msfrucht@us.ibm.com>
|
|
Welcome @msfrucht! |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: msfrucht The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Reviewing organization CLA situation. |
What type of PR is this?
Feature/API Addition
Add one of the following kinds:
/kind feature
Optionally add one or more of the following kinds if applicable:
/kind cleanup
/kind documentation
What this PR does / why we need it:
This adds a Pydantic custom type usable as a drop-in metav1.Duration that can be used within custom Pydantic models. This is meant for use with model_dump/model_verify through the CustomObjectsApi to serialize/deserialize models for custom resources.
Example:
Velero Backup objects uses metav1.Duration to describe how long should stick around before expiration as well as various timeout fields. https://github.com/velero-io/velero/blob/v1.18.4/pkg/apis/velero/v1/backup_types.go#L114
Which issue(s) this PR fixes:
Fixes # #2764
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: