Skip to content

client: add Kubernetes-aware retry helpers#2634

Merged
kubernetes-prow[bot] merged 4 commits into
kubernetes-client:masterfrom
sttts:agent/kubernetes-retry-utils
Jul 23, 2026
Merged

client: add Kubernetes-aware retry helpers#2634
kubernetes-prow[bot] merged 4 commits into
kubernetes-client:masterfrom
sttts:agent/kubernetes-retry-utils

Conversation

@sttts

@sttts sttts commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Add client-go-style retry helper APIs for the sync and AIO Python clients.

  • Shared primitives live in kubernetes/base/retry.py.
  • Public sync helpers live in kubernetes.utils.retry.
  • Public AIO helpers live in kubernetes.aio.utils.retry.
  • Helpers cover 409 conflict retries for writes and Retry-After/backoff behavior for later generated read retry wiring.
  • AIO utils are included in both setup-asyncio.py and the combined setup-release.py package list.

The generated REST/Configuration wiring is intentionally separate and follows in kubernetes-client/gen#304.

Validation

  • .venv/bin/python -m unittest kubernetes.utils.retry_test kubernetes.aio.utils.retry_test
  • .venv/bin/python -m pytest -q kubernetes/utils/retry_test.py kubernetes/aio/utils/retry_test.py
  • .venv/bin/python -m pycodestyle ... for retry helpers, exports, and setup-release.py
  • setup.py, setup-asyncio.py, and setup-release.py build_py checks confirmed symlinked helper files are copied as regular files
  • git diff --check
Add Kubernetes-aware retry helper APIs for Python clients, modeled on client-go retry behavior.

@kubernetes-prow kubernetes-prow Bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jul 15, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

Welcome @sttts!

It looks like this is your first PR to kubernetes-client/python 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-client/python has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@kubernetes-prow kubernetes-prow Bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Jul 15, 2026
@kubernetes-prow
kubernetes-prow Bot requested review from roycaihw and yliaog July 15, 2026 14:53
@sttts sttts changed the title utils: add Kubernetes retry helpers client: add Kubernetes-aware retry helpers Jul 15, 2026
@kubernetes-prow kubernetes-prow Bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jul 15, 2026
@sttts
sttts marked this pull request as ready for review July 15, 2026 15:09
@kubernetes-prow kubernetes-prow Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 15, 2026
@sttts
sttts marked this pull request as draft July 15, 2026 15:16
@kubernetes-prow kubernetes-prow Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 15, 2026
@sttts
sttts marked this pull request as ready for review July 15, 2026 15:18
@kubernetes-prow kubernetes-prow Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 15, 2026
@sttts
sttts marked this pull request as draft July 15, 2026 15:25
@kubernetes-prow kubernetes-prow Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 15, 2026
@sttts
sttts marked this pull request as ready for review July 15, 2026 15:57
@kubernetes-prow kubernetes-prow Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 15, 2026
@kubernetes-prow kubernetes-prow Bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jul 15, 2026
@sttts
sttts force-pushed the agent/kubernetes-retry-utils branch from ee00eac to ec56a76 Compare July 15, 2026 16:58
Comment thread kubernetes/utils/retry.py Outdated
@roycaihw

Copy link
Copy Markdown
Member

/assign @yliaog

@sttts
sttts force-pushed the agent/kubernetes-retry-utils branch from ec56a76 to 50d8aed Compare July 17, 2026 07:00
@kubernetes-prow kubernetes-prow Bot removed the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Jul 17, 2026
@kubernetes-prow kubernetes-prow Bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jul 17, 2026
Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@gmail.com>
@sttts
sttts force-pushed the agent/kubernetes-retry-utils branch from 50d8aed to 3e89602 Compare July 17, 2026 07:20
sttts added 2 commits July 17, 2026 14:08
Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@gmail.com>
Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@gmail.com>
@sttts

sttts commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

Fixed in the latest push: setup-release.py now includes kubernetes.aio.utils, so the combined release package includes the new AIO retry helpers.

I also verified setup-release.py build_py copies kubernetes/aio/utils/retry.py, kubernetes/aio/utils/_retry_base.py, and kubernetes/aio/utils/retry_test.py into the combined release build output, and updated the PR description with that validation.

@kubernetes-prow kubernetes-prow Bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Jul 21, 2026
Comment thread kubernetes/aio/utils/retry.py Outdated
Comment thread kubernetes/aio/utils/retry.py Outdated
Comment thread kubernetes/aio/utils/retry.py Outdated
Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@gmail.com>
@sttts

sttts commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the latest AIO naming review feedback in cd96f0e.

The public AIO retry helpers now use the same names as the sync helpers under the kubernetes.aio.utils.retry namespace:

  • on_error
  • retry_on_conflict
  • on_retry_after_error

The generated AIO wiring follow-up in kubernetes-client/gen#304 was updated as well.

@yliaog

yliaog commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

thanks for the PR
/lgtm
/approve

@kubernetes-prow kubernetes-prow Bot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 23, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sttts, yliaog

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

The pull request process is described 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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 23, 2026
@kubernetes-prow
kubernetes-prow Bot merged commit 5583fb5 into kubernetes-client:master Jul 23, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants