Merge "Add cron image and playbook"

This commit is contained in:
Jenkins 2016-03-10 20:22:15 +00:00 committed by Gerrit Code Review
commit a28b246259
29 changed files with 176 additions and 7 deletions

View File

@ -13,3 +13,7 @@ ansible_image_full: "{{ ansible_image }}:{{ ansible_tag }}"
heka_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-heka"
heka_tag: "{{ openstack_release }}"
heka_image_full: "{{ heka_image }}:{{ heka_tag }}"
cron_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-cron"
cron_tag: "{{ openstack_release }}"
cron_image_full: "{{ cron_image }}:{{ cron_tag }}"

View File

@ -6,6 +6,8 @@
recurse: yes
with_items:
- "heka"
- "cron"
- "cron/logrotate"
- name: Copying over config.json files for services
template:
@ -13,6 +15,7 @@
dest: "{{ node_config_directory }}/{{ item }}/config.json"
with_items:
- "heka"
- "cron"
- name: Copying over heka config files
template:
@ -55,3 +58,26 @@
with_items:
- "elasticsearch"
when: "{{ enable_central_logging | bool }}"
- name: Copying over cron logrotate config files
template:
src: "cron-logrotate-{{ item }}.conf.j2"
dest: "{{ node_config_directory }}/cron/logrotate/{{ item }}.conf"
with_items:
- "ansible"
- "cinder"
- "glance"
- "global"
- "haproxy"
- "heat"
- "keepalived"
- "keystone"
- "magnum"
- "manila"
- "mariadb"
- "mistral"
- "murano"
- "neutron"
- "nova"
- "rabbitmq"
- "swift"

View File

@ -28,3 +28,14 @@
- "/dev/:/dev/"
- "/run/:/run/"
- "kolla_logs:/var/log/kolla/"
- name: Starting cron container
kolla_docker:
action: "start_container"
common_options: "{{ docker_common_options }}"
image: "{{ cron_image_full }}"
name: "cron"
volumes:
- "{{ node_config_directory }}/cron/:{{ container_config_directory }}/:ro"
- "heka_socket:/var/lib/kolla/heka/"
- "kolla_logs:/var/log/kolla/"

View File

@ -0,0 +1,3 @@
"/var/log/kolla/ansible.log"
{
}

View File

@ -0,0 +1,3 @@
"/var/log/kolla/cinder/*.log"
{
}

View File

@ -0,0 +1,3 @@
"/var/log/kolla/glance/*.log"
{
}

View File

@ -0,0 +1,21 @@
weekly
rotate 6
copytruncate
compress
delaycompress
notifempty
missingok
minsize 30M
maxsize 100M
su root kolla
include /etc/logrotate.d

View File

@ -0,0 +1,3 @@
"/var/log/kolla/haproxy/haproxy.log"
{
}

View File

@ -0,0 +1,3 @@
"/var/log/kolla/heat/*.log"
{
}

View File

@ -0,0 +1,3 @@
"/var/log/kolla/haproxy/keepalived.log"
{
}

View File

@ -0,0 +1,5 @@
{% set apache_dir = 'apache2' if kolla_base_distro in ['ubuntu', 'debian'] else 'httpd' %}
"/var/log/kolla/keystone/*.log"
"/var/log/kolla/{{ apache_dir }}/keystone-apache-*.log"
{
}

View File

@ -0,0 +1,3 @@
"/var/log/kolla/magnum/*.log"
{
}

View File

@ -0,0 +1,3 @@
"/var/log/kolla/manila/*.log"
{
}

View File

@ -0,0 +1,3 @@
"/var/log/kolla/mariadb/*.log"
{
}

View File

@ -0,0 +1,3 @@
"/var/log/kolla/mistral/*.log"
{
}

View File

@ -0,0 +1,3 @@
"/var/log/kolla/murano/*.log"
{
}

View File

@ -0,0 +1,3 @@
"/var/log/kolla/neutron/*.log"
{
}

View File

@ -0,0 +1,3 @@
"/var/log/kolla/nova/*.log"
{
}

View File

@ -0,0 +1,3 @@
"/var/log/kolla/rabbitmq/*.log"
{
}

View File

@ -0,0 +1,3 @@
"/var/log/kolla/swift/*.log"
{
}

View File

@ -0,0 +1,22 @@
{% set cron_cmd = 'cron -f' if kolla_base_distro in ['ubuntu', 'debian'] else 'crond -s -n' %}
{% set services = ["ansible", "cinder", "glance", "haproxy", "heat", "keepalived", "keystone", "magnum", "manila", "mariadb", "mistral", "murano", "neutron", "nova", "rabbitmq", "swift"] %}
{
"command": "{{ cron_cmd }}",
"config_files": [
{
"source": "{{ container_config_directory }}/logrotate/global.conf",
"dest": "/etc/logrotate.conf",
"owner": "root",
"perm": "0644"
},
{% for service in services %}
{
"source": "{{ container_config_directory }}/logrotate/{{ service }}.conf",
"dest": "/etc/logrotate.d/{{ service }}.conf",
"owner": "root",
"perm": "0644"
}{% if not loop.last %},{% endif %}
{% endfor %}
]
}

View File

@ -9,5 +9,6 @@ filename = "lua_decoders/os_keystone_apache_log.lua"
type = "LogstreamerInput"
decoder = "keystone_apache_log_decoder"
log_directory = "/var/log/kolla"
file_match = '{{ apache_dir }}/keystone-apache-(?P<Service>.+)-access\.log'
file_match = '{{ apache_dir }}/keystone-apache-(?P<Service>.+)-access\.log\.?(?P<Seq>\d*)$'
priority = ["^Seq"]
differentiator = ["keystone-apache-", "Service"]

View File

@ -6,5 +6,6 @@ filename = "lua_decoders/os_mysql_log.lua"
type = "LogstreamerInput"
decoder = "mariadb_log_decoder"
log_directory = "/var/log/kolla"
file_match = 'mariadb/mariadb\.log'
file_match = 'mariadb/mariadb\.log\.?(?P<Seq>\d*)$'
priority = ["^Seq"]
differentiator = ['mariadb']

View File

@ -6,5 +6,6 @@ filename = "lua_decoders/os_openstack_log.lua"
type = "LogstreamerInput"
decoder = "openstack_log_decoder"
log_directory = "/var/log/kolla"
file_match = '(?P<Service>nova|glance|keystone|neutron|cinder|heat|murano|magnum|mistral|manila)/(?P<Program>.*)\.log'
file_match = '(?P<Service>nova|glance|keystone|neutron|cinder|heat|murano|magnum|mistral|manila)/(?P<Program>.*)\.log\.?(?P<Seq>\d*)$'
priority = ["^Seq"]
differentiator = ["Service", "_", "Program"]

View File

@ -13,5 +13,6 @@ type = "LogstreamerInput"
decoder = "rabbitmq_log_decoder"
splitter = "rabbitmq_log_splitter"
log_directory = "/var/log/kolla"
file_match = 'rabbitmq/(?P<Service>rabbit.*)\.log'
file_match = 'rabbitmq/(?P<Service>rabbit.*)\.log\.?(?P<Seq>\d*)$'
priority = ["^Seq"]
differentiator = ["Service"]

23
docker/cron/Dockerfile.j2 Normal file
View File

@ -0,0 +1,23 @@
FROM {{ namespace }}/{{ image_prefix }}base:{{ tag }}
MAINTAINER {{ maintainer }}
{% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %}
RUN yum -y install \
cronie \
logrotate \
&& yum clean all
{% elif base_distro in ['ubuntu', 'debian'] %}
RUN apt-get install -y --no-install-recommends \
cron \
logrotate \
&& apt-get clean
{% endif %}
COPY extend_start.sh /usr/local/bin/kolla_extend_start
RUN chmod 755 /usr/local/bin/kolla_extend_start
{{ include_footer }}

View File

@ -0,0 +1,7 @@
#!/bin/bash
# NOTE(elemoine): the cron daemon sends its logs to /dev/log. Heka's log socket
# is at /var/lib/kolla/heka/log so we symlink /dev/log to that location.
if [[ ! -h /dev/log ]]; then
ln -sf /var/lib/kolla/heka/log /dev/log
fi

View File

@ -25,7 +25,7 @@ INSTALL_TYPE_CHOICES = ['binary', 'source', 'rdo', 'rhos']
_PROFILE_OPTS = [
cfg.ListOpt('infra',
default=['ceph', 'mariadb', 'haproxy',
default=['ceph', 'cron', 'mariadb', 'haproxy',
'keepalived', 'kolla-toolbox', 'memcached',
'mongodb', 'openvswitch', 'rabbitmq', 'heka'],
help='Infra images'),
@ -39,13 +39,13 @@ _PROFILE_OPTS = [
'magnum', 'mistral', 'trove,' 'zaqar', 'zookeeper'],
help='Aux Images'),
cfg.ListOpt('default',
default=['kolla-toolbox', 'glance', 'haproxy',
default=['cron', 'kolla-toolbox', 'glance', 'haproxy',
'heat', 'horizon', 'keepalived', 'keystone',
'memcached', 'mariadb', 'neutron', 'nova',
'openvswitch', 'rabbitmq', 'heka'],
help='Default images'),
cfg.ListOpt('gate',
default=['glance', 'haproxy', 'keepalived', 'keystone',
default=['cron', 'glance', 'haproxy', 'keepalived', 'keystone',
'kolla-toolbox', 'mariadb', 'memcached', 'neutron',
'nova', 'openvswitch', 'rabbitmq', 'heka'],
help='Gate images'),

View File

@ -14,6 +14,7 @@ else
bootstrap_{ceph_mon,cinder,glance,heat,heka,ironic,ironic_pxe,keystone,magnum,mistral,mongodb,murano,neutron,nova,nova_compute} \
cinder_{volume,scheduler,backup,api} \
ceph_{mon,rgw} \
cron \
elasticsearch \
glance_{api,registry} \
haproxy \