Skip to content

Honor assert_hostname in the asyncio client - #2795

Open
Yohan-Senadheera wants to merge 1 commit into
kubernetes-client:masterfrom
Yohan-Senadheera:aio-assert-hostname
Open

Yohan-Senadheera wants to merge 1 commit into
kubernetes-client:masterfrom
Yohan-Senadheera:aio-assert-hostname

Conversation

@Yohan-Senadheera

Copy link
Copy Markdown

What type of PR is this?

/kind bug

What this PR does / why we need it:

assert_hostname=False turns off hostname checks in the sync client, but has no effect in the asyncio client: rest.py never reads it. This sets ssl_context.check_hostname from it when verify_ssl is on. With verify_ssl off it is left alone, so certificate verification is not switched back on.

rest.py is generated, so the same change is made in the generator post-processing: kubernetes-client/gen#314

Tested with an HTTPS server whose certificate is issued for another hostname, trusted through ssl_ca_cert:

  • master: assert_hostname=False still fails with CERTIFICATE_VERIFY_FAILED (hostname mismatch)
  • this branch: assert_hostname=False returns 200, and the default still rejects the mismatch

The new unit test fails on master and passes here. All kubernetes/aio/test/test_generated_api.py tests pass.

Which issue(s) this PR fixes:

None filed.

Does this PR introduce a user-facing change?

The asyncio client now honors Configuration.assert_hostname.

assert_hostname=False turned off hostname checks in the sync client
but had no effect in the asyncio client. Set check_hostname on the
SSL context from it when verify_ssl is on.

Signed-off-by: Yohan Senadheera <yohansenadheera@gmail.com>
Copilot AI balanced review requested due to automatic review settings November 18, 2026 02:37
@kubernetes-prow kubernetes-prow Bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. labels Nov 18, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Yohan-Senadheera
Once this PR has been reviewed and has the lgtm label, please assign roycaihw 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 18, 2026 02:37
@kubernetes-prow kubernetes-prow Bot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Nov 18, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@kubernetes-prow kubernetes-prow Bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Nov 18, 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/bug Categorizes issue or PR as related to a bug. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants