def setUpClass(cls):
cls.deployment = amulet.Deployment(series='xenial')
with open(cls.bundle_file) as stream:
bundle_yaml = stream.read()
bundle = yaml.safe_load(bundle_yaml)
cls.deployment.load(bundle)
# Allow some time for Juju to provision and deploy the bundle.
cls.deployment.setup(timeout=SECONDS_TO_WAIT)
# Wait for the system to settle down.
wait(cls.deployment.sentry)
# Make every unit available through self reference
# eg: for worker in self.workers:
# print(worker.info['public-address'])
cls.easyrsas = cls.deployment.sentry['easyrsa']
cls.etcds = cls.deployment.sentry['etcd']
cls.flannels = cls.deployment.sentry['flannel']
cls.loadbalancers = cls.deployment.sentry['kubeapi-load-balancer']
cls.masters = cls.deployment.sentry['kubernetes-master']
cls.workers = cls.deployment.sentry['kubernetes-worker']
python类Deployment()的实例源码
40-security-check.py 文件源码
项目:bundle-canonical-kubernetes
作者: juju-solutions
项目源码
文件源码
阅读 23
收藏 0
点赞 0
评论 0
20-charm-validation.py 文件源码
项目:bundle-canonical-kubernetes
作者: juju-solutions
项目源码
文件源码
阅读 22
收藏 0
点赞 0
评论 0
def setUpClass(cls):
cls.deployment = amulet.Deployment(series='xenial')
with open(cls.bundle_file) as stream:
bundle_yaml = stream.read()
bundle = yaml.safe_load(bundle_yaml)
if 'options' not in bundle['services']['kubernetes-worker']:
labels = {'labels': "mylabel=thebest"}
bundle['services']['kubernetes-worker']['options'] = labels
else:
if 'labels' not in bundle['services']['kubernetes-worker']['options']:
bundle['services']['kubernetes-worker']['options']['labels'] = "mylabel=thebest"
else:
bundle['services']['kubernetes-worker']['options']['labels'] += " mylabel=thebest"
cls.deployment.load(bundle)
# Allow some time for Juju to provision and deploy the bundle.
cls.deployment.setup(timeout=SECONDS_TO_WAIT)
# Wait for the system to settle down.
wait(cls.deployment.sentry)
def setUpClass(cls):
"""Setup the deployment for this class once and deploy."""
cls.deployment = amulet.Deployment(series='xenial')
cls.deployment.add('ubuntu')
cls.deployment.add('packetbeat')
cls.deployment.relate('ubuntu:juju-info', 'packetbeat:beats-host')
try:
cls.deployment.setup(timeout=seconds)
cls.deployment.sentry.wait()
except amulet.helpers.TimeoutError:
message = "The deploy did not setup in {0} seconds".format(seconds)
amulet.raise_status(amulet.SKIP, msg=message)
except:
raise
cls.unit = cls.deployment.sentry['packetbeat'][0]
def setUpClass(cls):
cls.d = amulet.Deployment(series='xenial')
cls.d.add('etcd')
cls.d.add('easyrsa', 'cs:~containers/easyrsa')
cls.d.configure('etcd', {'channel': '3.0/stable'})
cls.d.relate('easyrsa:client', 'etcd:certificates')
cls.d.setup(timeout=1200)
cls.d.sentry.wait_for_messages({'etcd':
re.compile('Healthy*|Unhealthy*')})
# cls.d.sentry.wait()
cls.etcd = cls.d.sentry['etcd']
# find the leader
for unit in cls.etcd:
leader_result = unit.run('is-leader')
if leader_result[0] == 'True':
cls.leader = unit
def __init__(self, series=None):
"""Initialize the deployment environment."""
self.series = None
if series:
self.series = series
self.d = amulet.Deployment(series=self.series)
else:
self.d = amulet.Deployment()
def _deploy(self):
"""Deploy environment and wait for all hooks to finish executing."""
try:
self.d.setup(timeout=900)
self.d.sentry.wait(timeout=900)
except amulet.helpers.TimeoutError:
amulet.raise_status(amulet.FAIL, msg="Deployment timed out")
except Exception:
raise
def __init__(self, series=None):
"""Initialize the deployment environment."""
self.series = None
if series:
self.series = series
self.d = amulet.Deployment(series=self.series)
else:
self.d = amulet.Deployment()
def _deploy(self):
"""Deploy environment and wait for all hooks to finish executing."""
timeout = int(os.environ.get('AMULET_SETUP_TIMEOUT', 900))
try:
self.d.setup(timeout=timeout)
self.d.sentry.wait(timeout=timeout)
except amulet.helpers.TimeoutError:
amulet.raise_status(
amulet.FAIL,
msg="Deployment timed out ({}s)".format(timeout)
)
except Exception:
raise
def __init__(self, series=None):
"""Initialize the deployment environment."""
self.series = None
if series:
self.series = series
self.d = amulet.Deployment(series=self.series)
else:
self.d = amulet.Deployment()
def _deploy(self):
"""Deploy environment and wait for all hooks to finish executing."""
timeout = int(os.environ.get('AMULET_SETUP_TIMEOUT', 900))
try:
self.d.setup(timeout=timeout)
self.d.sentry.wait(timeout=timeout)
except amulet.helpers.TimeoutError:
amulet.raise_status(
amulet.FAIL,
msg="Deployment timed out ({}s)".format(timeout)
)
except Exception:
raise
def __init__(self, series=None):
"""Initialize the deployment environment."""
self.series = None
if series:
self.series = series
self.d = amulet.Deployment(series=self.series)
else:
self.d = amulet.Deployment()
def _deploy(self):
"""Deploy environment and wait for all hooks to finish executing."""
timeout = int(os.environ.get('AMULET_SETUP_TIMEOUT', 900))
try:
self.d.setup(timeout=timeout)
self.d.sentry.wait(timeout=timeout)
except amulet.helpers.TimeoutError:
amulet.raise_status(
amulet.FAIL,
msg="Deployment timed out ({}s)".format(timeout)
)
except Exception:
raise
def __init__(self, series=None):
"""Initialize the deployment environment."""
self.series = None
if series:
self.series = series
self.d = amulet.Deployment(series=self.series)
else:
self.d = amulet.Deployment()
def _deploy(self):
"""Deploy environment and wait for all hooks to finish executing."""
timeout = int(os.environ.get('AMULET_SETUP_TIMEOUT', 900))
try:
self.d.setup(timeout=timeout)
self.d.sentry.wait(timeout=timeout)
except amulet.helpers.TimeoutError:
amulet.raise_status(
amulet.FAIL,
msg="Deployment timed out ({}s)".format(timeout)
)
except Exception:
raise
def __init__(self, series=None):
"""Initialize the deployment environment."""
self.series = None
if series:
self.series = series
self.d = amulet.Deployment(series=self.series)
else:
self.d = amulet.Deployment()
def _deploy(self):
"""Deploy environment and wait for all hooks to finish executing."""
timeout = int(os.environ.get('AMULET_SETUP_TIMEOUT', 900))
try:
self.d.setup(timeout=timeout)
self.d.sentry.wait(timeout=timeout)
except amulet.helpers.TimeoutError:
amulet.raise_status(
amulet.FAIL,
msg="Deployment timed out ({}s)".format(timeout)
)
except Exception:
raise
def __init__(self, series=None):
"""Initialize the deployment environment."""
self.series = None
if series:
self.series = series
self.d = amulet.Deployment(series=self.series)
else:
self.d = amulet.Deployment()
def _deploy(self):
"""Deploy environment and wait for all hooks to finish executing."""
timeout = int(os.environ.get('AMULET_SETUP_TIMEOUT', 900))
try:
self.d.setup(timeout=timeout)
self.d.sentry.wait(timeout=timeout)
except amulet.helpers.TimeoutError:
amulet.raise_status(
amulet.FAIL,
msg="Deployment timed out ({}s)".format(timeout)
)
except Exception:
raise
def __init__(self, series=None):
"""Initialize the deployment environment."""
self.series = None
if series:
self.series = series
self.d = amulet.Deployment(series=self.series)
else:
self.d = amulet.Deployment()
def _deploy(self):
"""Deploy environment and wait for all hooks to finish executing."""
timeout = int(os.environ.get('AMULET_SETUP_TIMEOUT', 900))
try:
self.d.setup(timeout=timeout)
self.d.sentry.wait(timeout=timeout)
except amulet.helpers.TimeoutError:
amulet.raise_status(
amulet.FAIL,
msg="Deployment timed out ({}s)".format(timeout)
)
except Exception:
raise
def __init__(self, series=None):
"""Initialize the deployment environment."""
self.series = None
if series:
self.series = series
self.d = amulet.Deployment(series=self.series)
else:
self.d = amulet.Deployment()
def _deploy(self):
"""Deploy environment and wait for all hooks to finish executing."""
timeout = int(os.environ.get('AMULET_SETUP_TIMEOUT', 900))
try:
self.d.setup(timeout=timeout)
self.d.sentry.wait(timeout=timeout)
except amulet.helpers.TimeoutError:
amulet.raise_status(
amulet.FAIL,
msg="Deployment timed out ({}s)".format(timeout)
)
except Exception:
raise
def __init__(self, series=None):
"""Initialize the deployment environment."""
self.series = None
if series:
self.series = series
self.d = amulet.Deployment(series=self.series)
else:
self.d = amulet.Deployment()
def _deploy(self):
"""Deploy environment and wait for all hooks to finish executing."""
timeout = int(os.environ.get('AMULET_SETUP_TIMEOUT', 900))
try:
self.d.setup(timeout=timeout)
self.d.sentry.wait(timeout=timeout)
except amulet.helpers.TimeoutError:
amulet.raise_status(
amulet.FAIL,
msg="Deployment timed out ({}s)".format(timeout)
)
except Exception:
raise
def __init__(self, series=None):
"""Initialize the deployment environment."""
self.series = None
if series:
self.series = series
self.d = amulet.Deployment(series=self.series)
else:
self.d = amulet.Deployment()
def _deploy(self):
"""Deploy environment and wait for all hooks to finish executing."""
timeout = int(os.environ.get('AMULET_SETUP_TIMEOUT', 900))
try:
self.d.setup(timeout=timeout)
self.d.sentry.wait(timeout=timeout)
except amulet.helpers.TimeoutError:
amulet.raise_status(
amulet.FAIL,
msg="Deployment timed out ({}s)".format(timeout)
)
except Exception:
raise
01-basic-deployment.py 文件源码
项目:layer-hadoop-client
作者: juju-solutions
项目源码
文件源码
阅读 24
收藏 0
点赞 0
评论 0
def test_deploy(self):
self.d = amulet.Deployment(series='xenial')
self.d.add('client', 'hadoop-client')
self.d.setup(timeout=900)
self.d.sentry.wait(timeout=1800)
self.unit = self.d.sentry['client'][0]
30-unit-shuffle.py 文件源码
项目:bundle-canonical-kubernetes
作者: juju-solutions
项目源码
文件源码
阅读 29
收藏 0
点赞 0
评论 0
def setUpClass(cls):
cls.deployment = amulet.Deployment(series='xenial')
with open(cls.bundle_file) as stream:
bundle_yaml = stream.read()
bundle = yaml.safe_load(bundle_yaml)
cls.deployment.load(bundle)
# Allow some time for Juju to provision and deploy the bundle.
cls.deployment.setup(timeout=SECONDS_TO_WAIT)
# Wait for the system to settle down.
wait(cls.deployment.sentry)
def __init__(self, series=None):
"""Initialize the deployment environment."""
self.series = None
if series:
self.series = series
self.d = amulet.Deployment(series=self.series)
else:
self.d = amulet.Deployment()
def _deploy(self):
"""Deploy environment and wait for all hooks to finish executing."""
timeout = int(os.environ.get('AMULET_SETUP_TIMEOUT', 900))
try:
self.d.setup(timeout=timeout)
self.d.sentry.wait(timeout=timeout)
except amulet.helpers.TimeoutError:
amulet.raise_status(
amulet.FAIL,
msg="Deployment timed out ({}s)".format(timeout)
)
except Exception:
raise