blob: 7a60699d8de51d32efa97669500df2c303d76c1d [file] [log] [blame]
David Bainbridge2f9b76f2019-05-15 13:48:11 -07001# Copyright 2019-present Open Networking Foundation
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.
David Bainbridge50cb1ef2019-07-23 22:36:17 +000014{{- $set_log_level := tpl .Values.rw_core.log_level . | upper }}
15{{- $log_level := 3 }}
16{{- if eq $set_log_level "DEBUG" }}
17{{- $log_level = 0 }}
18{{- else if eq $set_log_level "INFO" }}
19{{- $log_level = 1 }}
20{{- else if eq $set_log_level "WARN" }}
21{{- $log_level = 2 }}
22{{- else if eq $set_log_level "ERROR" }}
23{{- $log_level = 3 }}
24{{- else if eq $set_log_level "PANIC" }}
25{{- $log_level = 4 }}
26{{- else if eq $set_log_level "FATAL" }}
27{{- $log_level = 5 }}
28{{- else }}
29{{- $log_level = 3 }}
30{{- end }}
David Bainbridge2f9b76f2019-05-15 13:48:11 -070031
32---
33apiVersion: apps/v1
34kind: Deployment
35metadata:
36 name: ro-core
37 serviceAccountName: {{ .Values.serviceaccount }}
38spec:
39 replicas: {{ .Values.replicas.ro_core }}
40 selector:
41 matchLabels:
42 app: ro-core
43 template:
44 metadata:
45 labels:
46 app: ro-core
David Bainbridge1f888042019-06-24 18:02:01 +000047 app.kubernetes.io/name: "read-only-core"
48 app.kubernetes.io/version: {{ quote .Chart.AppVersion }}
49 app.kubernetes.io/component: "core"
50 app.kubernetes.io/part-of: "voltha"
51 app.kubernetes.io/managed-by: {{ quote .Release.Service }}
52 helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
David Bainbridge2f9b76f2019-05-15 13:48:11 -070053 annotations:
54 cni: "calico"
55 spec:
56 affinity:
57 podAntiAffinity:
58 preferredDuringSchedulingIgnoredDuringExecution:
59 - weight: 100
60 podAffinityTerm:
61 labelSelector:
62 matchExpressions:
63 - key: app
64 operator: In
65 values:
66 - ro-core
67 topologyKey: "kubernetes.io/hostname"
68 serviceAccountName: {{ .Values.serviceaccount }}
69 containers:
70 - name: voltha
David Bainbridge5cb5d172019-07-24 02:30:19 +000071 image: {{ tpl .Values.images.ro_core.registry . }}{{ tpl .Values.images.ro_core.repository . }}:{{ tpl ( tpl .Values.images.ro_core.tag . ) . }}
David Bainbridgecd30e542019-05-31 20:52:56 +000072 imagePullPolicy: {{ tpl .Values.images.ro_core.pullPolicy . }}
David Bainbridge2f9b76f2019-05-15 13:48:11 -070073 env:
74 - name: NAMESPACE
75 value: {{ quote .Release.Namespace }}
76 - name: POD_IP
77 valueFrom:
78 fieldRef:
79 fieldPath: status.podIP
David Bainbridge2f9b76f2019-05-15 13:48:11 -070080 args:
81 - "/app/ro_core"
82 - "-kv_store_type=etcd"
David Bainbridgecd30e542019-05-31 20:52:56 +000083 - "-kv_store_host={{ .Values.services.etcd.service }}"
84 - "-kv_store_port={{ .Values.services.etcd.port }}"
David Bainbridge2f9b76f2019-05-15 13:48:11 -070085 - "-grpc_host=$(POD_IP)"
86 - "-grpc_port=50057"
87 - "-banner=true"
88 - "-ro_core_topic=rocore"
David Bainbridge50cb1ef2019-07-23 22:36:17 +000089 - "-log_level={{ $log_level }}"
David Bainbridge2f9b76f2019-05-15 13:48:11 -070090 ports:
91 - containerPort: 50057
92 name: grpc-port