| # 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 . }} |
| {{- range $i, $e := until $count }} |
| {{- $core_idx := add $i 1 }} |
| {{- $affinity_group := add1 (mod $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 }} |
| 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: {{ $root.Values.registry }}{{ $root.Values.images.rw_core.repository }}:{{ $tag }} |
| imagePullPolicy: {{ $root.Values.images.rw_core.pullPolicy }} |
| env: |
| - name: NAMESPACE |
| value: {{ quote $root.Release.Namespace }} |
| - name: POD_IP |
| valueFrom: |
| fieldRef: |
| fieldPath: status.podIP |
| - name: ETCD_SERVICE |
| value: {{ quote $root.Values.services.etcd.service }} |
| - name: ETCD_SERVICE_PORT |
| value: {{ quote $root.Values.services.etcd.port }} |
| - name: ADAPTER_KAFKA_SERVICE |
| value: {{ quote $root.Values.services.kafka.adapter.service }} |
| - name: ADAPTER_KAFKA_SERVICE_PORT |
| value: {{ quote $root.Values.services.kafka.adapter.port }} |
| - name: CLUSTER_KAFKA_SERVICE |
| value: {{ quote $root.Values.services.kafka.cluster.service }} |
| - name: CLUSTER_KAFKA_SERVICE_PORT |
| value: {{ quote $root.Values.services.kafka.cluster.port }} |
| args: |
| - "/app/rw_core" |
| - "-kv_store_type=etcd" |
| - "-kv_store_host=$(ETCD_SERVICE)" |
| - "-kv_store_port=$(ETCD_SERVICE_PORT)" |
| - "-grpc_host=$(POD_IP)" |
| - "-grpc_port=50057" |
| - "-banner=true" |
| - "-kafka_adapter_host=$(ADAPTER_KAFKA_SERVICE)" |
| - "-kafka_adapter_port=$(ADAPTER_KAFKA_SERVICE_PORT)" |
| - "-kafka_cluster_host=$(CLUSTER_KAFKA_SERVICE)" |
| - "-kafka_cluster_port=$(CLUSTER_KAFKA_SERVICE_PORT)" |
| - "-rw_core_topic=rwcore" |
| - "-kv_store_data_prefix=service/voltha" |
| - "-in_competing_mode=true" |
| - "-timeout_long_request=8000" |
| - "-timeout_request=6000" |
| - "-log_level=4" |
| ports: |
| - containerPort: 50057 |
| name: grpc-port |
| {{end}} |