blob: e463cc17159fb00e9a4999642fd3a059c5cc4bae [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 Bainbridgee5887072019-11-14 23:01:01 +000014{{- if not .Values.therecanbeonlyone }}
David Bainbridge50cb1ef2019-07-23 22:36:17 +000015{{- $set_log_level := tpl .Values.rw_core.log_level . | upper }}
16{{- $log_level := 3 }}
17{{- if eq $set_log_level "DEBUG" }}
18{{- $log_level = 0 }}
19{{- else if eq $set_log_level "INFO" }}
20{{- $log_level = 1 }}
21{{- else if eq $set_log_level "WARN" }}
22{{- $log_level = 2 }}
23{{- else if eq $set_log_level "ERROR" }}
24{{- $log_level = 3 }}
25{{- else if eq $set_log_level "PANIC" }}
26{{- $log_level = 4 }}
27{{- else if eq $set_log_level "FATAL" }}
28{{- $log_level = 5 }}
29{{- else }}
30{{- $log_level = 3 }}
31{{- end }}
David Bainbridge2f9b76f2019-05-15 13:48:11 -070032
33---
Kent Hagerman1b333b92019-07-22 16:57:20 -040034apiVersion: v1
35kind: Service
David Bainbridge2f9b76f2019-05-15 13:48:11 -070036metadata:
Kent Hagerman1b333b92019-07-22 16:57:20 -040037 name: voltha-ro-core
38spec:
39 ports:
40 - name: grpc
41 port: 50057
42 clusterIP: None
43 selector:
44 app: ro-core
45
46---
47apiVersion: apps/v1
48kind: StatefulSet
49metadata:
50 name: voltha-ro-core
David Bainbridge2f9b76f2019-05-15 13:48:11 -070051 serviceAccountName: {{ .Values.serviceaccount }}
David Bainbridge534a73d2019-08-30 18:57:23 +000052 {{- if or (hasKey .Values "extra_deployment_labels") (hasKey .Values "ro_core_deployment_labels") }}
53 labels:
54 {{- if hasKey .Values "extra_deployment_labels" }}
55 {{- range $key, $val := .Values.extra_deployment_labels }}
56 {{ $key }}: {{ $val | quote }}
57 {{- end }}
58 {{- end }}
59 {{- if hasKey .Values "ro_core_deployment_labels" }}
60 {{- range $key, $val := .Values.ro_core_deployment_labels }}
61 {{ $key }}: {{ $val | quote }}
62 {{- end }}
63 {{- end }}
64 {{- end }}
David Bainbridge2f9b76f2019-05-15 13:48:11 -070065spec:
66 replicas: {{ .Values.replicas.ro_core }}
67 selector:
68 matchLabels:
69 app: ro-core
Kent Hagerman1b333b92019-07-22 16:57:20 -040070 serviceName: voltha-ro-core
71 podManagementPolicy: Parallel
David Bainbridge2f9b76f2019-05-15 13:48:11 -070072 template:
73 metadata:
74 labels:
75 app: ro-core
David Bainbridge1f888042019-06-24 18:02:01 +000076 app.kubernetes.io/name: "read-only-core"
77 app.kubernetes.io/version: {{ quote .Chart.AppVersion }}
78 app.kubernetes.io/component: "core"
79 app.kubernetes.io/part-of: "voltha"
80 app.kubernetes.io/managed-by: {{ quote .Release.Service }}
81 helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
David Bainbridge534a73d2019-08-30 18:57:23 +000082 {{- if hasKey .Values "extra_pod_labels" }}
83 {{- range $key, $val := .Values.extra_pod_labels }}
84 {{ $key }}: {{ $val | quote }}
85 {{- end }}
86 {{- end }}
87 {{- if hasKey .Values "ro_core_pod_labels" }}
88 {{- range $key, $val := .Values.ro_core_pod_labels }}
89 {{ $key }}: {{ $val | quote }}
90 {{- end }}
91 {{- end }}
David Bainbridge2f9b76f2019-05-15 13:48:11 -070092 annotations:
93 cni: "calico"
94 spec:
95 affinity:
96 podAntiAffinity:
Kent Hagerman1b333b92019-07-22 16:57:20 -040097 requiredDuringSchedulingIgnoredDuringExecution:
98 - topologyKey: "kubernetes.io/hostname"
David Bainbridge2f9b76f2019-05-15 13:48:11 -070099 labelSelector:
100 matchExpressions:
Kent Hagerman1b333b92019-07-22 16:57:20 -0400101 - key: app
102 operator: In
103 values:
104 - ro-core
David Bainbridge2f9b76f2019-05-15 13:48:11 -0700105 serviceAccountName: {{ .Values.serviceaccount }}
106 containers:
107 - name: voltha
David Bainbridge03706e62019-10-18 17:59:24 +0000108 image: '{{ tpl .Values.images.ro_core.registry . }}{{ tpl .Values.images.ro_core.repository . }}:{{ tpl .Values.images.ro_core.tag . }}'
David Bainbridgecd30e542019-05-31 20:52:56 +0000109 imagePullPolicy: {{ tpl .Values.images.ro_core.pullPolicy . }}
David Bainbridge2f9b76f2019-05-15 13:48:11 -0700110 env:
111 - name: NAMESPACE
112 value: {{ quote .Release.Namespace }}
113 - name: POD_IP
114 valueFrom:
115 fieldRef:
116 fieldPath: status.podIP
David Bainbridge2f9b76f2019-05-15 13:48:11 -0700117 args:
118 - "/app/ro_core"
119 - "-kv_store_type=etcd"
David Bainbridgecd30e542019-05-31 20:52:56 +0000120 - "-kv_store_host={{ .Values.services.etcd.service }}"
121 - "-kv_store_port={{ .Values.services.etcd.port }}"
David Bainbridge2f9b76f2019-05-15 13:48:11 -0700122 - "-grpc_host=$(POD_IP)"
123 - "-grpc_port=50057"
124 - "-banner=true"
125 - "-ro_core_topic=rocore"
David Bainbridge50cb1ef2019-07-23 22:36:17 +0000126 - "-log_level={{ $log_level }}"
Hardik Windlass07947982019-09-30 08:41:23 +0000127 - "-probe_port=8080"
David Bainbridge2f9b76f2019-05-15 13:48:11 -0700128 ports:
129 - containerPort: 50057
130 name: grpc-port
Hardik Windlass07947982019-09-30 08:41:23 +0000131 livenessProbe:
132 httpGet:
133 path: /healthz
134 port: 8080
135 initialDelaySeconds: 10
136 periodSeconds: 5
137 readinessProbe:
138 httpGet:
139 path: /readz
140 port: 8080
141 initialDelaySeconds: 10
142 periodSeconds: 5
David Bainbridgee5887072019-11-14 23:01:01 +0000143{{- end }}