Joey Armstrong | 8cd89ae | 2024-02-10 16:58:02 -0500 | [diff] [blame] | 1 | # Copyright 2020-2024 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. |
Matteo Scandolo | b65a5a7 | 2021-04-30 16:16:05 -0700 | [diff] [blame] | 14 | {{- $log_level := tpl .Values.ofagent.log_level . | upper -}} |
| 15 | {{- $onosReplicas := default 1 .Values.onos_classic.replicas -}} |
| 16 | {{- $onosOfPort := default 6653 .Values.onos_classic.onosOfPort -}} |
| 17 | {{- $infraName := default "voltha-infra" .Values.global.voltha_infra_name -}} |
| 18 | {{- $infraNamespaces := default "infra" .Values.global.voltha_infra_namespace -}} |
| 19 | {{- $controllers := dict "controllers" (list) -}} |
| 20 | {{- range $i, $e := until ($onosReplicas | int) -}} |
Matteo Scandolo | 600140f | 2021-06-04 14:08:21 -0700 | [diff] [blame] | 21 | {{- $current := printf "%s-onos-classic-%d.%s-onos-classic-hs.%s.svc:%d" $infraName $i $infraName $infraNamespaces ($onosOfPort | int) -}} |
Matteo Scandolo | b65a5a7 | 2021-04-30 16:16:05 -0700 | [diff] [blame] | 22 | {{- $controllers := (mustAppend $controllers.controllers $current) | set $controllers "controllers" -}} |
| 23 | {{- end -}} |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 24 | --- |
David Bainbridge | c437c3e | 2020-06-25 14:48:24 -0700 | [diff] [blame] | 25 | apiVersion: apps/v1 |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 26 | kind: Deployment |
| 27 | metadata: |
David Bainbridge | 2bdd430 | 2020-06-09 17:13:18 -0700 | [diff] [blame] | 28 | name: "{{ template "fullname" . }}-ofagent" |
David Bainbridge | 8595b3b | 2020-06-05 12:23:05 -0700 | [diff] [blame] | 29 | namespace: {{ .Release.Namespace }} |
David Bainbridge | 534a73d | 2019-08-30 18:57:23 +0000 | [diff] [blame] | 30 | {{- if or (hasKey .Values "extra_deployment_labels") (hasKey .Values "ofagent_deployment_labels") }} |
| 31 | labels: |
| 32 | {{- if hasKey .Values "extra_deployment_labels" }} |
| 33 | {{- range $key, $val := .Values.extra_deployment_labels }} |
| 34 | {{ $key }}: {{ $val | quote }} |
| 35 | {{- end }} |
| 36 | {{- end }} |
| 37 | {{- if hasKey .Values "ofagent_deployment_labels" }} |
| 38 | {{- range $key, $val := .Values.ofagent_deployment_labels }} |
| 39 | {{ $key }}: {{ $val | quote }} |
| 40 | {{- end }} |
| 41 | {{- end }} |
| 42 | {{- end }} |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 43 | spec: |
| 44 | replicas: {{ .Values.replicas.ofagent }} |
David Bainbridge | c437c3e | 2020-06-25 14:48:24 -0700 | [diff] [blame] | 45 | selector: |
| 46 | matchLabels: |
| 47 | app: ofagent |
| 48 | release: {{ .Release.Name }} |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 49 | template: |
| 50 | metadata: |
David Bainbridge | 8595b3b | 2020-06-05 12:23:05 -0700 | [diff] [blame] | 51 | namespace: {{ .Release.Namespace }} |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 52 | labels: |
| 53 | app: ofagent |
David Bainbridge | 8595b3b | 2020-06-05 12:23:05 -0700 | [diff] [blame] | 54 | release: {{ .Release.Name }} |
David Bainbridge | 1f88804 | 2019-06-24 18:02:01 +0000 | [diff] [blame] | 55 | app.kubernetes.io/name: "open-flow-agent" |
| 56 | app.kubernetes.io/version: {{ quote .Chart.AppVersion }} |
| 57 | app.kubernetes.io/component: "integration" |
| 58 | app.kubernetes.io/part-of: "voltha" |
Matteo Scandolo | b4c5f4e | 2020-11-11 12:05:23 -0800 | [diff] [blame] | 59 | app.kubernetes.io/stack: "{{ .Values.global.stack_name }}" |
David Bainbridge | 1f88804 | 2019-06-24 18:02:01 +0000 | [diff] [blame] | 60 | app.kubernetes.io/managed-by: {{ quote .Release.Service }} |
| 61 | helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" |
David Bainbridge | 534a73d | 2019-08-30 18:57:23 +0000 | [diff] [blame] | 62 | {{- if hasKey .Values "extra_pod_labels" }} |
| 63 | {{- range $key, $val := .Values.extra_pod_labels }} |
| 64 | {{ $key }}: {{ $val | quote }} |
| 65 | {{- end }} |
| 66 | {{- end }} |
| 67 | {{- if hasKey .Values "ofagent_pod_labels" }} |
| 68 | {{- range $key, $val := .Values.ofagent_pod_labels }} |
| 69 | {{ $key }}: {{ $val | quote }} |
| 70 | {{- end }} |
| 71 | {{- end }} |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 72 | spec: |
| 73 | terminationGracePeriodSeconds: 10 |
David Bainbridge | 16b19cc | 2020-05-29 11:50:44 -0700 | [diff] [blame] | 74 | {{- if .Values.securityContext.enabled }} |
| 75 | securityContext: |
| 76 | runAsUser: {{ .Values.securityContext.runAsUser }} |
| 77 | runAsGroup: {{ .Values.securityContext.runAsGroup }} |
| 78 | fsGroup: {{ .Values.securityContext.fsGroup }} |
| 79 | {{- end }} |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 80 | containers: |
| 81 | - name: ofagent |
David Bainbridge | 60018ec | 2020-06-02 13:32:30 -0700 | [diff] [blame] | 82 | image: '{{ tpl .Values.images.ofagent.registry . }}{{ tpl .Values.images.ofagent.repository . }}:{{ tpl .Values.images.ofagent.tag . }}' |
| 83 | imagePullPolicy: {{ tpl .Values.images.ofagent.pullPolicy . }} |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 84 | env: |
Matteo Scandolo | aca9cbb | 2020-11-06 14:14:10 -0800 | [diff] [blame] | 85 | - name: COMPONENT_NAME |
| 86 | valueFrom: |
| 87 | fieldRef: |
| 88 | fieldPath: metadata.labels['app.kubernetes.io/name'] |
Marcos Aurelio Carrero (Furukawa) | f6844f4 | 2023-06-06 15:18:58 -0300 | [diff] [blame] | 89 | - name: KV_STORE_DATAPATH_PREFIX |
| 90 | value: {{ tpl .Values.ofagent.kv_store_data_prefix . }} |
David Bainbridge | 2f9b76f | 2019-05-15 13:48:11 -0700 | [diff] [blame] | 91 | args: |
David K. Bainbridge | 707022f | 2020-01-23 14:15:07 -0800 | [diff] [blame] | 92 | - "/app/ofagent" |
Matteo Scandolo | f65e875 | 2021-07-20 13:53:44 -0700 | [diff] [blame] | 93 | {{- if eq (len .Values.services.controller) 0 }} |
Matteo Scandolo | b65a5a7 | 2021-04-30 16:16:05 -0700 | [diff] [blame] | 94 | {{- range $controllers.controllers }} |
| 95 | - "--controller={{ . }}" |
| 96 | {{- end }} |
Matteo Scandolo | f65e875 | 2021-07-20 13:53:44 -0700 | [diff] [blame] | 97 | {{- end }} |
Jonathan Hart | 3980b74 | 2020-04-20 11:00:54 -0700 | [diff] [blame] | 98 | {{- range .Values.services.controller }} |
Matteo Scandolo | b4c5f4e | 2020-11-11 12:05:23 -0800 | [diff] [blame] | 99 | - "--controller={{ tpl .address $ }}" |
Jonathan Hart | 3980b74 | 2020-04-20 11:00:54 -0700 | [diff] [blame] | 100 | {{- end }} |
David Bainbridge | 2bdd430 | 2020-06-09 17:13:18 -0700 | [diff] [blame] | 101 | - "--voltha={{ template "fullname" . }}-api.{{ .Release.Namespace }}.svc:55555" |
abhay | cd29506 | 2024-12-12 11:05:07 +0530 | [diff] [blame^] | 102 | - "--kv_store_type={{ tpl .Values.services.kvstore.type . }}" |
| 103 | - "--kv_store_address={{ tpl .Values.services.kvstore.address . }}" |
Neha Sharma | e5767ea | 2020-04-08 13:39:57 +0000 | [diff] [blame] | 104 | - "--kv_store_request_timeout=60s" |
divyadesai | 0b0e4a1 | 2020-03-12 09:33:56 +0000 | [diff] [blame] | 105 | - "--log_level={{ $log_level }}" |
Matteo Scandolo | 06ee58c | 2021-05-26 15:28:51 -0700 | [diff] [blame] | 106 | - "--device-refresh-interval={{ .Values.ofagent.device_refresh_interval }}" |
David Bainbridge | 32ac607 | 2019-10-21 20:29:52 +0000 | [diff] [blame] | 107 | - "--probe=:8080" |
Matteo Scandolo | b4c5f4e | 2020-11-11 12:05:23 -0800 | [diff] [blame] | 108 | - "--trace_enabled={{ .Values.global.tracing.enabled }}" |
| 109 | - "--trace_agent_address={{ tpl .Values.services.tracing_agent.address . }}" |
| 110 | - "--log_correlation_enabled={{ .Values.global.log_correlation.enabled }}" |
David Bainbridge | 16b19cc | 2020-05-29 11:50:44 -0700 | [diff] [blame] | 111 | {{- if .Values.securityContext.enabled }} |
| 112 | securityContext: |
| 113 | allowPrivilegeEscalation: false |
| 114 | {{- end }} |
David Bainbridge | 32ac607 | 2019-10-21 20:29:52 +0000 | [diff] [blame] | 115 | livenessProbe: |
| 116 | httpGet: |
| 117 | path: /healthz |
| 118 | port: 8080 |
| 119 | initialDelaySeconds: 10 |
| 120 | periodSeconds: 5 |
| 121 | readinessProbe: |
| 122 | httpGet: |
| 123 | path: /readz |
| 124 | port: 8080 |
| 125 | initialDelaySeconds: 10 |
| 126 | periodSeconds: 5 |
Andrey Pozolotin | 7e928a9 | 2021-08-13 12:37:24 +0200 | [diff] [blame] | 127 | resources: |
| 128 | requests: |
| 129 | {{- if .Values.resources.ofagent.requests.memory }} |
| 130 | memory: {{ .Values.resources.ofagent.requests.memory }} |
| 131 | {{- end }} |
| 132 | {{- if .Values.resources.ofagent.requests.cpu }} |
| 133 | cpu: {{ .Values.resources.ofagent.requests.cpu }} |
| 134 | {{- end }} |
| 135 | limits: |
| 136 | {{- if .Values.resources.ofagent.limits.memory }} |
| 137 | memory: {{ .Values.resources.ofagent.limits.memory }} |
| 138 | {{- end }} |
| 139 | {{- if .Values.resources.ofagent.limits.cpu }} |
| 140 | cpu: {{ .Values.resources.ofagent.limits.cpu }} |
| 141 | {{- end }} |
Andrey Pozolotin | da75c92 | 2021-08-24 17:41:08 +0200 | [diff] [blame] | 142 | affinity: |
| 143 | podAffinity: |
| 144 | preferredDuringSchedulingIgnoredDuringExecution: |
| 145 | {{- if .Values.scheduleRules.preferStackPodsOnSameNode }} |
| 146 | - podAffinityTerm: |
| 147 | topologyKey: kubernetes.io/hostname |
| 148 | labelSelector: |
| 149 | matchExpressions: |
| 150 | - key: app.kubernetes.io/stack |
| 151 | operator: In |
| 152 | values: |
| 153 | - {{ .Values.global.stack_name }} |
| 154 | weight: 100 |
| 155 | {{- end }} |
| 156 | podAntiAffinity: |
| 157 | preferredDuringSchedulingIgnoredDuringExecution: |
| 158 | {{- if .Values.scheduleRules.preferStacksOnDifferentNodes }} |
| 159 | - podAffinityTerm: |
| 160 | topologyKey: kubernetes.io/hostname |
| 161 | labelSelector: |
| 162 | matchExpressions: |
| 163 | - key: app.kubernetes.io/name |
| 164 | operator: In |
| 165 | values: |
| 166 | - open-flow-agent |
| 167 | weight: 100 |
| 168 | {{- end }} |