Skip to content

Add pydantic Duration type - #2784

Open
chala2001 wants to merge 1 commit into
kubernetes-client:masterfrom
chala2001:pydantic-duration
Open

chala2001 wants to merge 1 commit into
kubernetes-client:masterfrom
chala2001:pydantic-duration

Conversation

@chala2001

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind feature

What this PR does / why we need it:

Adds kubernetes.utils.Duration, a pydantic type for metav1.Duration. It reads and writes Go duration strings like 720h0m0s, so custom resource models can use it with CustomObjectsApi.

Also adds the missing type hint on parse_duration.

Which issue(s) this PR fixes:

Fixes #2764

Special notes for your reviewer:

Values are stored as timedelta, so anything below a microsecond gets rounded.

Does this PR introduce a user-facing change?

Add `kubernetes.utils.Duration`, a pydantic type for metav1.Duration.

@kubernetes-prow kubernetes-prow Bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Nov 15, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: chala2001
Once this PR has been reviewed and has the lgtm label, please assign yliaog for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow
kubernetes-prow Bot requested review from roycaihw and yliaog November 15, 2026 09:43
@kubernetes-prow kubernetes-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pydantic type representing meta Duration

1 participant