Merge "Update mesos slave to mesos agent"

This commit is contained in:
Jenkins 2016-07-18 08:13:10 +00:00 committed by Gerrit Code Review
commit 7a66c1cf56
19 changed files with 515 additions and 179 deletions

View File

@ -144,12 +144,12 @@ You can ssh into that server as the ``ubuntu`` user:
$ ssh ubuntu@192.168.200.86
You can log into your slaves using the ``ubuntu`` user as well. You can
get a list of slaves addresses by running:
You can log into your agents using the ``ubuntu`` user as well. You can
get a list of agents addresses by running:
::
$ heat output-show my-mesos-cluster mesos_slaves
$ heat output-show my-mesos-cluster mesos_agents
[
"192.168.200.182"
]

View File

@ -109,14 +109,14 @@ def validate_labels(labels):
def validate_labels_isolation(labels):
"""Validate mesos_slave_isolation"""
mesos_slave_isolation = labels.get('mesos_slave_isolation')
mesos_slave_isolation_list = mesos_slave_isolation.split(',')
unsupported_isolations = set(mesos_slave_isolation_list) - set(
"""Validate mesos_agent_isolation"""
mesos_agent_isolation = labels.get('mesos_agent_isolation')
mesos_agent_isolation_list = mesos_agent_isolation.split(',')
unsupported_isolations = set(mesos_agent_isolation_list) - set(
SUPPORTED_ISOLATION)
if (len(unsupported_isolations) > 0):
raise exception.InvalidParameterValue(_(
'property "labels/mesos_salve_isolation" with value '
'property "labels/mesos_agent_isolation" with value '
'"%(isolation_val)s" is not supported, supported values are: '
'%(supported_isolation)s') % {
'isolation_val': ', '.join(list(unsupported_isolations)),
@ -125,15 +125,15 @@ def validate_labels_isolation(labels):
def validate_labels_image_providers(labels):
"""Validate mesos_slave_image_providers"""
mesos_slave_image_providers = labels.get('mesos_slave_image_providers')
mesos_slave_image_providers_list = mesos_slave_image_providers.split(',')
"""Validate mesos_agent_image_providers"""
mesos_agent_image_providers = labels.get('mesos_agent_image_providers')
mesos_agent_image_providers_list = mesos_agent_image_providers.split(',')
isolation_with_valid_data = False
for image_providers_val in mesos_slave_image_providers_list:
for image_providers_val in mesos_agent_image_providers_list:
image_providers_val = image_providers_val.lower()
if image_providers_val not in SUPPORTED_IMAGE_PROVIDERS:
raise exception.InvalidParameterValue(_(
'property "labels/mesos_slave_image_providers" with value '
'property "labels/mesos_agent_image_providers" with value '
'"%(image_providers)s" is not supported, supported values '
'are: %(supported_image_providers)s') % {
'image_providers': image_providers_val,
@ -141,26 +141,26 @@ def validate_labels_image_providers(labels):
SUPPORTED_IMAGE_PROVIDERS + ['unspecified'])})
if image_providers_val == 'docker':
mesos_slave_isolation = labels.get('mesos_slave_isolation')
if mesos_slave_isolation is not None:
mesos_slave_isolation_list = mesos_slave_isolation.split(',')
for isolations_val in mesos_slave_isolation_list:
mesos_agent_isolation = labels.get('mesos_agent_isolation')
if mesos_agent_isolation is not None:
mesos_agent_isolation_list = mesos_agent_isolation.split(',')
for isolations_val in mesos_agent_isolation_list:
if isolations_val == 'docker/runtime':
isolation_with_valid_data = True
if mesos_slave_isolation is None or not isolation_with_valid_data:
if mesos_agent_isolation is None or not isolation_with_valid_data:
raise exception.RequiredParameterNotProvided(_(
"Docker runtime isolator has to be specified if 'docker' "
"is included in 'mesos_slave_image_providers' Please add "
"'docker/runtime' to 'mesos_slave_isolation' labels "
"is included in 'mesos_agent_image_providers' Please add "
"'docker/runtime' to 'mesos_agent_isolation' labels "
"flags"))
def validate_labels_executor_env_variables(labels):
"""Validate executor_environment_variables"""
mesos_slave_executor_env_val = labels.get(
'mesos_slave_executor_env_variables')
mesos_agent_executor_env_val = labels.get(
'mesos_agent_executor_env_variables')
try:
json.loads(mesos_slave_executor_env_val)
json.loads(mesos_agent_executor_env_val)
except ValueError:
err = (_("Json format error"))
raise exception.InvalidParameterValue(err)
@ -194,8 +194,8 @@ validators = {'image_id': validate_image,
'fixed_network': validate_fixed_network,
'labels': validate_labels}
labels_validators = {'mesos_slave_isolation': validate_labels_isolation,
'mesos_slave_image_providers':
labels_validators = {'mesos_agent_isolation': validate_labels_isolation,
'mesos_agent_image_providers':
validate_labels_image_providers,
'mesos_slave_executor_env_variables':
'mesos_agent_executor_env_variables':
validate_labels_executor_env_variables}

View File

@ -118,7 +118,7 @@ class Bay(base.APIBase):
"""Api address of cluster master node"""
node_addresses = wsme.wsattr([wtypes.text], readonly=True)
"""IP addresses of cluster slave nodes"""
"""IP addresses of cluster agent nodes"""
master_addresses = wsme.wsattr([wtypes.text], readonly=True)
"""IP addresses of cluster master nodes"""

View File

@ -51,11 +51,11 @@ class MesosMonitor(MonitorBase):
path='/state')
master = jsonutils.loads(urlfetch.get(mesos_master_url))
if self._is_leader(master):
for slave in master['slaves']:
self.data['mem_total'] += slave['resources']['mem']
self.data['mem_used'] += slave['used_resources']['mem']
self.data['cpu_total'] += slave['resources']['cpus']
self.data['cpu_used'] += slave['used_resources']['cpus']
for agent in master['agents']:
self.data['mem_total'] += agent['resources']['mem']
self.data['mem_used'] += agent['used_resources']['mem']
self.data['cpu_total'] += agent['resources']['cpus']
self.data['cpu_used'] += agent['used_resources']['cpus']
break
def compute_memory_util(self):

View File

@ -1,6 +1,6 @@
#!/bin/bash
for service in zookeeper mesos-slave mesos-master marathon; do
for service in zookeeper mesos-agent mesos-master marathon; do
service $service stop
[ -f /etc/init/$service.conf ] && echo "manual" > /etc/init/$service.override
done

View File

@ -28,11 +28,11 @@ class UbuntuMesosTemplateDefinition(template_def.BaseTemplateDefinition):
self.add_parameter('external_network',
baymodel_attr='external_network_id',
required=True)
self.add_parameter('number_of_slaves',
self.add_parameter('number_of_agents',
bay_attr='node_count')
self.add_parameter('master_flavor',
baymodel_attr='master_flavor_id')
self.add_parameter('slave_flavor',
self.add_parameter('agent_flavor',
baymodel_attr='flavor_id')
self.add_parameter('cluster_name',
bay_attr='name')
@ -45,9 +45,9 @@ class UbuntuMesosTemplateDefinition(template_def.BaseTemplateDefinition):
bay_attr=None)
self.add_output('mesos_master',
bay_attr='master_addresses')
self.add_output('mesos_slaves_private',
self.add_output('mesos_agents_private',
bay_attr=None)
self.add_output('mesos_slaves',
self.add_output('mesos_agents',
bay_attr='node_addresses')
def get_params(self, context, baymodel, bay, **kwargs):
@ -62,18 +62,18 @@ class UbuntuMesosTemplateDefinition(template_def.BaseTemplateDefinition):
extra_params['domain_name'] = context.domain_name
extra_params['region_name'] = osc.cinder_region_name()
label_list = ['rexray_preempt', 'mesos_slave_isolation',
'mesos_slave_image_providers',
'mesos_slave_work_dir',
'mesos_slave_executor_env_variables']
label_list = ['rexray_preempt', 'mesos_agent_isolation',
'mesos_agent_image_providers',
'mesos_agent_work_dir',
'mesos_agent_executor_env_variables']
for label in label_list:
extra_params[label] = baymodel.labels.get(label)
scale_mgr = kwargs.pop('scale_manager', None)
if scale_mgr:
hosts = self.get_output('mesos_slaves_private')
extra_params['slaves_to_remove'] = (
hosts = self.get_output('mesos_agents_private')
extra_params['agents_to_remove'] = (
scale_mgr.get_removal_nodes(hosts))
return super(UbuntuMesosTemplateDefinition,

View File

@ -2,7 +2,7 @@
. /etc/sysconfig/heat-params
echo "Configuring mesos (slave)"
echo "Configuring mesos (agent)"
myip=$(ip addr show eth0 |
awk '$1 == "inet" {print $2}' | cut -f1 -d/)
@ -17,31 +17,31 @@ zk=${zk::-1}
# Format: zk://host1:port1,...,hostN:portN/path
echo "zk://${zk}/mesos" > /etc/mesos/zk
# The hostname the slave should report
echo "$myip" > /etc/mesos-slave/hostname
# The hostname the agent should report
echo "$myip" > /etc/mesos-agent/hostname
# The IP address to listen on
echo "$myip" > /etc/mesos-slave/ip
echo "$myip" > /etc/mesos-agent/ip
# List of containerizer implementations
echo "docker,mesos" > /etc/mesos-slave/containerizers
echo "docker,mesos" > /etc/mesos-agent/containerizers
# Amount of time to wait for an executor to register
cat > /etc/mesos-slave/executor_registration_timeout <<EOF
cat > /etc/mesos-agent/executor_registration_timeout <<EOF
$EXECUTOR_REGISTRATION_TIMEOUT
EOF
if [ -n "$ISOLATION" ]; then
echo "$ISOLATION" > /etc/mesos-slave/isolation
echo "$ISOLATION" > /etc/mesos-agent/isolation
fi
if [ -n "$WORK_DIR" ]; then
echo "$WORK_DIR" > /etc/mesos-slave/work_dir
echo "$WORK_DIR" > /etc/mesos-agent/work_dir
fi
if [ -n "$IMAGE_PROVIDERS" ]; then
if [ -n "$ISOLATION" ]; then
echo "$IMAGE_PROVIDERS" > /etc/mesos-slave/image_providers
echo "$IMAGE_PROVIDERS" > /etc/mesos-agent/image_providers
else
echo "isolation doesn't exist, not setting image_providers"
fi
@ -49,5 +49,5 @@ fi
if [ -n "$EXECUTOR_ENVIRONMENT_VARIABLES" ]; then
echo "$EXECUTOR_ENVIRONMENT_VARIABLES" > /etc/executor_environment_variables
echo "file:///etc/executor_environment_variables" > /etc/mesos-slave/executor_environment_variables
echo "file:///etc/executor_environment_variables" > /etc/mesos-agent/executor_environment_variables
fi

View File

@ -1,7 +1,7 @@
#!/bin/sh
# Start slave services
for service in docker mesos-slave; do
# Start agent services
for service in docker mesos-agent; do
echo "starting service $service"
service $service start
rm -f /etc/init/$service.override

View File

@ -1,7 +1,7 @@
heat_template_version: 2014-10-16
description: >
This is a nested stack that defines a single Mesos slave, This stack is
This is a nested stack that defines a single Mesos agent, This stack is
included by a ResourceGroup resource in the parent template
(mesoscluster.yaml).
@ -11,7 +11,7 @@ parameters:
type: string
description: glance image used to boot the server
slave_flavor:
agent_flavor:
type: string
description: flavor to use when booting the server
@ -87,7 +87,7 @@ parameters:
enables any host to take control of a volume irrespective of whether
other hosts are using the volume
mesos_slave_isolation:
mesos_agent_isolation:
type: string
description: >
Isolation mechanisms to use, e.g., `posix/cpu,posix/mem`, or
@ -98,17 +98,17 @@ parameters:
module using the `--modules` flag. Note that this flag is only relevant
for the Mesos Containerizer.
mesos_slave_work_dir:
mesos_agent_work_dir:
type: string
description: directory path to place framework work directories
mesos_slave_image_providers:
mesos_agent_image_providers:
type: string
description: >
Comma separated list of supported image providers e.g.,
APPC,DOCKER
mesos_slave_executor_env_variables:
mesos_agent_executor_env_variables:
type: string
description: >
JSON object representing the environment variables that should be passed
@ -133,14 +133,14 @@ parameters:
resources:
slave_wait_handle:
agent_wait_handle:
type: OS::Heat::WaitConditionHandle
slave_wait_condition:
agent_wait_condition:
type: OS::Heat::WaitCondition
depends_on: mesos_slave
depends_on: mesos_agent
properties:
handle: {get_resource: slave_wait_handle}
handle: {get_resource: agent_wait_handle}
timeout: {get_param: wait_condition_timeout}
secgroup_all_open:
@ -178,24 +178,24 @@ resources:
"$REGION_NAME": {get_param: region_name}
"$DOMAIN_NAME": {get_param: domain_name}
"$REXRAY_PREEMPT": {get_param: rexray_preempt}
"$ISOLATION": {get_param: mesos_slave_isolation}
"$WORK_DIR": {get_param: mesos_slave_work_dir}
"$IMAGE_PROVIDERS": {get_param: mesos_slave_image_providers}
"$EXECUTOR_ENVIRONMENT_VARIABLES": {get_param: mesos_slave_executor_env_variables}
"$ISOLATION": {get_param: mesos_agent_isolation}
"$WORK_DIR": {get_param: mesos_agent_work_dir}
"$IMAGE_PROVIDERS": {get_param: mesos_agent_image_providers}
"$EXECUTOR_ENVIRONMENT_VARIABLES": {get_param: mesos_agent_executor_env_variables}
configure_mesos_slave:
configure_mesos_agent:
type: OS::Heat::SoftwareConfig
properties:
group: ungrouped
config: {get_file: fragments/configure-mesos-slave.sh}
config: {get_file: fragments/configure-mesos-agent.sh}
start_services:
type: OS::Heat::SoftwareConfig
properties:
group: ungrouped
config: {get_file: fragments/start-services-slave.sh}
config: {get_file: fragments/start-services-agent.sh}
slave_wc_notify:
agent_wc_notify:
type: OS::Heat::SoftwareConfig
properties:
group: ungrouped
@ -205,7 +205,7 @@ resources:
#!/bin/bash -v
wc_notify --data-binary '{"status": "SUCCESS"}'
params:
wc_notify: {get_attr: [slave_wait_handle, curl_cli]}
wc_notify: {get_attr: [agent_wait_handle, curl_cli]}
add_proxy:
type: OS::Heat::SoftwareConfig
@ -219,34 +219,34 @@ resources:
group: ungrouped
config: {get_file: fragments/volume-service.sh}
mesos_slave_init:
mesos_agent_init:
type: OS::Heat::MultipartMime
properties:
parts:
- config: {get_resource: write_heat_params}
- config: {get_resource: configure_mesos_slave}
- config: {get_resource: configure_mesos_agent}
- config: {get_resource: add_proxy}
- config: {get_resource: volume_service}
- config: {get_resource: start_services}
- config: {get_resource: slave_wc_notify}
- config: {get_resource: agent_wc_notify}
######################################################################
#
# a single Mesos agent.
#
mesos_slave:
mesos_agent:
type: OS::Nova::Server
properties:
image: {get_param: server_image}
flavor: {get_param: slave_flavor}
flavor: {get_param: agent_flavor}
key_name: {get_param: ssh_key_name}
user_data_format: RAW
user_data: {get_resource: mesos_slave_init}
user_data: {get_resource: mesos_agent_init}
networks:
- port: {get_resource: mesos_slave_eth0}
- port: {get_resource: mesos_agent_eth0}
mesos_slave_eth0:
mesos_agent_eth0:
type: OS::Neutron::Port
properties:
network: {get_param: fixed_network}
@ -257,19 +257,19 @@ resources:
- subnet: {get_param: fixed_subnet}
replacement_policy: AUTO
mesos_slave_floating:
mesos_agent_floating:
type: OS::Neutron::FloatingIP
properties:
floating_network: {get_param: external_network}
port_id: {get_resource: mesos_slave_eth0}
port_id: {get_resource: mesos_agent_eth0}
outputs:
mesos_slave_ip:
value: {get_attr: [mesos_slave_eth0, fixed_ips, 0, ip_address]}
mesos_agent_ip:
value: {get_attr: [mesos_agent_eth0, fixed_ips, 0, ip_address]}
description: >
This is the "private" address of the Mesos agent node.
mesos_slave_external_ip:
value: {get_attr: [mesos_slave_floating, floating_ip_address]}
mesos_agent_external_ip:
value: {get_attr: [mesos_agent_floating, floating_ip_address]}
description: >
This is the "public" address of the Mesos agent node.

View File

@ -3,7 +3,7 @@ heat_template_version: 2014-10-16
description: >
This template will boot a Mesos cluster with one or more masters
(as specified by number_of_masters, default is 1) and one or more agents
(as specified by the number_of_slaves parameter, which
(as specified by the number_of_agents parameter, which
defaults to 1).
parameters:
@ -27,7 +27,7 @@ parameters:
default: m1.small
description: flavor to use when booting the master server
slave_flavor:
agent_flavor:
type: string
default: m1.small
description: flavor to use when booting the agent server
@ -37,9 +37,9 @@ parameters:
description: address of a dns nameserver reachable in your environment
default: 8.8.8.8
number_of_slaves:
number_of_agents:
type: number
description: how many mesos slaves to spawn initially
description: how many mesos agents to spawn initially
default: 1
fixed_network_cidr:
@ -61,7 +61,7 @@ parameters:
executor_registration_timeout:
type: string
description: >
Amount of time to wait for an executor to register with the slave before
Amount of time to wait for an executor to register with the agent before
considering it hung and shutting it down
default: 5mins
@ -156,7 +156,7 @@ parameters:
type: string
description: url for keystone
mesos_slave_isolation:
mesos_agent_isolation:
type: string
description: >
Isolation mechanisms to use, e.g., `posix/cpu,posix/mem`, or
@ -168,19 +168,19 @@ parameters:
for the Mesos Containerizer.
default: ""
mesos_slave_work_dir:
mesos_agent_work_dir:
type: string
description: directory path to place framework work directories
default: ""
mesos_slave_image_providers:
mesos_agent_image_providers:
type: string
description: >
Comma separated list of supported image providers e.g.,
APPC,DOCKER
default: ""
mesos_slave_executor_env_variables:
mesos_agent_executor_env_variables:
type: string
description: >
JSON object representing the environment variables that should be passed
@ -188,10 +188,10 @@ parameters:
executor will inherit the agent's environment variables.
default: ""
slaves_to_remove:
agents_to_remove:
type: comma_delimited_list
description: >
List of slaves to be removed when doing an update. Individual slave may
List of agents to be removed when doing an update. Individual agent may
be referenced several ways: (1) The resource name (e.g.['1', '3']),
(2) The private IP address ['10.0.0.4', '10.0.0.6']. Note: the list should
be empty when doing a create.
@ -410,23 +410,23 @@ resources:
######################################################################
#
# Mesos slaves. This is a resource group that will initially
# create <number_of_slaves> slaves, and needs to be manually scaled.
# Mesos agents. This is a resource group that will initially
# create <number_of_agents> agents, and needs to be manually scaled.
#
mesos_slaves:
mesos_agents:
type: OS::Heat::ResourceGroup
depends_on:
- extrouter_inside
properties:
count: {get_param: number_of_slaves}
removal_policies: [{resource_list: {get_param: slaves_to_remove}}]
count: {get_param: number_of_agents}
removal_policies: [{resource_list: {get_param: agents_to_remove}}]
resource_def:
type: mesosslave.yaml
type: mesosagent.yaml
properties:
ssh_key_name: {get_param: ssh_key_name}
server_image: {get_param: server_image}
slave_flavor: {get_param: slave_flavor}
agent_flavor: {get_param: agent_flavor}
fixed_network: {get_resource: fixed_network}
fixed_subnet: {get_resource: fixed_subnet}
mesos_masters_ips: {list_join: [' ', {get_attr: [mesos_masters, mesos_master_ip]}]}
@ -445,10 +445,10 @@ resources:
region_name: {get_param: region_name}
domain_name: {get_param: domain_name}
rexray_preempt: {get_param: rexray_preempt}
mesos_slave_isolation: {get_param: mesos_slave_isolation}
mesos_slave_work_dir: {get_param: mesos_slave_work_dir}
mesos_slave_image_providers: {get_param: mesos_slave_image_providers}
mesos_slave_executor_env_variables: {get_param: mesos_slave_executor_env_variables}
mesos_agent_isolation: {get_param: mesos_agent_isolation}
mesos_agent_work_dir: {get_param: mesos_agent_work_dir}
mesos_agent_image_providers: {get_param: mesos_agent_image_providers}
mesos_agent_executor_env_variables: {get_param: mesos_agent_executor_env_variables}
outputs:
@ -470,12 +470,12 @@ outputs:
log in to the Mesos master via ssh or to access the Mesos API
from outside the cluster.
mesos_slaves_private:
value: {get_attr: [mesos_slaves, mesos_slave_ip]}
mesos_agent_private:
value: {get_attr: [mesos_agents, mesos_agent_ip]}
description: >
This is a list of the "private" addresses of all the Mesos agents.
mesos_slaves:
value: {get_attr: [mesos_slaves, mesos_slave_external_ip]}
mesos_agents:
value: {get_attr: [mesos_agents, mesos_agent_external_ip]}
description: >
This is a list of the "public" addresses of all the Mesos agents.

View File

@ -0,0 +1,53 @@
#!/bin/bash
. /etc/sysconfig/heat-params
echo "Configuring mesos (agent)"
myip=$(ip addr show eth0 |
awk '$1 == "inet" {print $2}' | cut -f1 -d/)
zk=""
for master_ip in $MESOS_MASTERS_IPS; do
zk="${zk}${master_ip}:2181,"
done
# Remove last ','
zk=${zk::-1}
# Zookeeper URL. This specifies how to connect to a quorum of masters
# Format: zk://host1:port1,...,hostN:portN/path
echo "zk://${zk}/mesos" > /etc/mesos/zk
# The hostname the agent should report
echo "$myip" > /etc/mesos-agent/hostname
# The IP address to listen on
echo "$myip" > /etc/mesos-agent/ip
# List of containerizer implementations
echo "docker,mesos" > /etc/mesos-agent/containerizers
# Amount of time to wait for an executor to register
cat > /etc/mesos-agent/executor_registration_timeout <<EOF
$EXECUTOR_REGISTRATION_TIMEOUT
EOF
if [ -n "$ISOLATION" ]; then
echo "$ISOLATION" > /etc/mesos-agent/isolation
fi
if [ -n "$WORK_DIR" ]; then
echo "$WORK_DIR" > /etc/mesos-agent/work_dir
fi
if [ -n "$IMAGE_PROVIDERS" ]; then
if [ -n "$ISOLATION" ]; then
echo "$IMAGE_PROVIDERS" > /etc/mesos-agent/image_providers
else
echo "isolation doesn't exist, not setting image_providers"
fi
fi
if [ -n "$EXECUTOR_ENVIRONMENT_VARIABLES" ]; then
echo "$EXECUTOR_ENVIRONMENT_VARIABLES" > /etc/executor_environment_variables
echo "file:///etc/executor_environment_variables" > /etc/mesos-agent/executor_environment_variables
fi

View File

@ -0,0 +1,8 @@
#!/bin/sh
# Start agent services
for service in docker mesos-agent; do
echo "starting service $service"
service $service start
rm -f /etc/init/$service.override
done

View File

@ -0,0 +1,275 @@
heat_template_version: 2014-10-16
description: >
This is a nested stack that defines a single Mesos agent, This stack is
included by a ResourceGroup resource in the parent template
(mesoscluster.yaml).
parameters:
server_image:
type: string
description: glance image used to boot the server
agent_flavor:
type: string
description: flavor to use when booting the server
ssh_key_name:
type: string
description: name of ssh key to be provisioned on our server
external_network:
type: string
description: uuid/name of a network to use for floating ip addresses
wait_condition_timeout:
type: number
description : >
timeout for the Wait Conditions
executor_registration_timeout:
type: string
description: >
Amount of time to wait for an executor to register with the agent before
considering it hung and shutting it down
http_proxy:
type: string
description: http proxy address for docker
https_proxy:
type: string
description: https proxy address for docker
no_proxy:
type: string
description: no proxies for docker
auth_url:
type: string
description: >
url for mesos to authenticate before sending request
username:
type: string
description: user name
password:
type: string
description: >
user password, not set in current implementation, only used to
fill in for Kubernetes config file
hidden: true
tenant_name:
type: string
description: >
tenant_name is used to isolate access to Compute resources
volume_driver:
type: string
description: volume driver to use for container storage
region_name:
type: string
description: A logically separate section of the cluster
domain_name:
type: string
description: >
domain is to define the administrative boundaries for management
of Keystone entities
rexray_preempt:
type: string
description: >
enables any host to take control of a volume irrespective of whether
other hosts are using the volume
mesos_agent_isolation:
type: string
description: >
Isolation mechanisms to use, e.g., `posix/cpu,posix/mem`, or
`cgroups/cpu,cgroups/mem`, or network/port_mapping (configure with flag:
`--with-network-isolator` to enable), or `cgroups/devices/gpus/nvidia`
for nvidia specific gpu isolation (configure with flag: `--enable-nvidia
-gpu-support` to enable), or `external`, or load an alternate isolator
module using the `--modules` flag. Note that this flag is only relevant
for the Mesos Containerizer.
mesos_agent_work_dir:
type: string
description: directory path to place framework work directories
mesos_agent_image_providers:
type: string
description: >
Comma separated list of supported image providers e.g.,
APPC,DOCKER
mesos_agent_executor_env_variables:
type: string
description: >
JSON object representing the environment variables that should be passed
to the executor, and thus subsequently task(s). By default the executor,
executor will inherit the agent's environment variables.
mesos_masters_ips:
type: string
description: IP addresses of the Mesos master servers.
fixed_network:
type: string
description: Network from which to allocate fixed addresses.
fixed_subnet:
type: string
description: Subnet from which to allocate fixed addresses.
secgroup_base_id:
type: string
description: ID of the security group for base.
resources:
agent_wait_handle:
type: OS::Heat::WaitConditionHandle
agent_wait_condition:
type: OS::Heat::WaitCondition
depends_on: mesos_agent
properties:
handle: {get_resource: agent_wait_handle}
timeout: {get_param: wait_condition_timeout}
secgroup_all_open:
type: OS::Neutron::SecurityGroup
properties:
rules:
- protocol: icmp
- protocol: tcp
- protocol: udp
######################################################################
#
# software configs. these are components that are combined into
# a multipart MIME user-data archive.
#
write_heat_params:
type: OS::Heat::SoftwareConfig
properties:
group: ungrouped
config:
str_replace:
template: {get_file: fragments/write-heat-params.yaml}
params:
"$MESOS_MASTERS_IPS": {get_param: mesos_masters_ips}
"$EXECUTOR_REGISTRATION_TIMEOUT": {get_param: executor_registration_timeout}
"$HTTP_PROXY": {get_param: http_proxy}
"$HTTPS_PROXY": {get_param: https_proxy}
"$NO_PROXY": {get_param: no_proxy}
"$AUTH_URL": {get_param: auth_url}
"$USERNAME": {get_param: username}
"$PASSWORD": {get_param: password}
"$TENANT_NAME": {get_param: tenant_name}
"$VOLUME_DRIVER": {get_param: volume_driver}
"$REGION_NAME": {get_param: region_name}
"$DOMAIN_NAME": {get_param: domain_name}
"$REXRAY_PREEMPT": {get_param: rexray_preempt}
"$ISOLATION": {get_param: mesos_agent_isolation}
"$WORK_DIR": {get_param: mesos_agent_work_dir}
"$IMAGE_PROVIDERS": {get_param: mesos_agent_image_providers}
"$EXECUTOR_ENVIRONMENT_VARIABLES": {get_param: mesos_agent_executor_env_variables}
configure_mesos_agent:
type: OS::Heat::SoftwareConfig
properties:
group: ungrouped
config: {get_file: fragments/configure-mesos-agent.sh}
start_services:
type: OS::Heat::SoftwareConfig
properties:
group: ungrouped
config: {get_file: fragments/start-services-agent.sh}
agent_wc_notify:
type: OS::Heat::SoftwareConfig
properties:
group: ungrouped
config:
str_replace:
template: |
#!/bin/bash -v
wc_notify --data-binary '{"status": "SUCCESS"}'
params:
wc_notify: {get_attr: [agent_wait_handle, curl_cli]}
add_proxy:
type: OS::Heat::SoftwareConfig
properties:
group: ungrouped
config: {get_file: fragments/add-proxy.sh}
volume_service:
type: OS::Heat::SoftwareConfig
properties:
group: ungrouped
config: {get_file: fragments/volume-service.sh}
mesos_agent_init:
type: OS::Heat::MultipartMime
properties:
parts:
- config: {get_resource: write_heat_params}
- config: {get_resource: configure_mesos_agent}
- config: {get_resource: add_proxy}
- config: {get_resource: volume_service}
- config: {get_resource: start_services}
- config: {get_resource: agent_wc_notify}
######################################################################
#
# a single Mesos agent.
#
mesos_agent:
type: OS::Nova::Server
properties:
image: {get_param: server_image}
flavor: {get_param: agent_flavor}
key_name: {get_param: ssh_key_name}
user_data_format: RAW
user_data: {get_resource: mesos_agent_init}
networks:
- port: {get_resource: mesos_agent_eth0}
mesos_agent_eth0:
type: OS::Neutron::Port
properties:
network: {get_param: fixed_network}
security_groups:
- get_resource: secgroup_all_open
- get_param: secgroup_base_id
fixed_ips:
- subnet: {get_param: fixed_subnet}
replacement_policy: AUTO
mesos_agent_floating:
type: OS::Neutron::FloatingIP
properties:
floating_network: {get_param: external_network}
port_id: {get_resource: mesos_agent_eth0}
outputs:
mesos_agent_ip:
value: {get_attr: [mesos_agent_eth0, fixed_ips, 0, ip_address]}
description: >
This is the "private" address of the Mesos agent node.
mesos_agent_external_ip:
value: {get_attr: [mesos_agent_floating, floating_ip_address]}
description: >
This is the "public" address of the Mesos agent node.

View File

@ -176,7 +176,7 @@ class BaseMagnumTest(base.BaseTestCase):
:param get_nodes_fn: function that takes no parameters and returns
a list of node IPs which are in such form:
[[master_nodes], [slave_nodes]].
[[master_nodes], [agent_nodes]].
:param coe: the COE type of the nodes
"""
@ -192,7 +192,7 @@ class BaseMagnumTest(base.BaseTestCase):
nodes_addresses = get_nodes_fn()
master_nodes = nodes_addresses[0]
slave_nodes = nodes_addresses[1]
agent_nodes = nodes_addresses[1]
base_path = os.path.split(os.path.dirname(
os.path.abspath(magnum.__file__)))[0]
@ -221,7 +221,7 @@ class BaseMagnumTest(base.BaseTestCase):
log_name, node_address))
do_copy_logs('master', master_nodes)
do_copy_logs('node', slave_nodes)
do_copy_logs('node', agent_nodes)
except Exception:
cls.LOG.exception(msg)

View File

@ -294,7 +294,7 @@ extendedKeyUsage = clientAuth
elif self.baymodel.coe == "swarm":
output_keys = ["swarm_masters", "swarm_nodes"]
elif self.baymodel.coe == "mesos":
output_keys = ["mesos_master", "mesos_slaves"]
output_keys = ["mesos_master", "mesos_agents"]
for output in stack_outputs:
for key in output_keys:
if output['output_key'] == key:

View File

@ -101,54 +101,54 @@ class TestAttrValidator(base.BaseTestCase):
mock_os_cli, 'test_keypair')
def test_validate_labels_main_isolation_invalid(self):
fake_labels = {'mesos_slave_isolation': 'abc'}
fake_labels = {'mesos_agent_isolation': 'abc'}
self.assertRaises(exception.InvalidParameterValue,
attr_validator.validate_labels,
fake_labels)
def test_validate_labels_isolation_valid(self):
fake_labels = {'mesos_slave_isolation':
fake_labels = {'mesos_agent_isolation':
'filesystem/posix,filesystem/linux'}
attr_validator.validate_labels_isolation(fake_labels)
def test_validate_labels_main_with_valid_providers_none_isolation(self):
fake_labels = {'mesos_slave_image_providers': 'docker'}
fake_labels = {'mesos_agent_image_providers': 'docker'}
self.assertRaises(exception.RequiredParameterNotProvided,
attr_validator.validate_labels,
fake_labels)
def test_validate_labels_with_valid_providers_invalid_isolation(self):
fake_labels = {'mesos_slave_image_providers': 'docker',
'mesos_slave_isolation': 'abc'}
fake_labels = {'mesos_agent_image_providers': 'docker',
'mesos_agent_isolation': 'abc'}
self.assertRaises(exception.RequiredParameterNotProvided,
attr_validator.validate_labels_image_providers,
fake_labels)
def test_validate_labels_with_invalid_providers(self):
fake_labels = {'mesos_slave_image_providers': 'abc'}
fake_labels = {'mesos_agent_image_providers': 'abc'}
self.assertRaises(exception.InvalidParameterValue,
attr_validator.validate_labels_image_providers,
fake_labels)
def test_validate_labels_with_valid_providers_none_isolation(self):
fake_labels = {'mesos_slave_image_providers': 'docker'}
fake_labels = {'mesos_agent_image_providers': 'docker'}
self.assertRaises(exception.RequiredParameterNotProvided,
attr_validator.validate_labels_image_providers,
fake_labels)
def test_validate_labels_with_valid_providers_valid_isolation(self):
fake_labels = {'mesos_slave_image_providers': 'docker',
'mesos_slave_isolation': 'docker/runtime'}
fake_labels = {'mesos_agent_image_providers': 'docker',
'mesos_agent_isolation': 'docker/runtime'}
attr_validator.validate_labels_image_providers(fake_labels)
def test_validate_labels_with_environment_variables_valid_json(self):
contents = '{"step": "upgrade", "interface": "deploy"}'
fack_labels = {'mesos_slave_executor_env_variables': contents}
fack_labels = {'mesos_agent_executor_env_variables': contents}
attr_validator.validate_labels_executor_env_variables(
fack_labels)
def test_validate_labels_with_environment_variables_bad_json(self):
fack_labels = {'mesos_slave_executor_env_variables': 'step'}
fack_labels = {'mesos_agent_executor_env_variables': 'step'}
self.assertRaisesRegex(
exception.InvalidParameterValue,
"Json format error",
@ -156,12 +156,12 @@ class TestAttrValidator(base.BaseTestCase):
fack_labels)
def test_validate_labels_with_valid_isolation(self):
fake_labels = {'mesos_slave_isolation':
fake_labels = {'mesos_agent_isolation':
'filesystem/posix,filesystem/linux'}
attr_validator.validate_labels_isolation(fake_labels)
def test_validate_labels_isolation_invalid(self):
fake_labels = {'mesos_slave_isolation': 'filesystem'}
fake_labels = {'mesos_agent_isolation': 'filesystem'}
self.assertRaises(exception.InvalidParameterValue,
attr_validator.validate_labels_isolation,
fake_labels)

View File

@ -40,11 +40,11 @@ class TestBayConductorWithMesos(base.TestCase):
'server_type': 'vm',
'volume_driver': 'volume_driver',
'labels': {'rexray_preempt': 'False',
'mesos_slave_isolation':
'docker/runtime,filesystem/linux',
'mesos_slave_image_providers': 'docker',
'mesos_slave_executor_env_variables': '{}',
'mesos_slave_work_dir': '/tmp/mesos/slave'
'mesos_agent_isolation':
'docker/runtime,filesystem/linux',
'mesos_agent_image_providers': 'docker',
'mesos_agent_executor_env_variables': '{}',
'mesos_agent_work_dir': '/tmp/mesos/agent'
},
'master_lb_enabled': False,
}
@ -96,8 +96,8 @@ class TestBayConductorWithMesos(base.TestCase):
'dns_nameserver': 'dns_nameserver',
'server_image': 'image_id',
'master_flavor': 'master_flavor_id',
'slave_flavor': 'flavor_id',
'number_of_slaves': 1,
'agent_flavor': 'flavor_id',
'number_of_agents': 1,
'number_of_masters': 1,
'http_proxy': 'http_proxy',
'https_proxy': 'https_proxy',
@ -115,10 +115,10 @@ class TestBayConductorWithMesos(base.TestCase):
'tenant_name': 'admin',
'domain_name': 'domainname',
'rexray_preempt': 'False',
'mesos_slave_executor_env_variables': '{}',
'mesos_slave_isolation': 'docker/runtime,filesystem/linux',
'mesos_slave_work_dir': '/tmp/mesos/slave',
'mesos_slave_image_providers': 'docker'
'mesos_agent_executor_env_variables': '{}',
'mesos_agent_isolation': 'docker/runtime,filesystem/linux',
'mesos_agent_work_dir': '/tmp/mesos/agent',
'mesos_agent_image_providers': 'docker'
}
self.assertEqual(expected, definition)
self.assertEqual(['environments/no_master_lb.yaml'], env_files)
@ -145,7 +145,7 @@ class TestBayConductorWithMesos(base.TestCase):
expected = {
'ssh_key_name': 'keypair_id',
'external_network': 'external_network_id',
'number_of_slaves': 1,
'number_of_agents': 1,
'number_of_masters': 1,
'cluster_name': 'bay1',
'trustee_domain_id': self.mock_keystone.trustee_domain_id,
@ -159,10 +159,10 @@ class TestBayConductorWithMesos(base.TestCase):
'tenant_name': 'admin',
'domain_name': 'domainname',
'rexray_preempt': 'False',
'mesos_slave_isolation': 'docker/runtime,filesystem/linux',
'mesos_slave_executor_env_variables': '{}',
'mesos_slave_work_dir': '/tmp/mesos/slave',
'mesos_slave_image_providers': 'docker'
'mesos_agent_isolation': 'docker/runtime,filesystem/linux',
'mesos_agent_executor_env_variables': '{}',
'mesos_agent_work_dir': '/tmp/mesos/agent',
'mesos_agent_image_providers': 'docker'
}
self.assertEqual(expected, definition)
self.assertEqual(['environments/no_master_lb.yaml'], env_files)
@ -187,8 +187,8 @@ class TestBayConductorWithMesos(base.TestCase):
'dns_nameserver': 'dns_nameserver',
'server_image': 'image_id',
'master_flavor': 'master_flavor_id',
'slave_flavor': 'flavor_id',
'number_of_slaves': 1,
'agent_flavor': 'flavor_id',
'number_of_agents': 1,
'number_of_masters': 1,
'http_proxy': 'http_proxy',
'https_proxy': 'https_proxy',
@ -206,10 +206,10 @@ class TestBayConductorWithMesos(base.TestCase):
'tenant_name': 'admin',
'domain_name': 'domainname',
'rexray_preempt': 'False',
'mesos_slave_executor_env_variables': '{}',
'mesos_slave_isolation': 'docker/runtime,filesystem/linux',
'mesos_slave_work_dir': '/tmp/mesos/slave',
'mesos_slave_image_providers': 'docker'
'mesos_agent_executor_env_variables': '{}',
'mesos_agent_isolation': 'docker/runtime,filesystem/linux',
'mesos_agent_work_dir': '/tmp/mesos/agent',
'mesos_agent_image_providers': 'docker'
}
self.assertEqual(expected, definition)
self.assertEqual(['environments/with_master_lb.yaml'], env_files)
@ -235,8 +235,8 @@ class TestBayConductorWithMesos(base.TestCase):
'dns_nameserver': 'dns_nameserver',
'server_image': 'image_id',
'master_flavor': 'master_flavor_id',
'slave_flavor': 'flavor_id',
'number_of_slaves': 1,
'agent_flavor': 'flavor_id',
'number_of_agents': 1,
'number_of_masters': 2,
'http_proxy': 'http_proxy',
'https_proxy': 'https_proxy',
@ -254,10 +254,10 @@ class TestBayConductorWithMesos(base.TestCase):
'tenant_name': 'admin',
'domain_name': 'domainname',
'rexray_preempt': 'False',
'mesos_slave_executor_env_variables': '{}',
'mesos_slave_isolation': 'docker/runtime,filesystem/linux',
'mesos_slave_work_dir': '/tmp/mesos/slave',
'mesos_slave_image_providers': 'docker'
'mesos_agent_executor_env_variables': '{}',
'mesos_agent_isolation': 'docker/runtime,filesystem/linux',
'mesos_agent_work_dir': '/tmp/mesos/agent',
'mesos_agent_image_providers': 'docker'
}
self.assertEqual(expected, definition)
self.assertEqual(['environments/with_master_lb.yaml'], env_files)
@ -281,7 +281,7 @@ class TestBayConductorWithMesos(base.TestCase):
def test_poll_node_count(self):
mock_heat_stack, bay, poller = self.setup_poll_test()
mock_heat_stack.parameters = {'number_of_slaves': 1}
mock_heat_stack.parameters = {'number_of_agents': 1}
mock_heat_stack.stack_status = bay_status.CREATE_IN_PROGRESS
poller.poll_and_check()
@ -290,7 +290,7 @@ class TestBayConductorWithMesos(base.TestCase):
def test_poll_node_count_by_update(self):
mock_heat_stack, bay, poller = self.setup_poll_test()
mock_heat_stack.parameters = {'number_of_slaves': 2}
mock_heat_stack.parameters = {'number_of_agents': 2}
mock_heat_stack.stack_status = bay_status.UPDATE_COMPLETE
self.assertRaises(loopingcall.LoopingCallDone, poller.poll_and_check)

View File

@ -262,7 +262,7 @@ class MonitorsTestCase(base.TestCase):
state_json = {
'leader': 'master@10.0.0.6:5050',
'pid': 'master@10.0.0.6:5050',
'slaves': [{
'agents': [{
'resources': {
'mem': 100,
'cpus': 1,
@ -281,7 +281,7 @@ class MonitorsTestCase(base.TestCase):
state_json = {
'leader': 'master@10.0.0.6:5050',
'pid': 'master@1.1.1.1:5050',
'slaves': []
'agents': []
}
self._test_mesos_monitor_pull_data(mock_url_get, state_json,
0, 0, 0, 0)

View File

@ -666,13 +666,13 @@ class UbuntuMesosTemplateDefinitionTestCase(base.TestCase):
mock_baymodel = mock.MagicMock()
mock_baymodel.tls_disabled = False
rexray_preempt = mock_baymodel.labels.get('rexray_preempt')
mesos_slave_isolation = mock_baymodel.labels.get(
'mesos_slave_isolation')
mesos_slave_work_dir = mock_baymodel.labels.get('mesos_slave_work_dir')
mesos_slave_image_providers = mock_baymodel.labels.get(
mesos_agent_isolation = mock_baymodel.labels.get(
'mesos_agent_isolation')
mesos_agent_work_dir = mock_baymodel.labels.get('mesos_agent_work_dir')
mesos_agent_image_providers = mock_baymodel.labels.get(
'image_providers')
mesos_slave_executor_env_variables = mock_baymodel.labels.get(
'mesos_slave_executor_env_variables')
mesos_agent_executor_env_variables = mock_baymodel.labels.get(
'mesos_agent_executor_env_variables')
mock_bay = mock.MagicMock()
mock_bay.uuid = '5d12f6fd-a196-4bf0-ae4c-1f639a523a52'
del mock_bay.stack_id
@ -696,12 +696,12 @@ class UbuntuMesosTemplateDefinitionTestCase(base.TestCase):
'tenant_name': 'admin',
'domain_name': 'domainname',
'rexray_preempt': rexray_preempt,
'mesos_slave_isolation': mesos_slave_isolation,
'mesos_slave_work_dir': mesos_slave_work_dir,
'mesos_slave_executor_env_variables':
mesos_slave_executor_env_variables,
'mesos_slave_image_providers': mesos_slave_image_providers,
'slaves_to_remove': removal_nodes}}
'mesos_agent_isolation': mesos_agent_isolation,
'mesos_agent_work_dir': mesos_agent_work_dir,
'mesos_agent_executor_env_variables':
mesos_agent_executor_env_variables,
'mesos_agent_image_providers': mesos_agent_image_providers,
'agents_to_remove': removal_nodes}}
mock_get_params.assert_called_once_with(mock_context, mock_baymodel,
mock_bay, **expected_kwargs)
@ -709,7 +709,7 @@ class UbuntuMesosTemplateDefinitionTestCase(base.TestCase):
mesos_def = mesos_tdef.UbuntuMesosTemplateDefinition()
heat_param = mesos_def.get_heat_param(bay_attr='node_count')
self.assertEqual('number_of_slaves', heat_param)
self.assertEqual('number_of_agents', heat_param)
heat_param = mesos_def.get_heat_param(bay_attr='master_count')
self.assertEqual('number_of_masters', heat_param)
@ -718,7 +718,7 @@ class UbuntuMesosTemplateDefinitionTestCase(base.TestCase):
mesos_def = mesos_tdef.UbuntuMesosTemplateDefinition()
expected_api_address = 'updated_address'
expected_node_addresses = ['ex_slave', 'address']
expected_node_addresses = ['ex_agent', 'address']
expected_master_addresses = ['ex_master', 'address']
outputs = [
@ -733,10 +733,10 @@ class UbuntuMesosTemplateDefinitionTestCase(base.TestCase):
"output_key": "mesos_master"},
{"output_value": ['any', 'output'],
"description": "No description given",
"output_key": "mesos_slaves_private"},
"output_key": "mesos_agents_private"},
{"output_value": expected_node_addresses,
"description": "No description given",
"output_key": "mesos_slaves"},
"output_key": "mesos_agents"},
]
mock_stack = mock.MagicMock()
mock_stack.to_dict.return_value = {'outputs': outputs}