Move ConfigException out of incluster_config and in it's own file

This commit is contained in:
mbohlool 2016-11-30 03:33:03 -08:00
parent 812125f9f2
commit 66e4f5ff70
4 changed files with 23 additions and 9 deletions

View File

@ -12,6 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from .kube_config import load_kube_config
from .config_exception import ConfigException
from .incluster_config import load_incluster_config
from .incluster_config import ConfigException
from .kube_config import load_kube_config

View File

@ -0,0 +1,17 @@
# Copyright 2016 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
class ConfigException(Exception):
pass

View File

@ -16,6 +16,8 @@ import os
from kubernetes.client import configuration
from .config_exception import ConfigException
_SERVICE_HOST_ENV_NAME = "KUBERNETES_SERVICE_HOST"
_SERVICE_PORT_ENV_NAME = "KUBERNETES_SERVICE_PORT"
_SERVICE_TOKEN_FILENAME = "/var/run/secrets/kubernetes.io/serviceaccount/token"
@ -31,10 +33,6 @@ def _join_host_port(host, port):
return template % (host, port)
class ConfigException(Exception):
pass
class InClusterConfigLoader(object):
def __init__(self, host_env_name, port_env_name, token_filename,

View File

@ -16,10 +16,9 @@ import os
import tempfile
import unittest
from kubernetes.client import configuration
from .config_exception import ConfigException
from .incluster_config import (_SERVICE_HOST_ENV_NAME, _SERVICE_PORT_ENV_NAME,
ConfigException, InClusterConfigLoader)
InClusterConfigLoader)
_TEST_TOKEN = "temp_token"
_TEST_HOST = "127.0.0.1"