blob: 7553c28408f128e6378017dd3edb1d39fdb1523e [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---
Kent Hagerman1b333b92019-07-22 16:57:20 -040033apiVersion: v1
34kind: Service
David Bainbridge2f9b76f2019-05-15 13:48:11 -070035metadata:
Kent Hagerman1b333b92019-07-22 16:57:20 -040036 name: voltha-ro-core
37spec:
38 ports:
39 - name: grpc
40 port: 50057
41 clusterIP: None
42 selector:
43 app: ro-core
44
45---
46apiVersion: apps/v1
47kind: StatefulSet
48metadata:
49 name: voltha-ro-core
David Bainbridge2f9b76f2019-05-15 13:48:11 -070050 serviceAccountName: {{ .Values.serviceaccount }}
David Bainbridge534a73d2019-08-30 18:57:23 +000051 {{- if or (hasKey .Values "extra_deployment_labels") (hasKey .Values "ro_core_deployment_labels") }}
52 labels:
53 {{- if hasKey .Values "extra_deployment_labels" }}
54 {{- range $key, $val := .Values.extra_deployment_labels }}
55 {{ $key }}: {{ $val | quote }}
56 {{- end }}
57 {{- end }}
58 {{- if hasKey .Values "ro_core_deployment_labels" }}
59 {{- range $key, $val := .Values.ro_core_deployment_labels }}
60 {{ $key }}: {{ $val | quote }}
61 {{- end }}
62 {{- end }}
63 {{- end }}
David Bainbridge2f9b76f2019-05-15 13:48:11 -070064spec:
65 replicas: {{ .Values.replicas.ro_core }}
66 selector:
67 matchLabels:
68 app: ro-core
Kent Hagerman1b333b92019-07-22 16:57:20 -040069 serviceName: voltha-ro-core
70 podManagementPolicy: Parallel
David Bainbridge2f9b76f2019-05-15 13:48:11 -070071 template:
72 metadata:
73 labels:
74 app: ro-core
David Bainbridge1f888042019-06-24 18:02:01 +000075 app.kubernetes.io/name: "read-only-core"
76 app.kubernetes.io/version: {{ quote .Chart.AppVersion }}
77 app.kubernetes.io/component: "core"
78 app.kubernetes.io/part-of: "voltha"
79 app.kubernetes.io/managed-by: {{ quote .Release.Service }}
80 helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
David Bainbridge534a73d2019-08-30 18:57:23 +000081 {{- if hasKey .Values "extra_pod_labels" }}
82 {{- range $key, $val := .Values.extra_pod_labels }}
83 {{ $key }}: {{ $val | quote }}
84 {{- end }}
85 {{- end }}
86 {{- if hasKey .Values "ro_core_pod_labels" }}
87 {{- range $key, $val := .Values.ro_core_pod_labels }}
88 {{ $key }}: {{ $val | quote }}
89 {{- end }}
90 {{- end }}
David Bainbridge2f9b76f2019-05-15 13:48:11 -070091 annotations:
92 cni: "calico"
93 spec:
94 affinity:
95 podAntiAffinity:
Kent Hagerman1b333b92019-07-22 16:57:20 -040096 requiredDuringSchedulingIgnoredDuringExecution:
97 - topologyKey: "kubernetes.io/hostname"
David Bainbridge2f9b76f2019-05-15 13:48:11 -070098 labelSelector:
99 matchExpressions:
Kent Hagerman1b333b92019-07-22 16:57:20 -0400100 - key: app
101 operator: In
102 values:
103 - ro-core
David Bainbridge2f9b76f2019-05-15 13:48:11 -0700104 serviceAccountName: {{ .Values.serviceaccount }}
105 containers:
106 - name: voltha
David Bainbridge5cb5d172019-07-24 02:30:19 +0000107 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 +0000108 imagePullPolicy: {{ tpl .Values.images.ro_core.pullPolicy . }}
David Bainbridge2f9b76f2019-05-15 13:48:11 -0700109 env:
110 - name: NAMESPACE
111 value: {{ quote .Release.Namespace }}
112 - name: POD_IP
113 valueFrom:
114 fieldRef:
115 fieldPath: status.podIP
David Bainbridge2f9b76f2019-05-15 13:48:11 -0700116 args:
117 - "/app/ro_core"
118 - "-kv_store_type=etcd"
David Bainbridgecd30e542019-05-31 20:52:56 +0000119 - "-kv_store_host={{ .Values.services.etcd.service }}"
120 - "-kv_store_port={{ .Values.services.etcd.port }}"
David Bainbridge2f9b76f2019-05-15 13:48:11 -0700121 - "-grpc_host=$(POD_IP)"
122 - "-grpc_port=50057"
123 - "-banner=true"
124 - "-ro_core_topic=rocore"
David Bainbridge50cb1ef2019-07-23 22:36:17 +0000125 - "-log_level={{ $log_level }}"
Hardik Windlass07947982019-09-30 08:41:23 +0000126 - "-probe_port=8080"
David Bainbridge2f9b76f2019-05-15 13:48:11 -0700127 ports:
128 - containerPort: 50057
129 name: grpc-port
Hardik Windlass07947982019-09-30 08:41:23 +0000130 livenessProbe:
131 httpGet:
132 path: /healthz
133 port: 8080
134 initialDelaySeconds: 10
135 periodSeconds: 5
136 readinessProbe:
137 httpGet:
138 path: /readz
139 port: 8080
140 initialDelaySeconds: 10
141 periodSeconds: 5