blob: 43b84a57511a9bbe5823541923ffb10a0eb95b24 [file] [log] [blame]
Andy Bavierf15d53a2018-03-07 17:34:30 -07001{{/* vim: set filetype=mustache: */}}
2{{/*
3Copyright 2018-present Open Networking Foundation
4
5Licensed under the Apache License, Version 2.0 (the "License");
6you may not use this file except in compliance with the License.
7You may obtain a copy of the License at
8
9http://www.apache.org/licenses/LICENSE-2.0
10
11Unless required by applicable law or agreed to in writing, software
12distributed under the License is distributed on an "AS IS" BASIS,
13WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14See the License for the specific language governing permissions and
15limitations under the License.
16*/}}
17{{/*
18Expand the name of the chart.
19*/}}
20{{- define "onos.name" -}}
21{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
22{{- end -}}
23
24{{/*
25Create a default fully qualified app name.
26We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
27If release name contains chart name it will be used as a full name.
28*/}}
29{{- define "onos.fullname" -}}
30{{- if .Values.fullnameOverride -}}
31{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
32{{- else -}}
33{{- $name := default .Chart.Name .Values.nameOverride -}}
34{{- if contains $name .Release.Name -}}
35{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
36{{- else -}}
37{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
38{{- end -}}
39{{- end -}}
40{{- end -}}
41
42{{/*
43Create chart name and version as used by the chart label.
44*/}}
45{{- define "onos.chart" -}}
46{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
47{{- end -}}
Matteo Scandolo55ff1502018-09-06 15:15:01 -070048
49{{- define "onos.logCfg" -}}
50################################################################################
51#
52# Licensed to the Apache Software Foundation (ASF) under one or more
53# contributor license agreements. See the NOTICE file distributed with
54# this work for additional information regarding copyright ownership.
55# The ASF licenses this file to You under the Apache License, Version 2.0
56# (the "License"); you may not use this file except in compliance with
57# the License. You may obtain a copy of the License at
58#
59# http://www.apache.org/licenses/LICENSE-2.0
60#
61# Unless required by applicable law or agreed to in writing, software
62# distributed under the License is distributed on an "AS IS" BASIS,
63# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
64# See the License for the specific language governing permissions and
65# limitations under the License.
66#
67################################################################################
68
Daniele Moro09047382020-01-31 16:10:57 -080069# Colors for log level rendering
70color.fatal = bright red
71color.error = bright red
72color.warn = bright yellow
73color.info = bright green
74color.debug = cyan
75color.trace = cyan
Matteo Scandolo55ff1502018-09-06 15:15:01 -070076
Daniele Moro09047382020-01-31 16:10:57 -080077# Common pattern layout for appenders
78log4j2.pattern = %d{ISO8601} | %-5p | %-16t | %-32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n
79log4j2.out.pattern = \u001b[90m%d{HH:mm:ss\.SSS}\u001b[0m %highlight{%-5level}{FATAL=${color.fatal}, ERROR=${color.error}, WARN=${color.warn}, INFO=${color.info}, DEBUG=${color.debug}, TRACE=${color.trace}} \u001b[90m[%c{1}]\u001b[0m %msg%n%throwable
Matteo Scandolo55ff1502018-09-06 15:15:01 -070080
Daniele Moro09047382020-01-31 16:10:57 -080081# Root logger configuration
82log4j2.rootLogger.level = INFO
83# uncomment to use asynchronous loggers, which require mvn:com.lmax/disruptor/3.3.2 library
84#log4j2.rootLogger.type = asyncRoot
85#log4j2.rootLogger.includeLocation = false
86log4j2.rootLogger.appenderRef.RollingFile.ref = RollingFile
87log4j2.rootLogger.appenderRef.Kafka.ref = Kafka
88log4j2.rootLogger.appenderRef.PaxOsgi.ref = PaxOsgi
89log4j2.rootLogger.appenderRef.Console.ref = Console
90log4j2.rootLogger.appenderRef.Console.filter.regex.type = RegexFilter
91log4j2.rootLogger.appenderRef.Console.filter.regex.regex = .*Audit.*
92log4j2.rootLogger.appenderRef.Console.filter.regex.onMatch = DENY
93log4j2.rootLogger.appenderRef.Console.filter.regex.onMismatch = ACCEPT
94#log4j2.rootLogger.appenderRef.Console.filter.threshold.type = ThresholdFilter
95#log4j2.rootLogger.appenderRef.Console.filter.threshold.level = ${karaf.log.console:-OFF}
Matteo Scandolo55ff1502018-09-06 15:15:01 -070096
Daniele Moro09047382020-01-31 16:10:57 -080097# Specific Loggers configuration
Zack Williams7a506d22018-09-24 17:00:13 -070098
Daniele Moro09047382020-01-31 16:10:57 -080099## SSHD logger
100log4j2.logger.sshd.name = org.apache.sshd
101log4j2.logger.sshd.level = INFO
102
103## Spifly logger
104log4j2.logger.spifly.name = org.apache.aries.spifly
105log4j2.logger.spifly.level = WARN
106
107## Kafka logger to avoid recursive logging
108log4j2.logger.apacheKafka.name = org.apache.kafka
109log4j2.logger.apacheKafka.level = INFO
110
111# Appenders configuration
112
113## Console appender not used by default (see log4j2.rootLogger.appenderRefs)
114log4j2.appender.console.type = Console
115log4j2.appender.console.name = Console
116log4j2.appender.console.layout.type = PatternLayout
117log4j2.appender.console.layout.pattern = ${log4j2.out.pattern}
118
119## Rolling file appender
120log4j2.appender.rolling.type = RollingRandomAccessFile
121log4j2.appender.rolling.name = RollingFile
122log4j2.appender.rolling.filter.regex.type = RegexFilter
123log4j2.appender.rolling.filter.regex.regex = .*AuditLog.*
124log4j2.appender.rolling.filter.regex.onMatch = DENY
125log4j2.appender.rolling.filter.regex.onMismatch = ACCEPT
126log4j2.appender.rolling.fileName = ${karaf.data}/log/karaf.log
127log4j2.appender.rolling.filePattern = ${karaf.data}/log/karaf.log.%i
128# uncomment to not force a disk flush
129#log4j2.appender.rolling.immediateFlush = false
130log4j2.appender.rolling.append = true
131log4j2.appender.rolling.layout.type = PatternLayout
132log4j2.appender.rolling.layout.pattern = ${log4j2.pattern}
133log4j2.appender.rolling.rolling.type = DefaultRolloverStrategy
134log4j2.appender.rolling.rolling.max = 10
135log4j2.appender.rolling.policies.type = Policies
136log4j2.appender.rolling.policies.size.type = SizeBasedTriggeringPolicy
137log4j2.appender.rolling.policies.size.size = 10MB
138
139## OSGi appender
140log4j2.appender.osgi.type = PaxOsgi
141log4j2.appender.osgi.name = PaxOsgi
142log4j2.appender.osgi.filter = *
143
144## Kafka appender
145log4j2.appender.kafka.type = Kafka
146log4j2.appender.kafka.name = Kafka
147log4j2.appender.kafka.property.type = Property
148log4j2.appender.kafka.property.name = bootstrap.servers
149log4j2.appender.kafka.property.value = {{- join "," .Values.kafka_logging.brokers }}
150log4j2.appender.kafka.topic = onos.log
151# Async send, no need to wait for Kafka ack for each record
152log4j2.appender.kafka.syncSend = false
153log4j2.kafka.pattern = {"@timestamp":"%d{yyyy-MM-dd'T'HH:mm:ss.SSS'Z'}","levelname":"%p","threadName":"%t","category":"%c{1}","bundle.id":"%X{bundle.id}","bundle.name":"%X{bundle.name}","bundle.version":"%X{bundle.version}","message":"%m"}%n
154log4j2.appender.kafka.layout.type = PatternLayout
155log4j2.appender.kafka.layout.pattern = ${log4j2.kafka.pattern}
Matteo Scandolo55ff1502018-09-06 15:15:01 -0700156
157# Application logs
Matteo Scandolo02112a92018-09-06 15:26:59 -0700158{{ .Values.application_logs }}
Daniele Moro09047382020-01-31 16:10:57 -0800159
Hyunsun Moon90c60502019-10-19 14:46:41 -0600160{{- end -}}
Matteo Scandolo02112a92018-09-06 15:26:59 -0700161
Hyunsun Moon90c60502019-10-19 14:46:41 -0600162{{/*
163Render a Service.
164*/}}
165{{- define "onos.service" -}}
166{{- $name := index . 0 -}}
167{{- $spec := index . 1 -}}
168{{- $context := index . 2 -}}
169{{- $namespace := $context.Release.Namespace }}
170{{- $serviceName := printf "%s-%s" (include "onos.fullname" $context) $name }}
171---
172apiVersion: v1
173kind: Service
174metadata:
175 name: {{ $serviceName }}
176 namespace: {{ $namespace }}
177 labels:
178 app: {{ template "onos.name" $context }}
179 chart: {{ template "onos.chart" $context }}
180 release: {{ $context.Release.Name }}
181 heritage: {{ $context.Release.Service }}
182spec:
183 type: {{ $spec.type }}
184 ports:
185 - name: {{ $name }}
186 port: {{ $spec.port }}
187{{- if and $spec.type (eq (printf "%s" $spec.type) "NodePort") }}
188 nodePort: {{ $spec.nodePort }}
189{{- end }}
190 selector:
191 app: {{ template "onos.name" $context }}
192 release: {{ $context.Release.Name }}
Zack Williams7a506d22018-09-24 17:00:13 -0700193{{- end -}}