Merge "Make k8s.cluster.K8sCluster be used both in py2 and py3"
This commit is contained in:
commit
315a88605a
|
@ -54,7 +54,8 @@ class K8sCluster(object):
|
|||
def __init__(self, schema="https", user=None, password=None,
|
||||
host='localhost', port='443', default_namespace='default'):
|
||||
if user and password:
|
||||
auth = base64.encodestring('%s:%s' % (user, password))[:-1]
|
||||
auth_string = '%s:%s' % (user, password)
|
||||
auth = base64.encodestring(auth_string.encode()).decode()[:-1]
|
||||
auth = "Basic {}".format(auth)
|
||||
self._client = api_client.ApiClient(
|
||||
'{schema}://{host}:{port}/'.format(
|
||||
|
|
|
@ -177,10 +177,10 @@ class K8SManager(object):
|
|||
'registry_templates/' \
|
||||
'service-registry.yaml'
|
||||
|
||||
with file(registry_pod) as f:
|
||||
registry = yaml.load(f)
|
||||
with file(service_registry) as f:
|
||||
service = yaml.load(f)
|
||||
with open(registry_pod) as f:
|
||||
registry = yaml.load(f.read())
|
||||
with open(service_registry) as f:
|
||||
service = yaml.load(f.read())
|
||||
|
||||
registry_pod = self.api.pods.create(body=registry, namespace='default')
|
||||
self.api.services.create(body=service, namespace='default')
|
||||
|
|
Loading…
Reference in New Issue