ee127b9e76
Currently, fluentd plugins are installed via gem install, this may causes some issues when gems are updated upstream. This patch uses the plugins packaged on CentOS opstools repository. The debian/ubuntu image has not been modified Change-Id: Ib32ceaae0d9fa56c6ec25a47ae6f44259d3b6e6d
82 lines
2.6 KiB
Django/Jinja
82 lines
2.6 KiB
Django/Jinja
FROM {{ namespace }}/{{ image_prefix }}base:{{ tag }}
|
|
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
|
|
|
|
{% block fluentd_header %}{% endblock %}
|
|
|
|
{% import "macros.j2" as macros with context %}
|
|
|
|
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
|
|
|
|
{{ macros.configure_user(name='fluentd', groups='mysql') }}
|
|
# TODO:remove hostname package as it should be installed by the
|
|
# fluentd dependencies.
|
|
# hostname package is installed by default on CentOS/RHEL but not on
|
|
# oraclelinux.
|
|
|
|
{% set fluentd_packages = [
|
|
'fluentd',
|
|
'hostname',
|
|
'rubygem-fluent-plugin-elasticsearch',
|
|
'rubygem-fluent-plugin-grok-parser',
|
|
'rubygem-fluent-plugin-kubernetes_metadata_filter',
|
|
'rubygem-fluent-plugin-rewrite-tag-filter',
|
|
'rubygem-fluent-plugin-secure-forward'
|
|
] %}
|
|
|
|
{% elif base_distro in ['debian', 'ubuntu'] %}
|
|
{{ macros.configure_user(name='td-agent', groups='mysql') }}
|
|
{% set fluentd_packages = [
|
|
'g++',
|
|
'make',
|
|
'td-agent'
|
|
] %}
|
|
|
|
{% endif %}
|
|
|
|
{{ macros.install_packages(fluentd_packages | customizable("packages")) }}
|
|
|
|
# Distro specific files and operations
|
|
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
|
|
COPY rpm_fluentd_sudoers /etc/sudoers.d/kolla_fluentd_sudoers
|
|
RUN chmod 440 /etc/sudoers.d/kolla_fluentd_sudoers \
|
|
&& mkdir -p /var/run/fluentd \
|
|
&& chown -R fluentd: /etc/fluentd /var/run/fluentd
|
|
{% elif base_distro in ['debian', 'ubuntu'] %}
|
|
COPY fluentd_sudoers /etc/sudoers.d/kolla_fluentd_sudoers
|
|
RUN chmod 440 /etc/sudoers.d/kolla_fluentd_sudoers \
|
|
&& sed -i -e "s/USER=td-agent/USER=root/" -e "s/GROUP=td-agent/GROUP=root/" /etc/init.d/td-agent \
|
|
&& rm -f /etc/td-agent/td-agent.conf \
|
|
&& chown -R td-agent: /etc/td-agent
|
|
{% endif %}
|
|
|
|
|
|
COPY extend_start.sh /usr/local/bin/kolla_extend_start
|
|
RUN chmod 755 /usr/local/bin/kolla_extend_start
|
|
|
|
{% block fluentd_plugins_install %}
|
|
|
|
{% if base_distro in ['debian', 'ubuntu'] %}
|
|
{% set fluentd_plugins = [
|
|
'fluent-plugin-elasticsearch',
|
|
'fluent-plugin-grep',
|
|
'fluent-plugin-grok-parser:2.1.4',
|
|
'fluent-plugin-kubernetes_metadata_filter',
|
|
'fluent-plugin-parser',
|
|
'fluent-plugin-rewrite-tag-filter:2.0.0',
|
|
'fluent-plugin-secure-forward',
|
|
] %}
|
|
{% endif %}
|
|
|
|
{{ macros.install_fluent_plugins(fluentd_plugins | customizable("plugins")) }}
|
|
|
|
{% endblock %}
|
|
|
|
{% block fluentd_footer %}{% endblock %}
|
|
{% block footer %}{% endblock %}
|
|
|
|
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
|
|
USER fluentd
|
|
{% elif base_distro in ['debian', 'ubuntu'] %}
|
|
USER td-agent
|
|
{% endif %}
|