Added seed code for caas-logging.
[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: varlog
83           mountPath: /var/log
84         - name: varlibdockercontainers
85           mountPath: /var/lib/docker/containers
86         - name: fluentd-secrets
87           mountPath: /etc/fluentd/ssl
88           readOnly: true
89         - name: fluentd-config
90           mountPath: /etc/fluentd/config.d
91       terminationGracePeriodSeconds: 30
92       volumes:
93       - name: varlog
94         hostPath:
95           path: /var/log
96       - name: varlibdockercontainers
97         hostPath:
98           path: /var/lib/docker/containers
99       - name: fluentd-secrets
100         hostPath:
101           path: /etc/fluentd/ssl
102       - name: fluentd-config
103         configMap:
104           name: fluentd-cm
105       serviceAccountName: fluentd