Compress image using xz
[ta/caas-logging.git] / ansible / roles / fluentd / templates / fluentd-ds.yaml
1 {#
2 Copyright 2019 Nokia
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8     http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 #}
16 ---
17 apiVersion: apps/v1beta2
18 kind: DaemonSet
19 metadata:
20   name: fluentd
21   namespace: kube-system
22   labels:
23     {{ caas.kubernetes_component_label }}: fluentd-logging
24     version: v1
25     kubernetes.io/cluster-service: "true"
26 spec:
27   selector:
28     matchLabels:
29       {{ caas.kubernetes_component_label }}: fluentd-logging
30   template:
31     metadata:
32       annotations:
33         danm.k8s.io/interfaces: |
34           [
35             {
36               "network":"flannel"
37             }
38           ]
39       labels:
40         {{ caas.kubernetes_component_label }}: fluentd-logging
41         version: v1
42         kubernetes.io/cluster-service: "true"
43     spec:
44       dnsPolicy: ClusterFirst
45       containers:
46       - name: fluentd
47         image: {{ container_image_names | select('search', '/fluentd') | list | last }}
48         command:
49         - "/bin/entrypoint.sh"
50         - "fluentd"
51         - "-c"
52         - "/fluentd/etc/fluent.conf"
53         - "-p"
54         - "/fluentd/plugins"
55         securityContext:
56           capabilities:
57             add:
58               - ALL
59         env:
60           - name:  KUBERNETES_SERVICE_HOST
61             value: "{{ caas.apiserver_service_name }}"
62           - name:  KUBERNETES_SERVICE_PORT
63             value: "{{ caas.apiserver_svc_port }}"
64           - name:  FLUENT_ELASTICSEARCH_HOST
65             value: "{{ caas.elasticsearch_url }}"
66           - name:  FLUENT_ELASTICSEARCH_PORT
67             value: "{{ caas.elasticsearch_port }}"
68           - name: FLUENT_ELASTICSEARCH_SCHEME
69             value: "http"
70           - name: FLUENT_ELASTICSEARCH_USER
71             value: "elastic"
72           - name: FLUENT_ELASTICSEARCH_PASSWORD
73             value: "changeme"
74           - name: FLUENT_ELASTICSEARCH_SSL
75             value: "false"
76           - name: FLUENTD_OPT
77             value: ""
78           # TODO: change it to a dynamic ConfigMap, in case something needs to be run-time configurable
79           - name: FLUENTD_CONF
80             value: "fluent.conf"
81         volumeMounts:
82         - name: time-mount
83           mountPath: /etc/localtime
84           readOnly: true
85         - name: varlog
86           mountPath: /var/log
87         - name: varlibdockercontainers
88           mountPath: /var/lib/docker/containers
89         - name: fluentd-secrets
90           mountPath: /etc/fluentd/ssl
91           readOnly: true
92         - name: fluentd-config
93           mountPath: /etc/fluentd/config.d
94       terminationGracePeriodSeconds: 30
95       volumes:
96       - name: time-mount
97         hostPath:
98           path: /etc/localtime
99       - name: varlog
100         hostPath:
101           path: /var/log
102       - name: varlibdockercontainers
103         hostPath:
104           path: /var/lib/docker/containers
105       - name: fluentd-secrets
106         hostPath:
107           path: /etc/fluentd/ssl
108       - name: fluentd-config
109         configMap:
110           name: fluentd-cm
111       serviceAccountName: fluentd