Browse Source

Merge "Enable Mesos Bay export more slave flags"

changes/67/308967/1
Jenkins 6 years ago committed by Gerrit Code Review
parent
commit
b5068b59ed
  1. 5
      magnum/conductor/template_definition.py
  2. 20
      magnum/templates/mesos/fragments/configure-mesos-slave.sh
  3. 4
      magnum/templates/mesos/fragments/write-heat-params.yaml
  4. 36
      magnum/templates/mesos/mesoscluster.yaml
  5. 32
      magnum/templates/mesos/mesosslave.yaml
  6. 20
      magnum/tests/unit/conductor/handlers/test_mesos_bay_conductor.py
  7. 14
      magnum/tests/unit/conductor/test_template_definition.py

5
magnum/conductor/template_definition.py

@ -663,7 +663,10 @@ class UbuntuMesosTemplateDefinition(BaseTemplateDefinition):
extra_params['domain_name'] = context.domain_name
extra_params['region_name'] = osc.cinder_region_name()
label_list = ['rexray_preempt']
label_list = ['rexray_preempt', 'mesos_slave_isolation',
'mesos_slave_image_providers',
'mesos_slave_work_dir',
'mesos_slave_executor_environment_variables']
for label in label_list:
extra_params[label] = baymodel.labels.get(label)

20
magnum/templates/mesos/fragments/configure-mesos-slave.sh

@ -30,3 +30,23 @@ echo "docker,mesos" > /etc/mesos-slave/containerizers
cat > /etc/mesos-slave/executor_registration_timeout <<EOF
$EXECUTOR_REGISTRATION_TIMEOUT
EOF
if [ -n "$ISOLATION" ]; then
echo "$ISOLATION" > /etc/mesos-slave/isolation
fi
if [ -n "$WORK_DIR" ]; then
echo "$WORK_DIR" > /etc/mesos-slave/work_dir
fi
if [ -n "$IMAGE_PROVIDERS" ]; then
if [ -n "$ISOLATION" ]; then
echo "$IMAGE_PROVIDERS" > /etc/mesos-slave/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/mesos-slave/executor_environment_variables
fi

4
magnum/templates/mesos/fragments/write-heat-params.yaml

@ -18,3 +18,7 @@ write_files:
REGION_NAME="$REGION_NAME"
DOMAIN_NAME="$DOMAIN_NAME"
REXRAY_PREEMPT="$REXRAY_PREEMPT"
ISOLATION="$ISOLATION"
WORK_DIR="$WORK_DIR"
IMAGE_PROVIDERS="$IMAGE_PROVIDERS"
EXECUTOR_ENVIRONMENT_VARIABLES="$EXECUTOR_ENVIRONMENT_VARIABLES"

36
magnum/templates/mesos/mesoscluster.yaml

@ -155,6 +155,38 @@ parameters:
type: string
description: url for keystone
mesos_slave_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.
default: ""
mesos_slave_work_dir:
type: string
description: directory path to place framework work directories
default: ""
mesos_slave_image_providers:
type: string
description: >
Comma separated list of supported image providers e.g.,
APPC,DOCKER
default: ""
mesos_slave_executor_environment_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.
default: ""
resources:
######################################################################
@ -388,6 +420,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_environment_variables: {get_param: mesos_slave_executor_environment_variables}
outputs:

32
magnum/templates/mesos/mesosslave.yaml

@ -87,6 +87,34 @@ parameters:
enables any host to take control of a volume irrespective of whether
other hosts are using the volume
mesos_slave_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_slave_work_dir:
type: string
description: directory path to place framework work directories
mesos_slave_image_providers:
type: string
description: >
Comma separated list of supported image providers e.g.,
APPC,DOCKER
mesos_slave_executor_environment_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.
@ -150,6 +178,10 @@ 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_environment_variables}
configure_mesos_slave:
type: OS::Heat::SoftwareConfig

20
magnum/tests/unit/conductor/handlers/test_mesos_bay_conductor.py

@ -40,7 +40,13 @@ class TestBayConductorWithMesos(base.TestCase):
'no_proxy': 'no_proxy',
'server_type': 'vm',
'volume_driver': 'volume_driver',
'labels': {'rexray_preempt': 'False'}
'labels': {'rexray_preempt': 'False',
'mesos_slave_isolation':
'docker/runtime,filesystem/linux',
'mesos_slave_image_providers': 'docker',
'mesos_slave_executor_environment_variables': '{}',
'mesos_slave_work_dir': '/tmp/mesos/slave'
}
}
self.bay_dict = {
'id': 1,
@ -107,7 +113,11 @@ class TestBayConductorWithMesos(base.TestCase):
'username': 'mesos_user',
'tenant_name': 'admin',
'domain_name': 'domainname',
'rexray_preempt': 'False'
'rexray_preempt': 'False',
'mesos_slave_executor_environment_variables': '{}',
'mesos_slave_isolation': 'docker/runtime,filesystem/linux',
'mesos_slave_work_dir': '/tmp/mesos/slave',
'mesos_slave_image_providers': 'docker'
}
self.assertEqual(expected, definition)
@ -145,7 +155,11 @@ class TestBayConductorWithMesos(base.TestCase):
'username': 'mesos_user',
'tenant_name': 'admin',
'domain_name': 'domainname',
'rexray_preempt': 'False'
'rexray_preempt': 'False',
'mesos_slave_isolation': 'docker/runtime,filesystem/linux',
'mesos_slave_executor_environment_variables': '{}',
'mesos_slave_work_dir': '/tmp/mesos/slave',
'mesos_slave_image_providers': 'docker'
}
self.assertEqual(expected, definition)

14
magnum/tests/unit/conductor/test_template_definition.py

@ -526,6 +526,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(
'image_providers')
mesos_slave_executor_environment_variables = mock_baymodel.labels.get(
'mesos_slave_executor_environment_variables')
mock_bay = mock.MagicMock()
mock_bay.uuid = '5d12f6fd-a196-4bf0-ae4c-1f639a523a52'
del mock_bay.stack_id
@ -543,7 +550,12 @@ class UbuntuMesosTemplateDefinitionTestCase(base.TestCase):
'username': 'mesos_user',
'tenant_name': 'admin',
'domain_name': 'domainname',
'rexray_preempt': rexray_preempt}}
'rexray_preempt': rexray_preempt,
'mesos_slave_isolation': mesos_slave_isolation,
'mesos_slave_work_dir': mesos_slave_work_dir,
'mesos_slave_executor_environment_variables':
mesos_slave_executor_environment_variables,
'mesos_slave_image_providers': mesos_slave_image_providers}}
mock_get_params.assert_called_once_with(mock_context, mock_baymodel,
mock_bay, **expected_kwargs)

Loading…
Cancel
Save