Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add debug logs to KubeConfigLoader #45

Merged
merged 1 commit into from
Oct 6, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions kubernetes_asyncio/config/kube_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import base64
import datetime
import json
import logging
import os
import tempfile

Expand Down Expand Up @@ -161,6 +162,12 @@ def set_active_context(self, context_name=None):
if self._user is not None and 'auth-provider' in self._user and 'name' in self._user['auth-provider']:
self.provider = self._user['auth-provider']['name']

logging.debug('kubeconfig loader - current-context %s, cluster %s, user %s, provider %s',
context_name,
self._current_context['context']['cluster'],
self._current_context['context'].safe_get('user'),
self.provider)

async def _load_authentication(self):
"""Read authentication from kube-config user section if exists.

Expand All @@ -176,6 +183,7 @@ async def _load_authentication(self):
"""

if not self._user:
logging.debug('No user section in current context.')
return

if self.provider == 'gcp':
Expand All @@ -187,13 +195,16 @@ async def _load_authentication(self):
return

if 'exec' in self._user:
logging.debug('Try to use exec provider')
res_exec_plugin = await self._load_from_exec_plugin()
if res_exec_plugin:
return

logging.debug('Try to load user token')
if self._load_user_token():
return

logging.debug('Try to use username and password')
self._load_user_pass_token()

async def load_gcp_token(self):
Expand Down