Joey Armstrong | 0747509 | 2023-01-26 10:56:13 -0500 | [diff] [blame] | 1 | # Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 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. |
Rohan Agrawal | 250ec82 | 2020-01-14 12:16:18 +0000 | [diff] [blame] | 14 | {{- $log_level := tpl .Values.rw_core.log_level . | upper }} |
Kent Hagerman | 1b333b9 | 2019-07-22 16:57:20 -0400 | [diff] [blame] | 15 | --- |
David Bainbridge | c437c3e | 2020-06-25 14:48:24 -0700 | [diff] [blame] | 16 | apiVersion: apps/v1 |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 17 | kind: Deployment |
| 18 | metadata: |
David Bainbridge | 2bdd430 | 2020-06-09 17:13:18 -0700 | [diff] [blame] | 19 | name: "{{ template "fullname" . }}-rw-core" |
David Bainbridge | 8595b3b | 2020-06-05 12:23:05 -0700 | [diff] [blame] | 20 | namespace: {{ .Release.Namespace }} |
Scott Baker | 5b2eaa8 | 2019-12-17 11:24:00 -0800 | [diff] [blame] | 21 | {{- if or (hasKey .Values "extra_deployment_labels") (hasKey .Values "rw_core_deployment_labels") }} |
David Bainbridge | 534a73d | 2019-08-30 18:57:23 +0000 | [diff] [blame] | 22 | labels: |
Scott Baker | 5b2eaa8 | 2019-12-17 11:24:00 -0800 | [diff] [blame] | 23 | {{- if hasKey .Values "extra_deployment_labels" }} |
| 24 | {{- range $key, $val := .Values.extra_deployment_labels }} |
David Bainbridge | 534a73d | 2019-08-30 18:57:23 +0000 | [diff] [blame] | 25 | {{ $key }}: {{ $val | quote }} |
| 26 | {{- end }} |
| 27 | {{- end }} |
Scott Baker | 5b2eaa8 | 2019-12-17 11:24:00 -0800 | [diff] [blame] | 28 | {{- if hasKey .Values "rw_core_deployment_labels" }} |
| 29 | {{- range $key, $val := .Values.rw_core_deployment_labels }} |
David Bainbridge | 534a73d | 2019-08-30 18:57:23 +0000 | [diff] [blame] | 30 | {{ $key }}: {{ $val | quote }} |
| 31 | {{- end }} |
| 32 | {{- end }} |
| 33 | {{- end }} |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 34 | spec: |
| 35 | replicas: 1 |
David Bainbridge | 8595b3b | 2020-06-05 12:23:05 -0700 | [diff] [blame] | 36 | selector: |
| 37 | matchLabels: |
| 38 | app: rw-core |
| 39 | release: {{ .Release.Name }} |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 40 | template: |
| 41 | metadata: |
David Bainbridge | 8595b3b | 2020-06-05 12:23:05 -0700 | [diff] [blame] | 42 | namespace: {{ .Release.Namespace }} |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 43 | labels: |
| 44 | app: rw-core |
David Bainbridge | 8595b3b | 2020-06-05 12:23:05 -0700 | [diff] [blame] | 45 | release: {{ .Release.Name }} |
David Bainbridge | 1f88804 | 2019-06-24 18:02:01 +0000 | [diff] [blame] | 46 | app.kubernetes.io/name: "read-write-core" |
Scott Baker | 5b2eaa8 | 2019-12-17 11:24:00 -0800 | [diff] [blame] | 47 | app.kubernetes.io/version: {{ quote .Chart.AppVersion }} |
David Bainbridge | 1f88804 | 2019-06-24 18:02:01 +0000 | [diff] [blame] | 48 | app.kubernetes.io/component: "core" |
| 49 | app.kubernetes.io/part-of: "voltha" |
Matteo Scandolo | b4c5f4e | 2020-11-11 12:05:23 -0800 | [diff] [blame] | 50 | app.kubernetes.io/stack: "{{ .Values.global.stack_name }}" |
Scott Baker | 5b2eaa8 | 2019-12-17 11:24:00 -0800 | [diff] [blame] | 51 | app.kubernetes.io/managed-by: {{ quote .Release.Service }} |
| 52 | helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" |
| 53 | {{- if hasKey .Values "extra_pod_labels" }} |
| 54 | {{- range $key, $val := .Values.extra_pod_labels }} |
David Bainbridge | 534a73d | 2019-08-30 18:57:23 +0000 | [diff] [blame] | 55 | {{ $key }}: {{ $val | quote }} |
| 56 | {{- end }} |
| 57 | {{- end }} |
Scott Baker | 5b2eaa8 | 2019-12-17 11:24:00 -0800 | [diff] [blame] | 58 | {{- if hasKey .Values "rw_core_pod_labels" }} |
| 59 | {{- range $key, $val := .Values.rw_core_pod_labels }} |
David Bainbridge | 534a73d | 2019-08-30 18:57:23 +0000 | [diff] [blame] | 60 | {{ $key }}: {{ $val | quote }} |
| 61 | {{- end }} |
| 62 | {{- end }} |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 63 | spec: |
David Bainbridge | 16b19cc | 2020-05-29 11:50:44 -0700 | [diff] [blame] | 64 | {{- if .Values.securityContext.enabled }} |
| 65 | securityContext: |
| 66 | runAsUser: {{ .Values.securityContext.runAsUser }} |
| 67 | runAsGroup: {{ .Values.securityContext.runAsGroup }} |
| 68 | fsGroup: {{ .Values.securityContext.fsGroup }} |
| 69 | {{- end }} |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 70 | containers: |
| 71 | - name: voltha |
Scott Baker | 5b2eaa8 | 2019-12-17 11:24:00 -0800 | [diff] [blame] | 72 | image: '{{ tpl .Values.images.rw_core.registry . }}{{ tpl .Values.images.rw_core.repository . }}:{{ tpl .Values.images.rw_core.tag . }}' |
| 73 | imagePullPolicy: {{ tpl .Values.images.rw_core.pullPolicy . }} |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 74 | env: |
| 75 | - name: NAMESPACE |
Scott Baker | 5b2eaa8 | 2019-12-17 11:24:00 -0800 | [diff] [blame] | 76 | value: voltha |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 77 | - name: POD_IP |
| 78 | valueFrom: |
| 79 | fieldRef: |
| 80 | fieldPath: status.podIP |
divyadesai | 5085aba | 2020-03-02 07:03:53 +0000 | [diff] [blame] | 81 | - name: COMPONENT_NAME |
| 82 | valueFrom: |
| 83 | fieldRef: |
| 84 | fieldPath: metadata.labels['app.kubernetes.io/name'] |
serkant.uluderya | f1b8cc7 | 2020-05-13 23:26:51 -0700 | [diff] [blame] | 85 | - name: KV_STORE_DATAPATH_PREFIX |
Matteo Scandolo | b4c5f4e | 2020-11-11 12:05:23 -0800 | [diff] [blame] | 86 | value: {{ tpl .Values.rw_core.kv_store_data_prefix . }} |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 87 | args: |
| 88 | - "/app/rw_core" |
David K. Bainbridge | f7d4e60 | 2020-07-09 18:28:55 +0000 | [diff] [blame] | 89 | - "--kv_store_type=etcd" |
Matteo Scandolo | b4c5f4e | 2020-11-11 12:05:23 -0800 | [diff] [blame] | 90 | - "--kv_store_address={{ tpl .Values.services.etcd.address . }}" |
khenaidoo | 15c53fb | 2021-08-09 13:56:27 -0400 | [diff] [blame] | 91 | - "--grpc_nbi_address=0.0.0.0:50057" |
| 92 | - "--grpc_sbi_address=0.0.0.0:50058" |
David K. Bainbridge | f7d4e60 | 2020-07-09 18:28:55 +0000 | [diff] [blame] | 93 | - "--banner" |
Matteo Scandolo | b4c5f4e | 2020-11-11 12:05:23 -0800 | [diff] [blame] | 94 | - "--kafka_cluster_address={{ tpl .Values.services.kafka.cluster.address . }}" |
khenaidoo | 15c53fb | 2021-08-09 13:56:27 -0400 | [diff] [blame] | 95 | - "--rpc_timeout={{ tpl .Values.rw_core.rpc_timeout . }}" |
Himani Chawla | 81472cd | 2021-11-08 17:14:11 +0530 | [diff] [blame] | 96 | - "--flow_timeout={{ tpl .Values.rw_core.flow_timeout . }}" |
khenaidoo | 15c53fb | 2021-08-09 13:56:27 -0400 | [diff] [blame] | 97 | - "--internal_timeout={{ tpl .Values.rw_core.internal_timeout . }}" |
Matteo Scandolo | 06ee58c | 2021-05-26 15:28:51 -0700 | [diff] [blame] | 98 | - "--event_topic={{ .Values.rw_core.topics.event_topic }}" |
David K. Bainbridge | f7d4e60 | 2020-07-09 18:28:55 +0000 | [diff] [blame] | 99 | - "--log_level={{ $log_level }}" |
| 100 | - "--probe_address=:8080" |
Matteo Scandolo | b4c5f4e | 2020-11-11 12:05:23 -0800 | [diff] [blame] | 101 | - "--trace_enabled={{ .Values.global.tracing.enabled }}" |
| 102 | - "--trace_agent_address={{ tpl .Values.services.tracing_agent.address . }}" |
| 103 | - "--log_correlation_enabled={{ .Values.global.log_correlation.enabled }}" |
Himani Chawla | afd8e84 | 2021-03-25 01:32:59 +0530 | [diff] [blame] | 104 | - "--stack_id={{ tpl .Values.rw_core.stack_id . }}" |
khenaidoo | 15c53fb | 2021-08-09 13:56:27 -0400 | [diff] [blame] | 105 | - "--backoff_retry_initial_interval={{ .Values.rw_core.backoff_initial_interval }}" |
| 106 | - "--backoff_retry_max_interval={{ .Values.rw_core.backoff_max_interval }}" |
| 107 | - "--backoff_retry_max_elapsed_time={{ .Values.rw_core.backoff_max_elapsed_time }}" |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 108 | ports: |
| 109 | - containerPort: 50057 |
khenaidoo | 15c53fb | 2021-08-09 13:56:27 -0400 | [diff] [blame] | 110 | name: nbi-grpc |
| 111 | - containerPort: 50058 |
| 112 | name: core-grpc |
David Bainbridge | 16b19cc | 2020-05-29 11:50:44 -0700 | [diff] [blame] | 113 | {{- if .Values.securityContext.enabled }} |
| 114 | securityContext: |
| 115 | allowPrivilegeEscalation: false |
| 116 | {{- end }} |
David Bainbridge | c349f64 | 2019-09-24 19:20:47 +0000 | [diff] [blame] | 117 | livenessProbe: |
| 118 | httpGet: |
| 119 | path: /healthz |
| 120 | port: 8080 |
khenaidoo | 15c53fb | 2021-08-09 13:56:27 -0400 | [diff] [blame] | 121 | initialDelaySeconds: {{ .Values.probe.liveness.initial_delay_seconds }} |
| 122 | periodSeconds: {{ .Values.probe.liveness.period_seconds }} |
David Bainbridge | c349f64 | 2019-09-24 19:20:47 +0000 | [diff] [blame] | 123 | readinessProbe: |
| 124 | httpGet: |
| 125 | path: /readz |
| 126 | port: 8080 |
khenaidoo | 15c53fb | 2021-08-09 13:56:27 -0400 | [diff] [blame] | 127 | initialDelaySeconds: {{ .Values.probe.readiness.initial_delay_seconds }} |
| 128 | periodSeconds: {{ .Values.probe.readiness.period_seconds }} |
Andrey Pozolotin | 7e928a9 | 2021-08-13 12:37:24 +0200 | [diff] [blame] | 129 | resources: |
| 130 | requests: |
| 131 | {{- if .Values.resources.rw_core.requests.memory }} |
| 132 | memory: {{ .Values.resources.rw_core.requests.memory }} |
| 133 | {{- end }} |
| 134 | {{- if .Values.resources.rw_core.requests.cpu }} |
| 135 | cpu: {{ .Values.resources.rw_core.requests.cpu }} |
| 136 | {{- end }} |
| 137 | limits: |
| 138 | {{- if .Values.resources.rw_core.limits.memory }} |
| 139 | memory: {{ .Values.resources.rw_core.limits.memory }} |
| 140 | {{- end }} |
| 141 | {{- if .Values.resources.rw_core.limits.cpu }} |
| 142 | cpu: {{ .Values.resources.rw_core.limits.cpu }} |
| 143 | {{- end }} |
Andrey Pozolotin | da75c92 | 2021-08-24 17:41:08 +0200 | [diff] [blame] | 144 | affinity: |
| 145 | podAffinity: |
| 146 | preferredDuringSchedulingIgnoredDuringExecution: |
| 147 | {{- if .Values.scheduleRules.preferStackPodsOnSameNode }} |
| 148 | - podAffinityTerm: |
| 149 | topologyKey: kubernetes.io/hostname |
| 150 | labelSelector: |
| 151 | matchExpressions: |
| 152 | - key: app.kubernetes.io/stack |
| 153 | operator: In |
| 154 | values: |
| 155 | - {{ .Values.global.stack_name }} |
| 156 | weight: 100 |
| 157 | {{- end }} |
| 158 | podAntiAffinity: |
| 159 | preferredDuringSchedulingIgnoredDuringExecution: |
| 160 | {{- if .Values.scheduleRules.preferStacksOnDifferentNodes }} |
| 161 | - podAffinityTerm: |
| 162 | topologyKey: kubernetes.io/hostname |
| 163 | labelSelector: |
| 164 | matchExpressions: |
| 165 | - key: app.kubernetes.io/name |
| 166 | operator: In |
| 167 | values: |
| 168 | - read-write-core |
| 169 | weight: 100 |
| 170 | {{- end }} |