'Initialize TLS settings for connection to apiserver and kubelet.'

def _init_tls_settings(self, instance):

    tls_settings = {}
    client_crt = instance.get('apiserver_client_crt')
    client_key = instance.get('apiserver_client_key')
    apiserver_cacert = instance.get('apiserver_ca_cert')
    if (client_crt and client_key and os.path.exists(client_crt) and os.path.exists(client_key)):
        tls_settings['apiserver_client_cert'] = (client_crt, client_key)
    if (apiserver_cacert and os.path.exists(apiserver_cacert)):
        tls_settings['apiserver_cacert'] = apiserver_cacert
    kubelet_client_crt = instance.get('kubelet_client_crt')
    kubelet_client_key = instance.get('kubelet_client_key')
    if (kubelet_client_crt and kubelet_client_key and os.path.exists(kubelet_client_crt) and os.path.exists(kubelet_client_key)):
        tls_settings['kubelet_client_cert'] = (kubelet_client_crt, kubelet_client_key)
    cert = instance.get('kubelet_cert')
    if cert:
        tls_settings['kubelet_verify'] = cert
    else:
        tls_settings['kubelet_verify'] = instance.get('kubelet_tls_verify', DEFAULT_TLS_VERIFY)
    if (('apiserver_client_cert' not in tls_settings) or ('kubelet_client_cert' not in tls_settings)):
        token = self.get_auth_token(instance)
        if token:
            tls_settings['bearer_token'] = token
    return tls_settings
