Add rsyslog sidecar image for container image prepare

Some services (namely HAProxy and swift) use syslog for their logging,
and will need a sidecar container that runs rsyslog to redirect the logs
to stdout. So, when these services are enabled and we set the variable
"logging" to "stdout", we then enable the rsyslog container image as a
parameter.

The rsyslog-base image was used since we don't need any plugins for the
sidecar container.

bp logging-stdout-rsyslog

Change-Id: I1bb6db4a80c601790800a6d5657c9f114d0d8e74
This commit is contained in:
Juan Antonio Osorio Robles 2017-10-26 08:52:37 +03:00
parent c9cd97b4df
commit 9c23160cad
4 changed files with 47 additions and 7 deletions

View File

@ -92,3 +92,4 @@ container_images:
- imagename: tripleoupstream/centos-binary-tacker:latest - imagename: tripleoupstream/centos-binary-tacker:latest
- imagename: tripleoupstream/centos-binary-zaqar:latest - imagename: tripleoupstream/centos-binary-zaqar:latest
- imagename: docker.io/ceph/daemon:tag-stable-3.0-jewel-centos-7 - imagename: docker.io/ceph/daemon:tag-stable-3.0-jewel-centos-7
- imagename: tripleoupstream/centos-binary-rsyslog-base:latest

View File

@ -672,3 +672,14 @@ container_images_template:
- OS::TripleO::Services::CephOSD - OS::TripleO::Services::CephOSD
- OS::TripleO::Services::CephRgw - OS::TripleO::Services::CephRgw
- OS::TripleO::Services::CephRbdMirror - OS::TripleO::Services::CephRbdMirror
{% if logging == "stdout" %}
- imagename: "{{namespace}}/{{name_prefix}}rsyslog-base{{name_suffix}}:{{tag}}"
params:
- DockerRsyslogSidecarImage
- DockerRsyslogSidecarConfigImage
services:
- OS::TripleO::Services::HAproxy
- OS::TripleO::Services::SwiftProxy
- OS::TripleO::Services::SwiftStorage
{% endif %}

View File

@ -33,7 +33,8 @@ CONTAINER_IMAGES_DEFAULTS = {
'name_prefix': 'centos-binary-', 'name_prefix': 'centos-binary-',
'name_suffix': '', 'name_suffix': '',
'tag': 'latest', 'tag': 'latest',
'neutron_driver': None 'neutron_driver': None,
'logging': 'files'
} }

View File

@ -169,6 +169,7 @@ class TestKollaImageBuilderTemplate(base.TestCase):
'ceph_namespace': 'docker.io/ceph', 'ceph_namespace': 'docker.io/ceph',
'ceph_image': 'daemon', 'ceph_image': 'daemon',
'ceph_tag': 'tag-stable-3.0-jewel-centos-7', 'ceph_tag': 'tag-stable-3.0-jewel-centos-7',
'logging': 'files',
'name_prefix': 'centos-binary-', 'name_prefix': 'centos-binary-',
'name_suffix': '', 'name_suffix': '',
'tag': 'latest', 'tag': 'latest',
@ -183,6 +184,7 @@ class TestKollaImageBuilderTemplate(base.TestCase):
'ceph_namespace': 'docker.io/cephh', 'ceph_namespace': 'docker.io/cephh',
'ceph_image': 'ceph-daemon', 'ceph_image': 'ceph-daemon',
'ceph_tag': 'latest', 'ceph_tag': 'latest',
'logging': 'stdout',
'name_prefix': 'prefix-', 'name_prefix': 'prefix-',
'name_suffix': '-suffix', 'name_suffix': '-suffix',
'tag': 'master', 'tag': 'master',
@ -196,7 +198,8 @@ class TestKollaImageBuilderTemplate(base.TestCase):
name_prefix='prefix', name_prefix='prefix',
name_suffix='suffix', name_suffix='suffix',
tag='master', tag='master',
neutron_driver='ovn' neutron_driver='ovn',
logging='stdout'
) )
) )
@ -236,7 +239,8 @@ class TestKollaImageBuilderTemplate(base.TestCase):
self.assertEqual(container_images, result) self.assertEqual(container_images, result)
def _test_container_images_yaml_in_sync_helper(self, neutron_driver=None, def _test_container_images_yaml_in_sync_helper(self, neutron_driver=None,
remove_images=[]): remove_images=[],
logging='files'):
'''Confirm overcloud_containers.tpl.yaml equals overcloud_containers.yaml '''Confirm overcloud_containers.tpl.yaml equals overcloud_containers.yaml
TODO(sbaker) remove when overcloud_containers.yaml is deleted TODO(sbaker) remove when overcloud_containers.yaml is deleted
@ -256,7 +260,7 @@ class TestKollaImageBuilderTemplate(base.TestCase):
return entry return entry
result = tmpl_builder.container_images_from_template( result = tmpl_builder.container_images_from_template(
filter=ffunc, neutron_driver=neutron_driver) filter=ffunc, neutron_driver=neutron_driver, logging=logging)
oc_yaml_file = os.path.join(files_dir, 'overcloud_containers.yaml') oc_yaml_file = os.path.join(files_dir, 'overcloud_containers.yaml')
yaml_builder = kb.KollaImageBuilder([oc_yaml_file]) yaml_builder = kb.KollaImageBuilder([oc_yaml_file])
@ -285,7 +289,8 @@ class TestKollaImageBuilderTemplate(base.TestCase):
{'imagename': 'tripleoupstream/centos-binary-ovn-' {'imagename': 'tripleoupstream/centos-binary-ovn-'
'nb-db-server:latest'}, 'nb-db-server:latest'},
{'imagename': 'tripleoupstream/centos-binary-ovn-' {'imagename': 'tripleoupstream/centos-binary-ovn-'
'sb-db-server:latest'}] 'sb-db-server:latest'},
{'imagename': 'tripleoupstream/centos-binary-rsyslog-base:latest'}]
self._test_container_images_yaml_in_sync_helper( self._test_container_images_yaml_in_sync_helper(
remove_images=remove_images) remove_images=remove_images)
@ -303,7 +308,8 @@ class TestKollaImageBuilderTemplate(base.TestCase):
{'imagename': 'tripleoupstream/centos-binary-ovn-' {'imagename': 'tripleoupstream/centos-binary-ovn-'
'nb-db-server:latest'}, 'nb-db-server:latest'},
{'imagename': 'tripleoupstream/centos-binary-ovn-' {'imagename': 'tripleoupstream/centos-binary-ovn-'
'sb-db-server:latest'}] 'sb-db-server:latest'},
{'imagename': 'tripleoupstream/centos-binary-rsyslog-base:latest'}]
self._test_container_images_yaml_in_sync_helper( self._test_container_images_yaml_in_sync_helper(
neutron_driver='odl', remove_images=remove_images) neutron_driver='odl', remove_images=remove_images)
@ -314,6 +320,27 @@ class TestKollaImageBuilderTemplate(base.TestCase):
{'imagename': 'tripleoupstream/centos-binary' {'imagename': 'tripleoupstream/centos-binary'
'-neutron-server-opendaylight:latest'}, '-neutron-server-opendaylight:latest'},
{'imagename': 'tripleoupstream/centos-binary' {'imagename': 'tripleoupstream/centos-binary'
'-opendaylight:latest'}] '-opendaylight:latest'},
{'imagename': 'tripleoupstream/centos-binary'
'-rsyslog-base:latest'}]
self._test_container_images_yaml_in_sync_helper( self._test_container_images_yaml_in_sync_helper(
neutron_driver='ovn', remove_images=remove_images) neutron_driver='ovn', remove_images=remove_images)
def test_container_images_yaml_in_sync_for_stdout_logging(self):
remove_images = [
{'imagename': 'tripleoupstream/centos-binary'
'-neutron-server-opendaylight:latest'},
{'imagename': 'tripleoupstream/centos-binary'
'-neutron-server-ovn:latest'},
{'imagename': 'tripleoupstream/centos-binary-ovn-base:latest'},
{'imagename': 'tripleoupstream/centos-binary'
'-opendaylight:latest'},
{'imagename': 'tripleoupstream/centos-binary-ovn-northd:latest'},
{'imagename': 'tripleoupstream/centos-binary-ovn-'
'controller:latest'},
{'imagename': 'tripleoupstream/centos-binary-ovn-'
'nb-db-server:latest'},
{'imagename': 'tripleoupstream/centos-binary-ovn-'
'sb-db-server:latest'}]
self._test_container_images_yaml_in_sync_helper(
remove_images=remove_images, logging='stdout')