Merge "[CLAMP] Update mariadb db to latest"
[oom.git] / kubernetes / common / logConfiguration / 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 {{/*
18   Resolve the level of the logs.
19   The value for .Values.logLevel is used by default,
20   unless either override mechanism is used.
21
22   - .Values.global.logLevel  : override default log level for all components
23   - .Values.logLevelOverride : override global and default log level on a per
24                                component basis
25
26   The function can takes below arguments (inside a dictionary):
27      - .dot : environment (.)
28      - .initRoot : the root dictionary of logConfiguration submodule
29                    (default to .Values.logConfiguration)
30 */}}
31 {{- define "common.log.level" -}}
32 {{-   $dot := default . .dot -}}
33 {{-   $initRoot := default $dot.Values.logConfiguration .initRoot -}}
34 {{/*  Our version of helm doesn't support deepCopy so we need this nasty trick */}}
35 {{-   $subchartDot := fromJson (include "common.subChartDot" (dict "dot" $dot "initRoot" $initRoot)) }}
36   {{- if $subchartDot.Values.logLevelOverride }}
37     {{- printf "%s" $subchartDot.Values.logLevelOverride -}}
38   {{- else }}
39     {{- default $subchartDot.Values.logLevel $subchartDot.Values.global.logLevel -}}
40   {{- end }}
41 {{- end -}}