zalando-incubator / kopf

A Python framework to write Kubernetes operators in just few lines of code.
https://kopf.readthedocs.io
MIT License
970 stars 88 forks source link

add --disable-certificate-verify command line argument #140

Closed goern closed 4 years ago

goern commented 5 years ago

Expected Behavior

Kopf does not validate the SSL certs, so that it will not fail with [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1056)

Actual Behavior

SSL certs validation is enforce, and kopf run fails with [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1056) if run out of cluster.

Steps to Reproduce the Problem

  1. kopf run app.py --verbose --standalone

Specifications

nolar commented 4 years ago

To achieve the desired goal of ignoring the SSL certificate validity, please use @kopf.on.login() handlers to produce a kopf.ConnectionInfo(..., verify=False, ...) instance.

To make it more simple, kopf.login_via_pykube() and kopf.login_via_client() can be used inside of the handler instead of own config parsing, of which the returned ConnectionInfo object can be modified with dataclasses.replace(result, verify=False).

Few examples can be found here:

The custom authentication methods were pre-released in kopf>=0.23rc1 and will be normally released (kopf>=0.23) in few days. See the 0.23rc1 release notes.

Please report any issues with the new custom authentication methods if they do not work as expected.