Honor assert_hostname in the asyncio Python client

YO
5d ago
+22-0

The sync Python client passes assert_hostname to urllib3, so assert_hostname=False turns off the hostname check. The asyncio rest.py from OpenAPI Generator never reads it, so in kubernetes.aio the setting does nothing.

This adds a post-processing step, next to the existing disable_strict_ssl_verification one, that sets ssl_context.check_hostname from assert_hostname. It only runs when verify_ssl is on, because turning check_hostname on would otherwise switch certificate verification back on.

The test checks the generated line and that it is added once. It fails without this change.

Downstream: https://github.com/kubernetes-client/python/pull/2795