| # 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 := . -}} |
| {{- $tag := tpl ( 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 . }} |
| {{- $set_log_level := tpl .Values.rw_core.log_level . | upper }} |
| {{- $log_level := 3 }} |
| {{- if eq $set_log_level "DEBUG" }} |
| {{- $log_level = 0 }} |
| {{- else if eq $set_log_level "INFO" }} |
| {{- $log_level = 1 }} |
| {{- else if eq $set_log_level "WARN" }} |
| {{- $log_level = 2 }} |
| {{- else if eq $set_log_level "ERROR" }} |
| {{- $log_level = 3 }} |
| {{- else if eq $set_log_level "PANIC" }} |
| {{- $log_level = 4 }} |
| {{- else if eq $set_log_level "FATAL" }} |
| {{- $log_level = 5 }} |
| {{- else }} |
| {{- $log_level = 3 }} |
| {{- end }} |
| {{- range $i, $e := until (int .Values.replicas.rw_core) }} |
| {{- $cluster := add1 $i }} |
| {{- range $i, $e := until 2 }} |
| {{- $cluster_core_id := add1 $i }} |
| --- |
| apiVersion: v1 |
| kind: Service |
| metadata: |
| name: voltha-rw-core-{{ $cluster }}{{ $cluster_core_id }} |
| serviceAccountName: {{ $root.Values.serviceaccount }} |
| spec: |
| serviceAccountName: {{ $root.Values.serviceaccount }} |
| clusterIP: None |
| ports: |
| - name: grpc |
| port: 50057 |
| targetPort: 50057 |
| selector: |
| app: rw-core |
| affinity-group: {{ quote $cluster }} |
| affinity-group-core-id: {{ quote $cluster_core_id }} |
| |
| --- |
| apiVersion: apps/v1 |
| kind: Deployment |
| metadata: |
| name: voltha-rw-core-{{ $cluster }}{{ $cluster_core_id }} |
| serviceAccountName: {{ $root.Values.serviceaccount }} |
| {{- if or (hasKey $root.Values "extra_deployment_labels") (hasKey $root.Values "rw_core_deployment_labels") }} |
| labels: |
| {{- if hasKey $root.Values "extra_deployment_labels" }} |
| {{- range $key, $val := $root.Values.extra_deployment_labels }} |
| {{ $key }}: {{ $val | quote }} |
| {{- end }} |
| {{- end }} |
| {{- if hasKey $root.Values "rw_core_deployment_labels" }} |
| {{- range $key, $val := $root.Values.rw_core_deployment_labels }} |
| {{ $key }}: {{ $val | quote }} |
| {{- end }} |
| {{- end }} |
| {{- end }} |
| spec: |
| replicas: 1 |
| selector: |
| matchLabels: |
| app: rw-core |
| affinity-group: {{ quote $cluster }} |
| affinity-group-core-id: {{ quote $cluster_core_id }} |
| template: |
| metadata: |
| labels: |
| app: rw-core |
| affinity-group: {{ quote $cluster }} |
| affinity-group-core-id: {{ quote $cluster_core_id }} |
| 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 }}" |
| {{- if hasKey $root.Values "extra_pod_labels" }} |
| {{- range $key, $val := $root.Values.extra_pod_labels }} |
| {{ $key }}: {{ $val | quote }} |
| {{- end }} |
| {{- end }} |
| {{- if hasKey $root.Values "rw_core_pod_labels" }} |
| {{- range $key, $val := $root.Values.rw_core_pod_labels }} |
| {{ $key }}: {{ $val | quote }} |
| {{- end }} |
| {{- end }} |
| annotations: |
| cni: "calico" |
| spec: |
| affinity: |
| podAntiAffinity: |
| requiredDuringSchedulingIgnoredDuringExecution: |
| - topologyKey: "kubernetes.io/hostname" |
| labelSelector: |
| matchExpressions: |
| - key: app |
| operator: In |
| values: |
| - rw-core |
| - key: affinity-group |
| operator: In |
| values: |
| - {{ quote $cluster }} |
| 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" |
| - "-core_pair_topic=core-pair-{{ $cluster }}" |
| - "-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={{ $log_level }}" |
| - "-probe_port=8080" |
| ports: |
| - containerPort: 50057 |
| name: grpc-port |
| livenessProbe: |
| httpGet: |
| path: /healthz |
| port: 8080 |
| initialDelaySeconds: 3 |
| periodSeconds: 3 |
| readinessProbe: |
| httpGet: |
| path: /readz |
| port: 8080 |
| initialDelaySeconds: 3 |
| periodSeconds: 3 |
| {{end}} |
| {{end}} |