Andy Bavier | f15d53a | 2018-03-07 17:34:30 -0700 | [diff] [blame] | 1 | {{/* vim: set filetype=mustache: */}} |
| 2 | {{/* |
| 3 | Copyright 2018-present Open Networking Foundation |
| 4 | |
| 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | you may not use this file except in compliance with the License. |
| 7 | You may obtain a copy of the License at |
| 8 | |
| 9 | http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | |
| 11 | Unless required by applicable law or agreed to in writing, software |
| 12 | distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | See the License for the specific language governing permissions and |
| 15 | limitations under the License. |
| 16 | */}} |
| 17 | {{/* |
| 18 | Expand the name of the chart. |
| 19 | */}} |
| 20 | {{- define "onos.name" -}} |
| 21 | {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} |
| 22 | {{- end -}} |
| 23 | |
| 24 | {{/* |
| 25 | Create a default fully qualified app name. |
| 26 | We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). |
| 27 | If 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 | {{/* |
| 43 | Create 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 Scandolo | 55ff150 | 2018-09-06 15:15:01 -0700 | [diff] [blame] | 48 | |
| 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 | |
| 69 | # Root logger |
Zack Williams | 7a506d2 | 2018-09-24 17:00:13 -0700 | [diff] [blame] | 70 | log4j.rootLogger=INFO, out, json, osgi:*, stdout |
Matteo Scandolo | 55ff150 | 2018-09-06 15:15:01 -0700 | [diff] [blame] | 71 | log4j.throwableRenderer=org.apache.log4j.OsgiThrowableRenderer |
| 72 | |
| 73 | # CONSOLE appender not used by default |
| 74 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender |
| 75 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout |
| 76 | log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n |
| 77 | |
| 78 | # File appender |
| 79 | log4j.appender.out=org.apache.log4j.RollingFileAppender |
| 80 | log4j.appender.out.layout=org.apache.log4j.PatternLayout |
| 81 | log4j.appender.out.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n |
| 82 | log4j.appender.out.file=${karaf.data}/log/karaf.log |
| 83 | log4j.appender.out.append=true |
| 84 | log4j.appender.out.maxFileSize=10MB |
| 85 | log4j.appender.out.maxBackupIndex=10 |
| 86 | |
Zack Williams | 7a506d2 | 2018-09-24 17:00:13 -0700 | [diff] [blame] | 87 | # JSON-ish appender (doesn't handle quotes in fields correctly) |
| 88 | # docs: https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html |
| 89 | log4j.appender.json=org.apache.log4j.RollingFileAppender |
| 90 | log4j.appender.json.layout=org.apache.log4j.PatternLayout |
| 91 | log4j.appender.json.layout.ConversionPattern={"@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 |
| 92 | log4j.appender.json.file=${karaf.data}/log/karaf_json.log |
| 93 | log4j.appender.json.append=true |
| 94 | log4j.appender.json.maxFileSize=10MB |
| 95 | log4j.appender.json.maxBackupIndex=10 |
| 96 | |
| 97 | # Sift appender - one logfile per bundle ID |
Matteo Scandolo | 55ff150 | 2018-09-06 15:15:01 -0700 | [diff] [blame] | 98 | log4j.appender.sift=org.apache.log4j.sift.MDCSiftingAppender |
| 99 | log4j.appender.sift.key=bundle.name |
| 100 | log4j.appender.sift.default=karaf |
| 101 | log4j.appender.sift.appender=org.apache.log4j.FileAppender |
| 102 | log4j.appender.sift.appender.layout=org.apache.log4j.PatternLayout |
| 103 | log4j.appender.sift.appender.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %m%n |
| 104 | log4j.appender.sift.appender.file=${karaf.data}/log/$\\{bundle.name\\}.log |
| 105 | log4j.appender.sift.appender.append=true |
| 106 | |
| 107 | # Application logs |
Matteo Scandolo | 02112a9 | 2018-09-06 15:26:59 -0700 | [diff] [blame] | 108 | {{ .Values.application_logs }} |
Hyunsun Moon | 90c6050 | 2019-10-19 14:46:41 -0600 | [diff] [blame] | 109 | {{- end -}} |
Matteo Scandolo | 02112a9 | 2018-09-06 15:26:59 -0700 | [diff] [blame] | 110 | |
Hyunsun Moon | 90c6050 | 2019-10-19 14:46:41 -0600 | [diff] [blame] | 111 | {{/* |
| 112 | Render a Service. |
| 113 | */}} |
| 114 | {{- define "onos.service" -}} |
| 115 | {{- $name := index . 0 -}} |
| 116 | {{- $spec := index . 1 -}} |
| 117 | {{- $context := index . 2 -}} |
| 118 | {{- $namespace := $context.Release.Namespace }} |
| 119 | {{- $serviceName := printf "%s-%s" (include "onos.fullname" $context) $name }} |
| 120 | --- |
| 121 | apiVersion: v1 |
| 122 | kind: Service |
| 123 | metadata: |
| 124 | name: {{ $serviceName }} |
| 125 | namespace: {{ $namespace }} |
| 126 | labels: |
| 127 | app: {{ template "onos.name" $context }} |
| 128 | chart: {{ template "onos.chart" $context }} |
| 129 | release: {{ $context.Release.Name }} |
| 130 | heritage: {{ $context.Release.Service }} |
| 131 | spec: |
| 132 | type: {{ $spec.type }} |
| 133 | ports: |
| 134 | - name: {{ $name }} |
| 135 | port: {{ $spec.port }} |
| 136 | {{- if and $spec.type (eq (printf "%s" $spec.type) "NodePort") }} |
| 137 | nodePort: {{ $spec.nodePort }} |
| 138 | {{- end }} |
| 139 | selector: |
| 140 | app: {{ template "onos.name" $context }} |
| 141 | release: {{ $context.Release.Name }} |
Zack Williams | 7a506d2 | 2018-09-24 17:00:13 -0700 | [diff] [blame] | 142 | {{- end -}} |