David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 1 | # 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 Bainbridge | cd30e54 | 2019-05-31 20:52:56 +0000 | [diff] [blame] | 18 | {{- $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 Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 24 | {{- range $i, $e := until $count }} |
| 25 | {{- $core_idx := add $i 1 }} |
Kent Hagerman | c51b4e7 | 2019-06-19 12:40:16 -0400 | [diff] [blame^] | 26 | {{- $affinity_group := add1 (div $i 2) }} |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 27 | --- |
| 28 | apiVersion: apps/v1 |
| 29 | kind: Deployment |
| 30 | metadata: |
| 31 | name: rw-core{{ $core_idx }} |
| 32 | serviceAccountName: {{ $root.Values.serviceaccount }} |
| 33 | spec: |
| 34 | replicas: 1 |
| 35 | selector: |
| 36 | matchLabels: |
| 37 | app: rw-core |
| 38 | template: |
| 39 | metadata: |
| 40 | labels: |
| 41 | app: rw-core |
David Bainbridge | 53af8ba | 2019-05-24 14:41:34 +0000 | [diff] [blame] | 42 | affinity-group: affinity-group-{{ $affinity_group }} |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 43 | annotations: |
| 44 | cni: "calico" |
| 45 | spec: |
| 46 | affinity: |
| 47 | podAntiAffinity: |
David Bainbridge | 53af8ba | 2019-05-24 14:41:34 +0000 | [diff] [blame] | 48 | 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 Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 58 | requiredDuringSchedulingIgnoredDuringExecution: |
| 59 | - labelSelector: |
| 60 | matchExpressions: |
David Bainbridge | 53af8ba | 2019-05-24 14:41:34 +0000 | [diff] [blame] | 61 | - key: affinity-group |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 62 | operator: In |
| 63 | values: |
David Bainbridge | 53af8ba | 2019-05-24 14:41:34 +0000 | [diff] [blame] | 64 | - affinity-group-{{ $affinity_group }} |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 65 | topologyKey: "kubernetes.io/hostname" |
| 66 | serviceAccountName: {{ $root.Values.serviceaccount }} |
| 67 | containers: |
| 68 | - name: voltha |
David Bainbridge | cd30e54 | 2019-05-31 20:52:56 +0000 | [diff] [blame] | 69 | image: {{ $registry }}{{ $repository }}:{{ $tag }} |
| 70 | imagePullPolicy: {{ $pullpolicy }} |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 71 | env: |
| 72 | - name: NAMESPACE |
| 73 | value: {{ quote $root.Release.Namespace }} |
| 74 | - name: POD_IP |
| 75 | valueFrom: |
| 76 | fieldRef: |
| 77 | fieldPath: status.podIP |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 78 | args: |
| 79 | - "/app/rw_core" |
| 80 | - "-kv_store_type=etcd" |
David Bainbridge | cd30e54 | 2019-05-31 20:52:56 +0000 | [diff] [blame] | 81 | - "-kv_store_host={{ $root.Values.services.etcd.service }}" |
| 82 | - "-kv_store_port={{ $root.Values.services.etcd.port }}" |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 83 | - "-grpc_host=$(POD_IP)" |
| 84 | - "-grpc_port=50057" |
| 85 | - "-banner=true" |
David Bainbridge | cd30e54 | 2019-05-31 20:52:56 +0000 | [diff] [blame] | 86 | - "-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 Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 90 | - "-rw_core_topic=rwcore" |
| 91 | - "-kv_store_data_prefix=service/voltha" |
| 92 | - "-in_competing_mode=true" |
David Bainbridge | cd30e54 | 2019-05-31 20:52:56 +0000 | [diff] [blame] | 93 | - "-core_timeout={{ $core_timeout }}" |
| 94 | - "-timeout_long_request={{ $long_request_timeout }}" |
| 95 | - "-timeout_request={{ $request_timeout }}" |
| 96 | - "-log_level=2" |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 97 | ports: |
| 98 | - containerPort: 50057 |
| 99 | name: grpc-port |
| 100 | {{end}} |