blob: ee2ddd096c733d965e7f3cd11da0f55de000265e [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.
14
15{{- $root := . -}}
16{{- $count := mul .Values.replicas.rw_core 2 | int }}
17{{- $tag := tpl .Values.images.rw_core.tag . }}
David Bainbridgecd30e542019-05-31 20:52:56 +000018{{- $repository := tpl .Values.images.rw_core.repository . }}
19{{- $registry := tpl .Values.images.rw_core.registry . }}
20{{- $pullpolicy := tpl .Values.images.rw_core.pullPolicy . }}
21{{- $core_timeout := tpl $root.Values.rw_core.core_timeout . }}
22{{- $long_request_timeout := tpl $root.Values.rw_core.timeout_long_request . }}
23{{- $request_timeout := tpl $root.Values.rw_core.timeout_request . }}
David Bainbridge2f9b76f2019-05-15 13:48:11 -070024{{- range $i, $e := until $count }}
25{{- $core_idx := add $i 1 }}
Kent Hagermanc51b4e72019-06-19 12:40:16 -040026{{- $affinity_group := add1 (div $i 2) }}
David Bainbridge2f9b76f2019-05-15 13:48:11 -070027---
28apiVersion: apps/v1
29kind: Deployment
30metadata:
31 name: rw-core{{ $core_idx }}
32 serviceAccountName: {{ $root.Values.serviceaccount }}
33spec:
34 replicas: 1
35 selector:
36 matchLabels:
37 app: rw-core
38 template:
39 metadata:
40 labels:
41 app: rw-core
David Bainbridge53af8ba2019-05-24 14:41:34 +000042 affinity-group: affinity-group-{{ $affinity_group }}
David Bainbridge1f888042019-06-24 18:02:01 +000043 app.kubernetes.io/name: "read-write-core"
44 app.kubernetes.io/version: {{ quote $root.Chart.AppVersion }}
45 app.kubernetes.io/component: "core"
46 app.kubernetes.io/part-of: "voltha"
47 app.kubernetes.io/managed-by: {{ quote $root.Release.Service }}
48 helm.sh/chart: "{{ $root.Chart.Name }}-{{ $root.Chart.Version }}"
David Bainbridge2f9b76f2019-05-15 13:48:11 -070049 annotations:
50 cni: "calico"
51 spec:
52 affinity:
53 podAntiAffinity:
David Bainbridge53af8ba2019-05-24 14:41:34 +000054 preferredDuringSchedulingIgnoredDuringExecution:
55 - weight: 100
56 podAffinityTerm:
57 labelSelector:
58 matchExpressions:
59 - key: app
60 operator: In
61 values:
62 - rw-core
63 topologyKey: "kubernetes.io/hostname"
David Bainbridge2f9b76f2019-05-15 13:48:11 -070064 requiredDuringSchedulingIgnoredDuringExecution:
65 - labelSelector:
66 matchExpressions:
David Bainbridge53af8ba2019-05-24 14:41:34 +000067 - key: affinity-group
David Bainbridge2f9b76f2019-05-15 13:48:11 -070068 operator: In
69 values:
David Bainbridge53af8ba2019-05-24 14:41:34 +000070 - affinity-group-{{ $affinity_group }}
David Bainbridge2f9b76f2019-05-15 13:48:11 -070071 topologyKey: "kubernetes.io/hostname"
72 serviceAccountName: {{ $root.Values.serviceaccount }}
73 containers:
74 - name: voltha
David Bainbridgecd30e542019-05-31 20:52:56 +000075 image: {{ $registry }}{{ $repository }}:{{ $tag }}
76 imagePullPolicy: {{ $pullpolicy }}
David Bainbridge2f9b76f2019-05-15 13:48:11 -070077 env:
78 - name: NAMESPACE
79 value: {{ quote $root.Release.Namespace }}
80 - name: POD_IP
81 valueFrom:
82 fieldRef:
83 fieldPath: status.podIP
David Bainbridge2f9b76f2019-05-15 13:48:11 -070084 args:
85 - "/app/rw_core"
86 - "-kv_store_type=etcd"
David Bainbridgecd30e542019-05-31 20:52:56 +000087 - "-kv_store_host={{ $root.Values.services.etcd.service }}"
88 - "-kv_store_port={{ $root.Values.services.etcd.port }}"
David Bainbridge2f9b76f2019-05-15 13:48:11 -070089 - "-grpc_host=$(POD_IP)"
90 - "-grpc_port=50057"
91 - "-banner=true"
David Bainbridgecd30e542019-05-31 20:52:56 +000092 - "-kafka_adapter_host={{ $root.Values.services.kafka.adapter.service }}"
93 - "-kafka_adapter_port={{ $root.Values.services.kafka.adapter.port }}"
94 - "-kafka_cluster_host={{ $root.Values.services.kafka.cluster.port }}"
95 - "-kafka_cluster_port={{ $root.Values.services.kafka.cluster.port }}"
David Bainbridge2f9b76f2019-05-15 13:48:11 -070096 - "-rw_core_topic=rwcore"
97 - "-kv_store_data_prefix=service/voltha"
98 - "-in_competing_mode=true"
David Bainbridgecd30e542019-05-31 20:52:56 +000099 - "-core_timeout={{ $core_timeout }}"
100 - "-timeout_long_request={{ $long_request_timeout }}"
101 - "-timeout_request={{ $request_timeout }}"
102 - "-log_level=2"
David Bainbridge2f9b76f2019-05-15 13:48:11 -0700103 ports:
104 - containerPort: 50057
105 name: grpc-port
106{{end}}