Merge "[AAI] Add model-loader tracing config"
[oom.git] / kubernetes / common / common / templates / _log.tpl
1 {{/*
2 # Copyright © 2020 Orange
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 {{- define "common.log.sidecar" -}}
18 {{- if .Values.global.centralizedLoggingEnabled }}
19 - name: {{ include "common.name" . }}-filebeat
20   image: {{ include "repositoryGenerator.image.logging" . }}
21   imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
22   volumeMounts:
23   - name: filebeat-conf
24     mountPath: /usr/share/filebeat/filebeat.yml
25     subPath: filebeat.yml
26   - name: logs
27     mountPath: {{ .Values.log.path }}
28   - name: filebeat-data
29     mountPath: /usr/share/filebeat/data
30   resources:
31     requests:
32       cpu: "10m"
33       memory: "5Mi"
34     limits:
35       cpu: "100m"
36       memory: "20Mi"
37 {{- end -}}
38 {{- end -}}
39
40 {{- define "common.log.volumes" -}}
41 {{- $dot := default . .dot }}
42 {{- if $dot.Values.global.centralizedLoggingEnabled }}
43 {{- $configMapName := printf "%s-filebeat" (default (include "common.fullname" $dot) .configMapNamePrefix) }}
44 - name: filebeat-conf
45   configMap:
46     name: {{ $configMapName }}
47 - name: filebeat-data
48   emptyDir: {}
49 {{- end -}}
50 {{- end -}}
51
52 {{- define "common.log.configMap" -}}
53 {{- if .Values.global.centralizedLoggingEnabled }}
54 ---
55 apiVersion: v1
56 kind: ConfigMap
57 metadata: {{- include "common.resourceMetadata" (dict "dot" . "suffix" "filebeat") | nindent 2 }}
58 data:
59 {{ tpl (.Files.Glob "resources/config/log/filebeat/*").AsConfig . | indent 2 }}
60 {{- end }}
61 {{- end -}}
62