add filebeat to k8s log demo
[logging-analytics.git] / reference / logging-kubernetes / logdemonode / charts / logdemonode / templates / deployment.yaml
1 # Copyright © 2017 Amdocs, Bell Canada
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #       http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 apiVersion: extensions/v1beta1
16 kind: Deployment
17 metadata:
18   name: {{ include "common.fullname" . }}
19   namespace: {{ include "common.namespace" . }}
20   labels:
21     app: {{ include "common.name" . }}
22     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
23     release: {{ .Release.Name }}
24     heritage: {{ .Release.Service }}
25 spec:
26   replicas: {{ .Values.replicaCount }}
27   template:
28     metadata:
29       labels:
30         app: {{ include "common.name" . }}
31         release: {{ .Release.Name }}
32     spec:
33       initContainers:
34 #Example init container for dependency checking
35       containers:
36         # side car container
37         - name: {{ include "common.name" . }}-filebeat-onap
38           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
39           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
40           volumeMounts:
41           - name: {{ include "common.fullname" . }}-filebeat-conf
42             mountPath: /usr/share/filebeat/filebeat.yml
43             subPath: filebeat.yml
44           - name: {{ include "common.fullname" . }}-data-filebeat
45             mountPath: /usr/share/filebeat/data
46           - name: {{ include "common.fullname" . }}-logs
47             mountPath: /var/log/onap
48
49         - name: {{ include "common.name" . }}
50           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
51           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} 
52 #          args:
53 #           - "-Dcom.att.eelf.logging.file=file:/opt/logdemonode/logback.xml"
54 #           - ""
55           ports:
56           - containerPort: {{ .Values.service.internalPort }}
57           # disable liveness probe when breakpoints set in debugger
58           # so K8s doesn't restart unresponsive container
59           {{ if .Values.liveness.enabled }}
60           livenessProbe:
61             tcpSocket:
62               port: {{ .Values.service.internalPort }}
63             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
64             periodSeconds: {{ .Values.liveness.periodSeconds }}
65           {{ end }}
66           readinessProbe:
67             tcpSocket:
68               port: {{ .Values.service.internalPort }}
69             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
70             periodSeconds: {{ .Values.readiness.periodSeconds }}
71           env:
72 #Example environment variable passed to container
73 #            - name: DEBUG_FLAG
74 #              value: {{ .Values.global.debugEnabled | default .Values.debugEnabled | quote }}
75           volumeMounts:
76           - name: {{ include "common.fullname" . }}-logs
77             mountPath: /var/log/onap
78           - name: {{ include "common.fullname" . }}-logs-config
79             mountPath: /opt/logback.xml
80             subPath: logback.xml
81           - mountPath: /etc/localtime
82             name: localtime
83             readOnly: true
84 #Example config file mount into container
85 #          - mountPath: /opt/app/application.properties
86 #            name: {{ include "common.name" . }}-config
87 #            subPath: application.properties
88           resources:
89 {{ toYaml .Values.resources | indent 12 }}
90         {{- if .Values.nodeSelector }}
91         nodeSelector:
92 {{ toYaml .Values.nodeSelector | indent 10 }}
93         {{- end -}}
94         {{- if .Values.affinity }}
95         affinity:
96 {{ toYaml .Values.affinity | indent 10 }}
97         {{- end }}
98
99       volumes:
100         - name: localtime
101           hostPath:
102             path: /etc/localtime
103 #Example config file mount into container
104         - name: {{ include "common.fullname" . }}-logs-config
105           configMap:
106             name: {{ include "common.fullname" . }}-logback-configmap
107             items:
108             - key: logback.xml
109               path: logback.xml
110         - name: {{ include "common.fullname" . }}-filebeat-conf
111           configMap:
112             name: {{ include "common.fullname" . }}-filebeat-configmap
113         - name: {{ include "common.fullname" . }}-data-filebeat
114           emptyDir: {}
115         - name: {{ include "common.fullname" . }}-logs
116           emptyDir: {}
117       imagePullSecrets:
118       - name: "{{ include "common.namespace" . }}-docker-registry-key"