blob: 5be011db294d8c5cbe5f9427e4da30b429f08204 [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 }}
David Bainbridge53af8ba2019-05-24 14:41:34 +000020{{- $affinity_group := add1 (mod $i 2) }}
David Bainbridge2f9b76f2019-05-15 13:48:11 -070021---
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
David Bainbridge53af8ba2019-05-24 14:41:34 +000036 affinity-group: affinity-group-{{ $affinity_group }}
David Bainbridge2f9b76f2019-05-15 13:48:11 -070037 annotations:
38 cni: "calico"
39 spec:
40 affinity:
41 podAntiAffinity:
David Bainbridge53af8ba2019-05-24 14:41:34 +000042 preferredDuringSchedulingIgnoredDuringExecution:
43 - weight: 100
44 podAffinityTerm:
45 labelSelector:
46 matchExpressions:
47 - key: app
48 operator: In
49 values:
50 - rw-core
51 topologyKey: "kubernetes.io/hostname"
David Bainbridge2f9b76f2019-05-15 13:48:11 -070052 requiredDuringSchedulingIgnoredDuringExecution:
53 - labelSelector:
54 matchExpressions:
David Bainbridge53af8ba2019-05-24 14:41:34 +000055 - key: affinity-group
David Bainbridge2f9b76f2019-05-15 13:48:11 -070056 operator: In
57 values:
David Bainbridge53af8ba2019-05-24 14:41:34 +000058 - affinity-group-{{ $affinity_group }}
David Bainbridge2f9b76f2019-05-15 13:48:11 -070059 topologyKey: "kubernetes.io/hostname"
60 serviceAccountName: {{ $root.Values.serviceaccount }}
61 containers:
62 - name: voltha
63 image: {{ $root.Values.registry }}{{ $root.Values.images.rw_core.repository }}:{{ $tag }}
64 imagePullPolicy: {{ $root.Values.images.rw_core.pullPolicy }}
65 env:
66 - name: NAMESPACE
67 value: {{ quote $root.Release.Namespace }}
68 - name: POD_IP
69 valueFrom:
70 fieldRef:
71 fieldPath: status.podIP
72 - name: ETCD_SERVICE
73 value: {{ quote $root.Values.services.etcd.service }}
74 - name: ETCD_SERVICE_PORT
75 value: {{ quote $root.Values.services.etcd.port }}
76 - name: ADAPTER_KAFKA_SERVICE
77 value: {{ quote $root.Values.services.kafka.adapter.service }}
78 - name: ADAPTER_KAFKA_SERVICE_PORT
79 value: {{ quote $root.Values.services.kafka.adapter.port }}
80 - name: CLUSTER_KAFKA_SERVICE
81 value: {{ quote $root.Values.services.kafka.cluster.service }}
82 - name: CLUSTER_KAFKA_SERVICE_PORT
83 value: {{ quote $root.Values.services.kafka.cluster.port }}
84 args:
85 - "/app/rw_core"
86 - "-kv_store_type=etcd"
87 - "-kv_store_host=$(ETCD_SERVICE)"
88 - "-kv_store_port=$(ETCD_SERVICE_PORT)"
89 - "-grpc_host=$(POD_IP)"
90 - "-grpc_port=50057"
91 - "-banner=true"
92 - "-kafka_adapter_host=$(ADAPTER_KAFKA_SERVICE)"
93 - "-kafka_adapter_port=$(ADAPTER_KAFKA_SERVICE_PORT)"
94 - "-kafka_cluster_host=$(CLUSTER_KAFKA_SERVICE)"
95 - "-kafka_cluster_port=$(CLUSTER_KAFKA_SERVICE_PORT)"
96 - "-rw_core_topic=rwcore"
97 - "-kv_store_data_prefix=service/voltha"
98 - "-in_competing_mode=true"
99 - "-timeout_long_request=8000"
100 - "-timeout_request=6000"
101 - "-log_level=4"
102 ports:
103 - containerPort: 50057
104 name: grpc-port
105{{end}}