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 := . -}} |
David Bainbridge | 5cb5d17 | 2019-07-24 02:30:19 +0000 | [diff] [blame] | 16 | {{- $tag := tpl ( tpl .Values.images.rw_core.tag . ) . }} |
David Bainbridge | cd30e54 | 2019-05-31 20:52:56 +0000 | [diff] [blame] | 17 | {{- $repository := tpl .Values.images.rw_core.repository . }} |
| 18 | {{- $registry := tpl .Values.images.rw_core.registry . }} |
| 19 | {{- $pullpolicy := tpl .Values.images.rw_core.pullPolicy . }} |
| 20 | {{- $core_timeout := tpl $root.Values.rw_core.core_timeout . }} |
| 21 | {{- $long_request_timeout := tpl $root.Values.rw_core.timeout_long_request . }} |
| 22 | {{- $request_timeout := tpl $root.Values.rw_core.timeout_request . }} |
David Bainbridge | 50cb1ef | 2019-07-23 22:36:17 +0000 | [diff] [blame] | 23 | {{- $set_log_level := tpl .Values.rw_core.log_level . | upper }} |
| 24 | {{- $log_level := 3 }} |
| 25 | {{- if eq $set_log_level "DEBUG" }} |
| 26 | {{- $log_level = 0 }} |
| 27 | {{- else if eq $set_log_level "INFO" }} |
| 28 | {{- $log_level = 1 }} |
| 29 | {{- else if eq $set_log_level "WARN" }} |
| 30 | {{- $log_level = 2 }} |
| 31 | {{- else if eq $set_log_level "ERROR" }} |
| 32 | {{- $log_level = 3 }} |
| 33 | {{- else if eq $set_log_level "PANIC" }} |
| 34 | {{- $log_level = 4 }} |
| 35 | {{- else if eq $set_log_level "FATAL" }} |
| 36 | {{- $log_level = 5 }} |
| 37 | {{- else }} |
| 38 | {{- $log_level = 3 }} |
| 39 | {{- end }} |
Kent Hagerman | 1b333b9 | 2019-07-22 16:57:20 -0400 | [diff] [blame] | 40 | {{- range $i, $e := until (int .Values.replicas.rw_core) }} |
| 41 | {{- $cluster := add1 $i }} |
| 42 | {{- range $i, $e := until 2 }} |
| 43 | {{- $cluster_core_id := add1 $i }} |
| 44 | --- |
| 45 | apiVersion: v1 |
| 46 | kind: Service |
| 47 | metadata: |
| 48 | name: voltha-rw-core-{{ $cluster }}{{ $cluster_core_id }} |
| 49 | serviceAccountName: {{ $root.Values.serviceaccount }} |
| 50 | spec: |
| 51 | serviceAccountName: {{ $root.Values.serviceaccount }} |
| 52 | clusterIP: None |
| 53 | ports: |
| 54 | - name: grpc |
| 55 | port: 50057 |
| 56 | targetPort: 50057 |
| 57 | selector: |
| 58 | app: rw-core |
| 59 | affinity-group: {{ quote $cluster }} |
| 60 | affinity-group-core-id: {{ quote $cluster_core_id }} |
| 61 | |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 62 | --- |
| 63 | apiVersion: apps/v1 |
| 64 | kind: Deployment |
| 65 | metadata: |
Kent Hagerman | 1b333b9 | 2019-07-22 16:57:20 -0400 | [diff] [blame] | 66 | name: voltha-rw-core-{{ $cluster }}{{ $cluster_core_id }} |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 67 | serviceAccountName: {{ $root.Values.serviceaccount }} |
David Bainbridge | 534a73d | 2019-08-30 18:57:23 +0000 | [diff] [blame] | 68 | {{- if or (hasKey $root.Values "extra_deployment_labels") (hasKey $root.Values "rw_core_deployment_labels") }} |
| 69 | labels: |
| 70 | {{- if hasKey $root.Values "extra_deployment_labels" }} |
| 71 | {{- range $key, $val := $root.Values.extra_deployment_labels }} |
| 72 | {{ $key }}: {{ $val | quote }} |
| 73 | {{- end }} |
| 74 | {{- end }} |
| 75 | {{- if hasKey $root.Values "rw_core_deployment_labels" }} |
| 76 | {{- range $key, $val := $root.Values.rw_core_deployment_labels }} |
| 77 | {{ $key }}: {{ $val | quote }} |
| 78 | {{- end }} |
| 79 | {{- end }} |
| 80 | {{- end }} |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 81 | spec: |
| 82 | replicas: 1 |
| 83 | selector: |
| 84 | matchLabels: |
| 85 | app: rw-core |
Kent Hagerman | 1b333b9 | 2019-07-22 16:57:20 -0400 | [diff] [blame] | 86 | affinity-group: {{ quote $cluster }} |
| 87 | affinity-group-core-id: {{ quote $cluster_core_id }} |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 88 | template: |
| 89 | metadata: |
| 90 | labels: |
| 91 | app: rw-core |
Kent Hagerman | 1b333b9 | 2019-07-22 16:57:20 -0400 | [diff] [blame] | 92 | affinity-group: {{ quote $cluster }} |
| 93 | affinity-group-core-id: {{ quote $cluster_core_id }} |
David Bainbridge | 1f88804 | 2019-06-24 18:02:01 +0000 | [diff] [blame] | 94 | app.kubernetes.io/name: "read-write-core" |
| 95 | app.kubernetes.io/version: {{ quote $root.Chart.AppVersion }} |
| 96 | app.kubernetes.io/component: "core" |
| 97 | app.kubernetes.io/part-of: "voltha" |
| 98 | app.kubernetes.io/managed-by: {{ quote $root.Release.Service }} |
| 99 | helm.sh/chart: "{{ $root.Chart.Name }}-{{ $root.Chart.Version }}" |
David Bainbridge | 534a73d | 2019-08-30 18:57:23 +0000 | [diff] [blame] | 100 | {{- if hasKey $root.Values "extra_pod_labels" }} |
| 101 | {{- range $key, $val := $root.Values.extra_pod_labels }} |
| 102 | {{ $key }}: {{ $val | quote }} |
| 103 | {{- end }} |
| 104 | {{- end }} |
| 105 | {{- if hasKey $root.Values "rw_core_pod_labels" }} |
| 106 | {{- range $key, $val := $root.Values.rw_core_pod_labels }} |
| 107 | {{ $key }}: {{ $val | quote }} |
| 108 | {{- end }} |
| 109 | {{- end }} |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 110 | annotations: |
| 111 | cni: "calico" |
| 112 | spec: |
| 113 | affinity: |
| 114 | podAntiAffinity: |
Kent Hagerman | 1b333b9 | 2019-07-22 16:57:20 -0400 | [diff] [blame] | 115 | requiredDuringSchedulingIgnoredDuringExecution: |
| 116 | - topologyKey: "kubernetes.io/hostname" |
David Bainbridge | 53af8ba | 2019-05-24 14:41:34 +0000 | [diff] [blame] | 117 | labelSelector: |
| 118 | matchExpressions: |
| 119 | - key: app |
| 120 | operator: In |
| 121 | values: |
Kent Hagerman | 1b333b9 | 2019-07-22 16:57:20 -0400 | [diff] [blame] | 122 | - rw-core |
| 123 | - key: affinity-group |
| 124 | operator: In |
| 125 | values: |
| 126 | - {{ quote $cluster }} |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 127 | serviceAccountName: {{ $root.Values.serviceaccount }} |
| 128 | containers: |
| 129 | - name: voltha |
David Bainbridge | cd30e54 | 2019-05-31 20:52:56 +0000 | [diff] [blame] | 130 | image: {{ $registry }}{{ $repository }}:{{ $tag }} |
| 131 | imagePullPolicy: {{ $pullpolicy }} |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 132 | env: |
| 133 | - name: NAMESPACE |
| 134 | value: {{ quote $root.Release.Namespace }} |
| 135 | - name: POD_IP |
| 136 | valueFrom: |
| 137 | fieldRef: |
| 138 | fieldPath: status.podIP |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 139 | args: |
| 140 | - "/app/rw_core" |
| 141 | - "-kv_store_type=etcd" |
David Bainbridge | cd30e54 | 2019-05-31 20:52:56 +0000 | [diff] [blame] | 142 | - "-kv_store_host={{ $root.Values.services.etcd.service }}" |
| 143 | - "-kv_store_port={{ $root.Values.services.etcd.port }}" |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 144 | - "-grpc_host=$(POD_IP)" |
| 145 | - "-grpc_port=50057" |
| 146 | - "-banner=true" |
David Bainbridge | cd30e54 | 2019-05-31 20:52:56 +0000 | [diff] [blame] | 147 | - "-kafka_adapter_host={{ $root.Values.services.kafka.adapter.service }}" |
| 148 | - "-kafka_adapter_port={{ $root.Values.services.kafka.adapter.port }}" |
| 149 | - "-kafka_cluster_host={{ $root.Values.services.kafka.cluster.port }}" |
| 150 | - "-kafka_cluster_port={{ $root.Values.services.kafka.cluster.port }}" |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 151 | - "-rw_core_topic=rwcore" |
Kent Hagerman | b778da8 | 2019-07-30 15:14:20 -0400 | [diff] [blame] | 152 | - "-core_pair_topic=core-pair-{{ $cluster }}" |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 153 | - "-kv_store_data_prefix=service/voltha" |
| 154 | - "-in_competing_mode=true" |
David Bainbridge | cd30e54 | 2019-05-31 20:52:56 +0000 | [diff] [blame] | 155 | - "-core_timeout={{ $core_timeout }}" |
| 156 | - "-timeout_long_request={{ $long_request_timeout }}" |
| 157 | - "-timeout_request={{ $request_timeout }}" |
David Bainbridge | 50cb1ef | 2019-07-23 22:36:17 +0000 | [diff] [blame] | 158 | - "-log_level={{ $log_level }}" |
David Bainbridge | c349f64 | 2019-09-24 19:20:47 +0000 | [diff] [blame] | 159 | - "-probe_port=8080" |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 160 | ports: |
| 161 | - containerPort: 50057 |
| 162 | name: grpc-port |
David Bainbridge | c349f64 | 2019-09-24 19:20:47 +0000 | [diff] [blame] | 163 | livenessProbe: |
| 164 | httpGet: |
| 165 | path: /healthz |
| 166 | port: 8080 |
| 167 | initialDelaySeconds: 3 |
| 168 | periodSeconds: 3 |
| 169 | readinessProbe: |
| 170 | httpGet: |
| 171 | path: /readz |
| 172 | port: 8080 |
| 173 | initialDelaySeconds: 3 |
| 174 | periodSeconds: 3 |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 175 | {{end}} |
Kent Hagerman | 1b333b9 | 2019-07-22 16:57:20 -0400 | [diff] [blame] | 176 | {{end}} |