Replace volume containers with direct mountings
Fuel storage containers are a bit useless in our architecture and lead us to the problems when after upgrade we have storage containers with not expected names. In order to be consistent with dockerctl and prevent desync with dockerctl it was decided to remove them. Change-Id: Id3b614ce5f8cd5284bc387d1384d0c9928f84981 Related-Bug: #1382527
This commit is contained in:
parent
bf9ddb9f9d
commit
b5171a5797
@ -27,6 +27,8 @@ Why python based config?
|
|||||||
and it's hard to create variables nesting more than 1
|
and it's hard to create variables nesting more than 1
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import six
|
||||||
|
|
||||||
import glob
|
import glob
|
||||||
import logging
|
import logging
|
||||||
import yaml
|
import yaml
|
||||||
@ -355,6 +357,30 @@ def config(update_path, admin_password):
|
|||||||
container_prefix = 'fuel-core-'
|
container_prefix = 'fuel-core-'
|
||||||
master_ip = astute['ADMIN_NETWORK']['ipaddress']
|
master_ip = astute['ADMIN_NETWORK']['ipaddress']
|
||||||
|
|
||||||
|
volumes = {
|
||||||
|
'volume_logs': [
|
||||||
|
('/var/log/docker-logs', {'bind': '/var/log', 'ro': False})],
|
||||||
|
|
||||||
|
'volume_repos': [
|
||||||
|
('/var/www/nailgun', {'bind': '/var/www/nailgun', 'ro': False}),
|
||||||
|
('/etc/yum.repos.d', {'bind': '/etc/yum.repos.d', 'ro': False})],
|
||||||
|
|
||||||
|
'volume_ssh_keys': [
|
||||||
|
('/root/.ssh', {'bind': '/root/.ssh', 'ro': False})],
|
||||||
|
|
||||||
|
'volume_fuel_configs': [
|
||||||
|
('/etc/fuel', {'bind': '/etc/fuel', 'ro': False})],
|
||||||
|
|
||||||
|
'volume_upgrade_directory': [
|
||||||
|
(working_directory, {'bind': '/tmp/upgrade', 'ro': True})],
|
||||||
|
|
||||||
|
'volume_dump': [
|
||||||
|
('/dump', {'bind': '/var/www/nailgun/dump', 'ro': False})],
|
||||||
|
|
||||||
|
'volume_puppet_manifests': [
|
||||||
|
('/etc/puppet', {'bind': '/etc/puppet', 'ro': True})],
|
||||||
|
}
|
||||||
|
|
||||||
containers = [
|
containers = [
|
||||||
|
|
||||||
{'id': 'nailgun',
|
{'id': 'nailgun',
|
||||||
@ -368,12 +394,13 @@ def config(update_path, admin_password):
|
|||||||
'links': [
|
'links': [
|
||||||
{'id': 'postgres', 'alias': 'db'},
|
{'id': 'postgres', 'alias': 'db'},
|
||||||
{'id': 'rabbitmq', 'alias': 'rabbitmq'}],
|
{'id': 'rabbitmq', 'alias': 'rabbitmq'}],
|
||||||
'volumes': ['/usr/share/nailgun/static'],
|
'binds': [
|
||||||
'volumes_from': [
|
|
||||||
'volume_logs',
|
'volume_logs',
|
||||||
'volume_repos',
|
'volume_repos',
|
||||||
'volume_ssh_keys',
|
'volume_ssh_keys',
|
||||||
'volume_fuel_configs']},
|
'volume_fuel_configs'],
|
||||||
|
'volumes': [
|
||||||
|
'/usr/share/nailgun/static']},
|
||||||
|
|
||||||
{'id': 'astute',
|
{'id': 'astute',
|
||||||
'supervisor_config': True,
|
'supervisor_config': True,
|
||||||
@ -383,7 +410,7 @@ def config(update_path, admin_password):
|
|||||||
"/var/lib/astute/'"),
|
"/var/lib/astute/'"),
|
||||||
'links': [
|
'links': [
|
||||||
{'id': 'rabbitmq', 'alias': 'rabbitmq'}],
|
{'id': 'rabbitmq', 'alias': 'rabbitmq'}],
|
||||||
'volumes_from': [
|
'binds': [
|
||||||
'volume_logs',
|
'volume_logs',
|
||||||
'volume_repos',
|
'volume_repos',
|
||||||
'volume_ssh_keys',
|
'volume_ssh_keys',
|
||||||
@ -414,7 +441,7 @@ def config(update_path, admin_password):
|
|||||||
[69, 'tcp'],
|
[69, 'tcp'],
|
||||||
80,
|
80,
|
||||||
443],
|
443],
|
||||||
'volumes_from': [
|
'binds': [
|
||||||
'volume_logs',
|
'volume_logs',
|
||||||
'volume_repos',
|
'volume_repos',
|
||||||
'volume_ssh_keys',
|
'volume_ssh_keys',
|
||||||
@ -425,12 +452,12 @@ def config(update_path, admin_password):
|
|||||||
'supervisor_config': True,
|
'supervisor_config': True,
|
||||||
'from_image': 'mcollective',
|
'from_image': 'mcollective',
|
||||||
'privileged': True,
|
'privileged': True,
|
||||||
'volumes_from': [
|
'binds': [
|
||||||
'volume_logs',
|
'volume_logs',
|
||||||
'volume_repos',
|
'volume_repos',
|
||||||
'volume_ssh_keys',
|
'volume_ssh_keys',
|
||||||
'volume_fuel_configs',
|
'volume_dump',
|
||||||
'volume_dump']},
|
'volume_fuel_configs']},
|
||||||
|
|
||||||
{'id': 'rsync',
|
{'id': 'rsync',
|
||||||
'supervisor_config': True,
|
'supervisor_config': True,
|
||||||
@ -440,7 +467,7 @@ def config(update_path, admin_password):
|
|||||||
('127.0.0.1', 873),
|
('127.0.0.1', 873),
|
||||||
(master_ip, 873)]},
|
(master_ip, 873)]},
|
||||||
'ports': [873],
|
'ports': [873],
|
||||||
'volumes_from': [
|
'binds': [
|
||||||
'volume_logs',
|
'volume_logs',
|
||||||
'volume_repos',
|
'volume_repos',
|
||||||
'volume_fuel_configs',
|
'volume_fuel_configs',
|
||||||
@ -460,7 +487,7 @@ def config(update_path, admin_password):
|
|||||||
('127.0.0.1', 25150),
|
('127.0.0.1', 25150),
|
||||||
(master_ip, 25150)]},
|
(master_ip, 25150)]},
|
||||||
'ports': [[514, 'udp'], 514],
|
'ports': [[514, 'udp'], 514],
|
||||||
'volumes_from': [
|
'binds': [
|
||||||
'volume_logs',
|
'volume_logs',
|
||||||
'volume_repos',
|
'volume_repos',
|
||||||
'volume_fuel_configs']},
|
'volume_fuel_configs']},
|
||||||
@ -474,7 +501,7 @@ def config(update_path, admin_password):
|
|||||||
'ports': [5000, 35357],
|
'ports': [5000, 35357],
|
||||||
'links': [
|
'links': [
|
||||||
{'id': 'postgres', 'alias': 'postgres'}],
|
{'id': 'postgres', 'alias': 'postgres'}],
|
||||||
'volumes_from': [
|
'binds': [
|
||||||
'volume_logs',
|
'volume_logs',
|
||||||
'volume_repos',
|
'volume_repos',
|
||||||
'volume_fuel_configs']},
|
'volume_fuel_configs']},
|
||||||
@ -489,13 +516,12 @@ def config(update_path, admin_password):
|
|||||||
'links': [
|
'links': [
|
||||||
{'id': 'nailgun', 'alias': 'nailgun'},
|
{'id': 'nailgun', 'alias': 'nailgun'},
|
||||||
{'id': 'ostf', 'alias': 'ostf'}],
|
{'id': 'ostf', 'alias': 'ostf'}],
|
||||||
'volumes_from': [
|
'binds': [
|
||||||
'volume_repos',
|
|
||||||
'nailgun',
|
|
||||||
'volume_logs',
|
'volume_logs',
|
||||||
'volume_repos',
|
'volume_repos',
|
||||||
'volume_fuel_configs',
|
'volume_dump',
|
||||||
'volume_dump']},
|
'volume_fuel_configs'],
|
||||||
|
'volumes_from': ['nailgun']},
|
||||||
|
|
||||||
{'id': 'rabbitmq',
|
{'id': 'rabbitmq',
|
||||||
'supervisor_config': True,
|
'supervisor_config': True,
|
||||||
@ -514,7 +540,7 @@ def config(update_path, admin_password):
|
|||||||
('127.0.0.1', 61613),
|
('127.0.0.1', 61613),
|
||||||
(master_ip, 61613)]},
|
(master_ip, 61613)]},
|
||||||
'ports': [5672, 4369, 15672, 61613],
|
'ports': [5672, 4369, 15672, 61613],
|
||||||
'volumes_from': [
|
'binds': [
|
||||||
'volume_logs',
|
'volume_logs',
|
||||||
'volume_repos',
|
'volume_repos',
|
||||||
'volume_fuel_configs']},
|
'volume_fuel_configs']},
|
||||||
@ -530,11 +556,11 @@ def config(update_path, admin_password):
|
|||||||
'links': [
|
'links': [
|
||||||
{'id': 'postgres', 'alias': 'db'},
|
{'id': 'postgres', 'alias': 'db'},
|
||||||
{'id': 'rabbitmq', 'alias': 'rabbitmq'}],
|
{'id': 'rabbitmq', 'alias': 'rabbitmq'}],
|
||||||
'volumes_from': [
|
'binds': [
|
||||||
'volume_logs',
|
'volume_logs',
|
||||||
'volume_repos',
|
'volume_repos',
|
||||||
'volume_fuel_configs',
|
'volume_ssh_keys',
|
||||||
'volume_ssh_keys']},
|
'volume_fuel_configs']},
|
||||||
|
|
||||||
{'id': 'postgres',
|
{'id': 'postgres',
|
||||||
'after_container_creation_command': (
|
'after_container_creation_command': (
|
||||||
@ -547,79 +573,30 @@ def config(update_path, admin_password):
|
|||||||
('127.0.0.1', 5432),
|
('127.0.0.1', 5432),
|
||||||
(master_ip, 5432)]},
|
(master_ip, 5432)]},
|
||||||
'ports': [5432],
|
'ports': [5432],
|
||||||
'volumes_from': [
|
'binds': [
|
||||||
'volume_logs',
|
'volume_logs',
|
||||||
'volume_repos',
|
'volume_repos',
|
||||||
'volume_fuel_configs',
|
'volume_fuel_configs',
|
||||||
'volume_upgrade_directory']},
|
'volume_upgrade_directory']}]
|
||||||
|
|
||||||
{'id': 'volume_repos',
|
# Since we dropped fuel storage containers we should provide an
|
||||||
'supervisor_config': False,
|
# alternative DRY mechanism for mounting volumes directly into
|
||||||
'from_image': 'busybox',
|
# containers. So below code performs such job and unfolds containers
|
||||||
'volumes': ['/var/www/nailgun', '/etc/yum.repos.d'],
|
# an abstract declarative "binds" format into docker-py's "binds"
|
||||||
'binds': {
|
# format.
|
||||||
'/var/www/nailgun': {
|
for container in containers:
|
||||||
'bind': '/var/www/nailgun',
|
binds = {}
|
||||||
'ro': False},
|
for volume in container.get('binds', []):
|
||||||
'/etc/yum.repos.d': {
|
binds.update(volumes[volume])
|
||||||
'bind': '/etc/yum.repos.d',
|
container['binds'] = binds
|
||||||
'ro': False}}},
|
|
||||||
|
|
||||||
{'id': 'volume_logs',
|
# unfortunately, docker-py has bad design and we must add to
|
||||||
'supervisor_config': False,
|
# containers' "volumes" list those folders that will be mounted
|
||||||
'from_image': 'busybox',
|
# into container
|
||||||
'volumes': ['/var/log'],
|
if 'volumes' not in container:
|
||||||
'binds': {
|
container['volumes'] = []
|
||||||
'/var/log/docker-logs': {
|
for _, volume in six.iteritems(binds):
|
||||||
'bind': '/var/log',
|
container['volumes'].append(volume['bind'])
|
||||||
'ro': False}}},
|
|
||||||
|
|
||||||
{'id': 'volume_ssh_keys',
|
|
||||||
'supervisor_config': False,
|
|
||||||
'from_image': 'busybox',
|
|
||||||
'volumes': ['/root/.ssh'],
|
|
||||||
'binds': {
|
|
||||||
'/root/.ssh': {
|
|
||||||
'bind': '/root/.ssh',
|
|
||||||
'ro': False}}},
|
|
||||||
|
|
||||||
{'id': 'volume_dump',
|
|
||||||
'supervisor_config': False,
|
|
||||||
'from_image': 'busybox',
|
|
||||||
'volumes': ['/dump'],
|
|
||||||
'binds': {
|
|
||||||
'/dump': {
|
|
||||||
'bind': '/var/www/nailgun/dump',
|
|
||||||
'ro': False}}},
|
|
||||||
|
|
||||||
{'id': 'volume_fuel_configs',
|
|
||||||
'supervisor_config': False,
|
|
||||||
'from_image': 'busybox',
|
|
||||||
'volumes': ['/etc/fuel'],
|
|
||||||
'binds': {
|
|
||||||
'/etc/fuel': {
|
|
||||||
'bind': '/etc/fuel',
|
|
||||||
'ro': False}}},
|
|
||||||
|
|
||||||
{'id': 'volume_puppet_manifests',
|
|
||||||
'supervisor_config': False,
|
|
||||||
'from_image': 'busybox',
|
|
||||||
'volumes': ['/etc/puppet'],
|
|
||||||
'binds': {
|
|
||||||
'/etc/puppet': {
|
|
||||||
'bind': '/etc/puppet',
|
|
||||||
'ro': True}}},
|
|
||||||
|
|
||||||
{'id': 'volume_upgrade_directory',
|
|
||||||
'supervisor_config': False,
|
|
||||||
'from_image': 'busybox',
|
|
||||||
'volumes': ['/tmp/upgrade'],
|
|
||||||
'binds': {
|
|
||||||
# NOTE(eli): Use working directory
|
|
||||||
# variable to mount it into the container
|
|
||||||
working_directory: {
|
|
||||||
'bind': '/tmp/upgrade',
|
|
||||||
'ro': True}}}]
|
|
||||||
|
|
||||||
# Openstack Upgrader settings. Please note, that "[0-9.-]*" is
|
# Openstack Upgrader settings. Please note, that "[0-9.-]*" is
|
||||||
# a glob pattern for matching our os versions
|
# a glob pattern for matching our os versions
|
||||||
|
Loading…
Reference in New Issue
Block a user