Honor assert_hostname in the asyncio client

YO
5d ago
+21-0

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: https://github.com/kubernetes-client/gen/pull/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.