The fluentd component has moved to helm chart, too.
Now can be configured to use elasticsearch or remote_syslog for logging
Signed-off-by: Botond Borbély <botond.borbely@nokia.com>
Change-Id: I81b5342f9325652ac343e1b4d201d232b034a245
%define COMPONENT fluentd
%define RPM_NAME caas-%{COMPONENT}
%define RPM_MAJOR_VERSION 1.5.2
-%define RPM_MINOR_VERSION 1
+%define RPM_MINOR_VERSION 2
%define IMAGE_TAG %{RPM_MAJOR_VERSION}-%{RPM_MINOR_VERSION}
Name: %{RPM_NAME}
mkdir -p %{buildroot}/%{_caas_container_tar_path}/
rsync -av %{_builddir}/%{RPM_NAME}-%{RPM_MAJOR_VERSION}/docker-save/%{COMPONENT}:%{IMAGE_TAG}.tar %{buildroot}/%{_caas_container_tar_path}/
-mkdir -p %{buildroot}/%{_playbooks_path}/
-rsync -av ansible/playbooks/fluentd.yaml %{buildroot}/%{_playbooks_path}/
-
-mkdir -p %{buildroot}/%{_roles_path}/
-rsync -av ansible/roles/fluentd %{buildroot}/%{_roles_path}/
-
%files
%{_caas_container_tar_path}/%{COMPONENT}:%{IMAGE_TAG}.tar
-%{_playbooks_path}/fluentd.yaml
-%{_roles_path}/fluentd
%preun
-
%post
-mkdir -p %{_postconfig_path}/
-ln -sf %{_playbooks_path}/fluentd.yaml %{_postconfig_path}/
-
-%postun
-if [ $1 -eq 0 ]; then
- rm -f %{_postconfig_path}/fluentd.yaml
-fi
-
%clean
rm -rf ${buildroot}
+++ /dev/null
----
-# Copyright 2019 Nokia
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# cmframework.requires: install_caas_infra.yaml
-- hosts: installation_controller:&caas_master
- strategy: free
- become: true
- become_user: "{{ users.admin_user_name }}"
- roles:
- - fluentd
-
+++ /dev/null
----
-# Copyright 2019 Nokia
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-dependencies:
- - role: cert
- instance: "fluentd"
- cert_path: /etc/fluentd/ssl
- become: true
- become_user: "root"
-
- - role: docker_image_load
- images:
- - fluentd
-
- - role: docker_image_push
- images:
- - fluentd
- when: nodename | search("caas_master1")
-
- - role: manifests
+++ /dev/null
----
-# Copyright 2019 Nokia
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-- name: template Fluentd DaemonSet file
- template:
- src: fluentd-ds.yaml
- dest: "{{ caas.manifests_directory }}/fluentd-ds.yaml"
-
-- name: template Fluentd ConfigMap file
- template:
- src: fluentd-cm.yaml
- dest: "{{ caas.manifests_directory }}/fluentd-cm.yaml"
-
-- name: create Fluentd ConfigMap
- kubectl:
- manifest: "{{ caas.manifests_directory }}/fluentd-cm.yaml"
- state: present
-
-- name: create DaemonSet for fluentd
- kubectl:
- manifest: "{{ caas.manifests_directory }}/fluentd-ds.yaml"
- state: present
+++ /dev/null
-{#
-Copyright 2019 Nokia
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-#}
----
-apiVersion: v1
-kind: ConfigMap
-metadata:
- name: fluentd-cm
- namespace: kube-system
-data:
- #Take care that the files will be processed by fluentd in alphabetical order
- 01-fluentd_kubernetes.conf: |-
-
- # Look for files of type *kube-system* and add tag kubernetes
- <source>
- @type tail
- path /var/log/containers/*kube-system*.log
- pos_file /fluentd/log/fluentd-kubernetes.log.pos
- time_format %Y-%m-%dT%H:%M:%S.%NZ
- tag kubernetes.*
- format json
- read_from_head true
- </source>
- # Add kubernetes metadata to "kubernetes" tagged messages
- <filter kubernetes.**>
- @type kubernetes_metadata
- </filter>
-
- 02-fluentd_elasticsearch.conf: |-
-
- # Forward all messages with either kubenetes tag to elasticsearch
- <match kubernetes**>
- @type elasticsearch
- @log_level info
- include_tag_key true
- host "{{ caas.elasticsearch_url }}"
- port "{{ caas.elasticsearch_port }}"
- scheme "{{ elasticsearch_sheme | default('http') }}"
- user "{{ elasticsearch_user | default('elastic') }}"
- password "{{ elasticsearch_passwd | default('changeme') }}"
- ssl_verify "{{ elasticsearch_ssl | default('true') }}"
- reload_connections "{{ elasticsearch_reload_connections | default('true') }}"
- logstash_prefix "{{ elasticsearch_logstash_prefix | default('logstash') }}"
- logstash_format true
- reconnect_on_error true
- resurrect_after 5s
- <buffer tag>
- chunk_limit_size 256m
- flush_at_shutdown "true"
- flush_interval 5s
- </buffer>
- </match>
+++ /dev/null
-{#
-Copyright 2019 Nokia
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-#}
----
-apiVersion: apps/v1beta2
-kind: DaemonSet
-metadata:
- name: fluentd
- namespace: kube-system
- labels:
- {{ caas.kubernetes_component_label }}: fluentd-logging
- version: v1
- kubernetes.io/cluster-service: "true"
-spec:
- selector:
- matchLabels:
- {{ caas.kubernetes_component_label }}: fluentd-logging
- template:
- metadata:
- annotations:
- danm.k8s.io/interfaces: |
- [
- {
- "network":"flannel"
- }
- ]
- labels:
- {{ caas.kubernetes_component_label }}: fluentd-logging
- version: v1
- kubernetes.io/cluster-service: "true"
- spec:
- dnsPolicy: ClusterFirst
- containers:
- - name: fluentd
- image: {{ container_image_names | select('search', '/fluentd') | list | last }}
- command:
- - "/bin/entrypoint.sh"
- - "fluentd"
- - "-c"
- - "/fluentd/etc/fluent.conf"
- - "-p"
- - "/fluentd/plugins"
- securityContext:
- capabilities:
- add:
- - ALL
- env:
- - name: KUBERNETES_SERVICE_HOST
- value: "{{ caas.apiserver_service_name }}"
- - name: KUBERNETES_SERVICE_PORT
- value: "{{ caas.apiserver_svc_port }}"
- - name: FLUENT_ELASTICSEARCH_HOST
- value: "{{ caas.elasticsearch_url }}"
- - name: FLUENT_ELASTICSEARCH_PORT
- value: "{{ caas.elasticsearch_port }}"
- - name: FLUENT_ELASTICSEARCH_SCHEME
- value: "http"
- - name: FLUENT_ELASTICSEARCH_USER
- value: "elastic"
- - name: FLUENT_ELASTICSEARCH_PASSWORD
- value: "changeme"
- - name: FLUENT_ELASTICSEARCH_SSL
- value: "false"
- - name: FLUENTD_OPT
- value: ""
- # TODO: change it to a dynamic ConfigMap, in case something needs to be run-time configurable
- - name: FLUENTD_CONF
- value: "fluent.conf"
- volumeMounts:
- - name: time-mount
- mountPath: /etc/localtime
- readOnly: true
- - name: varlog
- mountPath: /var/log
- - name: varlibdockercontainers
- mountPath: /var/lib/docker/containers
- - name: fluentd-secrets
- mountPath: /etc/fluentd/ssl
- readOnly: true
- - name: fluentd-config
- mountPath: /etc/fluentd/config.d
- terminationGracePeriodSeconds: 30
- volumes:
- - name: time-mount
- hostPath:
- path: /etc/localtime
- - name: varlog
- hostPath:
- path: /var/log
- - name: varlibdockercontainers
- hostPath:
- path: /var/lib/docker/containers
- - name: fluentd-secrets
- hostPath:
- path: /etc/fluentd/ssl
- - name: fluentd-config
- configMap:
- name: fluentd-cm
- serviceAccountName: fluentd
# limitations under the License.
FROM alpine:3.9
-MAINTAINER Levente Kale <levente.kale@nokia.com>
+MAINTAINER Levente Kale <levente.kale@nokia.com>
ARG VERSION
ENV FLUENTD_VERSION=$VERSION
&& gem install fluent-plugin-record-reformer \
&& gem install fluent-plugin-rewrite-tag-filter \
&& gem install fluent-plugin-elasticsearch \
+&& gem install fluent-plugin-remote_syslog \
&& gem install fluent-plugin-kubernetes_metadata_filter \
&& gem install bigdecimal \
&& gem install etc \
&& mkdir -p /fluentd/etc /fluentd/plugins \
&& chmod +x /bin/entrypoint.sh \
&& chmod 700 /fluentd/log
-
-# Copy configuration files
-# TODO: change it to a dynamic ConfigMap, in case something needs to be run-time configurable
-COPY ./conf/fluent.conf /fluentd/etc/
-
"source-url": "https://github.com/uken/fluent-plugin-elasticsearch/archive/v3.2.1.tar.gz",
"foss": "yes"
},
+ {
+ "name": "fluent-plugin-remote_syslog",
+ "version": "1.0.0",
+ "source-url": "https://github.com/dlackty/fluent-plugin-remote_syslog/archive/v1.0.0.tar.gz",
+ "foss": "yes"
+ },
+ {
+ "name": "remote_syslog_sender",
+ "version": "1.2.1",
+ "source-url": "https://github.com/reproio/remote_syslog_sender/archive/v1.2.1.tar.gz",
+ "foss": "yes"
+ },
+ {
+ "name": "syslog_protocol",
+ "version": "0.9.2",
+ "source-url": "https://github.com/eric/syslog_protocol/archive/v0.9.2.tar.gz",
+ "foss": "yes"
+ },
{
"name": "fluent-plugin-kubernetes_metadata_filter",
"version": "2.1.6",
+++ /dev/null
-# Copyright 2019 Nokia
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-<match fluent**>
- @type null
-</match>
-
-@include /etc/fluentd/config.d/*.conf
-