Skip to content

Commit

Permalink
only lookup token if we don't have client certs for both
Browse files Browse the repository at this point in the history
see #3221 for idea
  • Loading branch information
xvello committed Jul 4, 2017
1 parent b1bc660 commit 8711e64
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions utils/kubernetes/kubeutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,6 @@ def _init_tls_settings(self, instance):
if apiserver_cacert and os.path.exists(apiserver_cacert):
tls_settings['apiserver_cacert'] = apiserver_cacert

token = self.get_auth_token(instance)
if token:
tls_settings['bearer_token'] = token

# kubelet
kubelet_client_crt = instance.get('kubelet_client_crt')
kubelet_client_key = instance.get('kubelet_client_key')
Expand All @@ -169,6 +165,12 @@ def _init_tls_settings(self, instance):
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):
# Only lookup token if we don't have client certs for both
token = self.get_auth_token(instance)
if token:
tls_settings['bearer_token'] = token

return tls_settings

def _locate_kubelet(self, instance):
Expand Down

0 comments on commit 8711e64

Please sign in to comment.