blob: 7945d576c903e5e2cce84d55ae307a2055b67ee9 [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 }}
David Bainbridge53af8ba2019-05-24 14:41:34 +000026{{- $affinity_group := add1 (mod $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 Bainbridge2f9b76f2019-05-15 13:48:11 -070043 annotations:
44 cni: "calico"
45 spec:
46 affinity:
47 podAntiAffinity:
David Bainbridge53af8ba2019-05-24 14:41:34 +000048 preferredDuringSchedulingIgnoredDuringExecution:
49 - weight: 100
50 podAffinityTerm:
51 labelSelector:
52 matchExpressions:
53 - key: app
54 operator: In
55 values:
56 - rw-core
57 topologyKey: "kubernetes.io/hostname"
David Bainbridge2f9b76f2019-05-15 13:48:11 -070058 requiredDuringSchedulingIgnoredDuringExecution:
59 - labelSelector:
60 matchExpressions:
David Bainbridge53af8ba2019-05-24 14:41:34 +000061 - key: affinity-group
David Bainbridge2f9b76f2019-05-15 13:48:11 -070062 operator: In
63 values:
David Bainbridge53af8ba2019-05-24 14:41:34 +000064 - affinity-group-{{ $affinity_group }}
David Bainbridge2f9b76f2019-05-15 13:48:11 -070065 topologyKey: "kubernetes.io/hostname"
66 serviceAccountName: {{ $root.Values.serviceaccount }}
67 containers:
68 - name: voltha
David Bainbridgecd30e542019-05-31 20:52:56 +000069 image: {{ $registry }}{{ $repository }}:{{ $tag }}
70 imagePullPolicy: {{ $pullpolicy }}
David Bainbridge2f9b76f2019-05-15 13:48:11 -070071 env:
72 - name: NAMESPACE
73 value: {{ quote $root.Release.Namespace }}
74 - name: POD_IP
75 valueFrom:
76 fieldRef:
77 fieldPath: status.podIP
David Bainbridge2f9b76f2019-05-15 13:48:11 -070078 args:
79 - "/app/rw_core"
80 - "-kv_store_type=etcd"
David Bainbridgecd30e542019-05-31 20:52:56 +000081 - "-kv_store_host={{ $root.Values.services.etcd.service }}"
82 - "-kv_store_port={{ $root.Values.services.etcd.port }}"
David Bainbridge2f9b76f2019-05-15 13:48:11 -070083 - "-grpc_host=$(POD_IP)"
84 - "-grpc_port=50057"
85 - "-banner=true"
David Bainbridgecd30e542019-05-31 20:52:56 +000086 - "-kafka_adapter_host={{ $root.Values.services.kafka.adapter.service }}"
87 - "-kafka_adapter_port={{ $root.Values.services.kafka.adapter.port }}"
88 - "-kafka_cluster_host={{ $root.Values.services.kafka.cluster.port }}"
89 - "-kafka_cluster_port={{ $root.Values.services.kafka.cluster.port }}"
David Bainbridge2f9b76f2019-05-15 13:48:11 -070090 - "-rw_core_topic=rwcore"
91 - "-kv_store_data_prefix=service/voltha"
92 - "-in_competing_mode=true"
David Bainbridgecd30e542019-05-31 20:52:56 +000093 - "-core_timeout={{ $core_timeout }}"
94 - "-timeout_long_request={{ $long_request_timeout }}"
95 - "-timeout_request={{ $request_timeout }}"
96 - "-log_level=2"
David Bainbridge2f9b76f2019-05-15 13:48:11 -070097 ports:
98 - containerPort: 50057
99 name: grpc-port
100{{end}}