def Connect(self): _CheckTLSSupport() with self._LoadClusterDetails(): try: if self.ca_data: with gke.MonkeypatchAddressChecking( 'kubernetes.default', self.raw_hostname) as endpoint: self.endpoint = 'https://{}/'.format(endpoint) with _OverrideEndpointOverrides( self._api_name, self.endpoint): yield self else: self.endpoint = 'https://{}/'.format(self.raw_hostname) with _OverrideEndpointOverrides(self._api_name, self.endpoint): yield self # SSL Exceptions raised by the http2lib and requests library except (ssl.SSLError, requests.exceptions.SSLError) as e: if 'CERTIFICATE_VERIFY_FAILED' in six.text_type(e): raise gke.NoCaCertError( 'Missing or invalid [certificate-authority] or ' '[certificate-authority-data] field in kubeconfig file.' ) else: raise
def Connect(self): _CheckTLSSupport() with self._LoadClusterDetails(): try: if self.ca_data: with gke.MonkeypatchAddressChecking( 'kubernetes.default', self.raw_hostname) as endpoint: self.endpoint = 'https://{}/'.format(endpoint) with _OverrideEndpointOverrides(self.endpoint): yield self else: self.endpoint = 'https://{}/'.format(self.raw_hostname) with _OverrideEndpointOverrides(self.endpoint): yield self except httplib2.SSLHandshakeError as e: if 'CERTIFICATE_VERIFY_FAILED' in str(e): raise gke.NoCaCertError( 'Missing or invalid [certificate-authority] or ' '[certificate-authority-data] field in kubeconfig file.') else: raise