blob: 4dd0e0661a879084555cc552fc72ca7d6135c7dd [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 . }}
18{{- range $i, $e := until $count }}
19{{- $core_idx := add $i 1 }}
20{{- $pair_idx := div $i 2 | int }}
21---
22apiVersion: apps/v1
23kind: Deployment
24metadata:
25 name: rw-core{{ $core_idx }}
26 serviceAccountName: {{ $root.Values.serviceaccount }}
27spec:
28 replicas: 1
29 selector:
30 matchLabels:
31 app: rw-core
32 template:
33 metadata:
34 labels:
35 app: rw-core
36 affinity-index: anti-affinity-{{ $pair_idx }}
37 annotations:
38 cni: "calico"
39 spec:
40 affinity:
41 podAntiAffinity:
42 requiredDuringSchedulingIgnoredDuringExecution:
43 - labelSelector:
44 matchExpressions:
45 - key: affinity-index
46 operator: In
47 values:
48 - anti-affinity-{{ $pair_idx }}
49 topologyKey: "kubernetes.io/hostname"
50 serviceAccountName: {{ $root.Values.serviceaccount }}
51 containers:
52 - name: voltha
53 image: {{ $root.Values.registry }}{{ $root.Values.images.rw_core.repository }}:{{ $tag }}
54 imagePullPolicy: {{ $root.Values.images.rw_core.pullPolicy }}
55 env:
56 - name: NAMESPACE
57 value: {{ quote $root.Release.Namespace }}
58 - name: POD_IP
59 valueFrom:
60 fieldRef:
61 fieldPath: status.podIP
62 - name: ETCD_SERVICE
63 value: {{ quote $root.Values.services.etcd.service }}
64 - name: ETCD_SERVICE_PORT
65 value: {{ quote $root.Values.services.etcd.port }}
66 - name: ADAPTER_KAFKA_SERVICE
67 value: {{ quote $root.Values.services.kafka.adapter.service }}
68 - name: ADAPTER_KAFKA_SERVICE_PORT
69 value: {{ quote $root.Values.services.kafka.adapter.port }}
70 - name: CLUSTER_KAFKA_SERVICE
71 value: {{ quote $root.Values.services.kafka.cluster.service }}
72 - name: CLUSTER_KAFKA_SERVICE_PORT
73 value: {{ quote $root.Values.services.kafka.cluster.port }}
74 args:
75 - "/app/rw_core"
76 - "-kv_store_type=etcd"
77 - "-kv_store_host=$(ETCD_SERVICE)"
78 - "-kv_store_port=$(ETCD_SERVICE_PORT)"
79 - "-grpc_host=$(POD_IP)"
80 - "-grpc_port=50057"
81 - "-banner=true"
82 - "-kafka_adapter_host=$(ADAPTER_KAFKA_SERVICE)"
83 - "-kafka_adapter_port=$(ADAPTER_KAFKA_SERVICE_PORT)"
84 - "-kafka_cluster_host=$(CLUSTER_KAFKA_SERVICE)"
85 - "-kafka_cluster_port=$(CLUSTER_KAFKA_SERVICE_PORT)"
86 - "-rw_core_topic=rwcore"
87 - "-kv_store_data_prefix=service/voltha"
88 - "-in_competing_mode=true"
89 - "-timeout_long_request=8000"
90 - "-timeout_request=6000"
91 - "-log_level=4"
92 ports:
93 - containerPort: 50057
94 name: grpc-port
95{{end}}