| # Copyright 2019-present Open Networking Foundation |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| {{- $root := . -}} |
| {{- $count := mul .Values.replicas.rw_core 2 | int }} |
| {{- $tag := tpl .Values.images.rw_core.tag . }} |
| {{- $repository := tpl .Values.images.rw_core.repository . }} |
| {{- $registry := tpl .Values.images.rw_core.registry . }} |
| {{- $pullpolicy := tpl .Values.images.rw_core.pullPolicy . }} |
| {{- $core_timeout := tpl $root.Values.rw_core.core_timeout . }} |
| {{- $long_request_timeout := tpl $root.Values.rw_core.timeout_long_request . }} |
| {{- $request_timeout := tpl $root.Values.rw_core.timeout_request . }} |
| {{- range $i, $e := until $count }} |
| {{- $core_idx := add $i 1 }} |
| {{- $affinity_group := add1 (div $i 2) }} |
| --- |
| apiVersion: apps/v1 |
| kind: Deployment |
| metadata: |
| name: rw-core{{ $core_idx }} |
| serviceAccountName: {{ $root.Values.serviceaccount }} |
| spec: |
| replicas: 1 |
| selector: |
| matchLabels: |
| app: rw-core |
| template: |
| metadata: |
| labels: |
| app: rw-core |
| affinity-group: affinity-group-{{ $affinity_group }} |
| app.kubernetes.io/name: "read-write-core" |
| app.kubernetes.io/version: {{ quote $root.Chart.AppVersion }} |
| app.kubernetes.io/component: "core" |
| app.kubernetes.io/part-of: "voltha" |
| app.kubernetes.io/managed-by: {{ quote $root.Release.Service }} |
| helm.sh/chart: "{{ $root.Chart.Name }}-{{ $root.Chart.Version }}" |
| annotations: |
| cni: "calico" |
| spec: |
| affinity: |
| podAntiAffinity: |
| preferredDuringSchedulingIgnoredDuringExecution: |
| - weight: 100 |
| podAffinityTerm: |
| labelSelector: |
| matchExpressions: |
| - key: app |
| operator: In |
| values: |
| - rw-core |
| topologyKey: "kubernetes.io/hostname" |
| requiredDuringSchedulingIgnoredDuringExecution: |
| - labelSelector: |
| matchExpressions: |
| - key: affinity-group |
| operator: In |
| values: |
| - affinity-group-{{ $affinity_group }} |
| topologyKey: "kubernetes.io/hostname" |
| serviceAccountName: {{ $root.Values.serviceaccount }} |
| containers: |
| - name: voltha |
| image: {{ $registry }}{{ $repository }}:{{ $tag }} |
| imagePullPolicy: {{ $pullpolicy }} |
| env: |
| - name: NAMESPACE |
| value: {{ quote $root.Release.Namespace }} |
| - name: POD_IP |
| valueFrom: |
| fieldRef: |
| fieldPath: status.podIP |
| args: |
| - "/app/rw_core" |
| - "-kv_store_type=etcd" |
| - "-kv_store_host={{ $root.Values.services.etcd.service }}" |
| - "-kv_store_port={{ $root.Values.services.etcd.port }}" |
| - "-grpc_host=$(POD_IP)" |
| - "-grpc_port=50057" |
| - "-banner=true" |
| - "-kafka_adapter_host={{ $root.Values.services.kafka.adapter.service }}" |
| - "-kafka_adapter_port={{ $root.Values.services.kafka.adapter.port }}" |
| - "-kafka_cluster_host={{ $root.Values.services.kafka.cluster.port }}" |
| - "-kafka_cluster_port={{ $root.Values.services.kafka.cluster.port }}" |
| - "-rw_core_topic=rwcore" |
| - "-kv_store_data_prefix=service/voltha" |
| - "-in_competing_mode=true" |
| - "-core_timeout={{ $core_timeout }}" |
| - "-timeout_long_request={{ $long_request_timeout }}" |
| - "-timeout_request={{ $request_timeout }}" |
| - "-log_level=2" |
| ports: |
| - containerPort: 50057 |
| name: grpc-port |
| {{end}} |