blob: 8eb13088d080ee913c6bc626674814f320fb98ef [file] [log] [blame]
Joey Armstrong07475092023-01-26 10:56:13 -05001# Copyright 2020-2023 Open Networking Foundation (ONF) and the ONF Contributors
David Bainbridge2f9b76f2019-05-15 13:48:11 -07002#
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 Scandolob65a5a72021-04-30 16:16:05 -070014{{- $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 Scandolo600140f2021-06-04 14:08:21 -070021 {{- $current := printf "%s-onos-classic-%d.%s-onos-classic-hs.%s.svc:%d" $infraName $i $infraName $infraNamespaces ($onosOfPort | int) -}}
Matteo Scandolob65a5a72021-04-30 16:16:05 -070022 {{- $controllers := (mustAppend $controllers.controllers $current) | set $controllers "controllers" -}}
23{{- end -}}
David Bainbridge2f9b76f2019-05-15 13:48:11 -070024---
David Bainbridgec437c3e2020-06-25 14:48:24 -070025apiVersion: apps/v1
David Bainbridge2f9b76f2019-05-15 13:48:11 -070026kind: Deployment
27metadata:
David Bainbridge2bdd4302020-06-09 17:13:18 -070028 name: "{{ template "fullname" . }}-ofagent"
David Bainbridge8595b3b2020-06-05 12:23:05 -070029 namespace: {{ .Release.Namespace }}
David Bainbridge534a73d2019-08-30 18:57:23 +000030 {{- 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 Bainbridge2f9b76f2019-05-15 13:48:11 -070043spec:
44 replicas: {{ .Values.replicas.ofagent }}
David Bainbridgec437c3e2020-06-25 14:48:24 -070045 selector:
46 matchLabels:
47 app: ofagent
48 release: {{ .Release.Name }}
David Bainbridge2f9b76f2019-05-15 13:48:11 -070049 template:
50 metadata:
David Bainbridge8595b3b2020-06-05 12:23:05 -070051 namespace: {{ .Release.Namespace }}
David Bainbridge2f9b76f2019-05-15 13:48:11 -070052 labels:
53 app: ofagent
David Bainbridge8595b3b2020-06-05 12:23:05 -070054 release: {{ .Release.Name }}
David Bainbridge1f888042019-06-24 18:02:01 +000055 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 Scandolob4c5f4e2020-11-11 12:05:23 -080059 app.kubernetes.io/stack: "{{ .Values.global.stack_name }}"
David Bainbridge1f888042019-06-24 18:02:01 +000060 app.kubernetes.io/managed-by: {{ quote .Release.Service }}
61 helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
David Bainbridge534a73d2019-08-30 18:57:23 +000062 {{- 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 Bainbridge2f9b76f2019-05-15 13:48:11 -070072 spec:
73 terminationGracePeriodSeconds: 10
David Bainbridge16b19cc2020-05-29 11:50:44 -070074 {{- if .Values.securityContext.enabled }}
75 securityContext:
76 runAsUser: {{ .Values.securityContext.runAsUser }}
77 runAsGroup: {{ .Values.securityContext.runAsGroup }}
78 fsGroup: {{ .Values.securityContext.fsGroup }}
79 {{- end }}
David Bainbridge2f9b76f2019-05-15 13:48:11 -070080 containers:
81 - name: ofagent
David Bainbridge60018ec2020-06-02 13:32:30 -070082 image: '{{ tpl .Values.images.ofagent.registry . }}{{ tpl .Values.images.ofagent.repository . }}:{{ tpl .Values.images.ofagent.tag . }}'
83 imagePullPolicy: {{ tpl .Values.images.ofagent.pullPolicy . }}
David Bainbridge2f9b76f2019-05-15 13:48:11 -070084 env:
Matteo Scandoloaca9cbb2020-11-06 14:14:10 -080085 - name: COMPONENT_NAME
86 valueFrom:
87 fieldRef:
88 fieldPath: metadata.labels['app.kubernetes.io/name']
Marcos Aurelio Carrero (Furukawa)f6844f42023-06-06 15:18:58 -030089 - name: KV_STORE_DATAPATH_PREFIX
90 value: {{ tpl .Values.ofagent.kv_store_data_prefix . }}
David Bainbridge2f9b76f2019-05-15 13:48:11 -070091 args:
David K. Bainbridge707022f2020-01-23 14:15:07 -080092 - "/app/ofagent"
Matteo Scandolof65e8752021-07-20 13:53:44 -070093 {{- if eq (len .Values.services.controller) 0 }}
Matteo Scandolob65a5a72021-04-30 16:16:05 -070094 {{- range $controllers.controllers }}
95 - "--controller={{ . }}"
96 {{- end }}
Matteo Scandolof65e8752021-07-20 13:53:44 -070097 {{- end }}
Jonathan Hart3980b742020-04-20 11:00:54 -070098 {{- range .Values.services.controller }}
Matteo Scandolob4c5f4e2020-11-11 12:05:23 -080099 - "--controller={{ tpl .address $ }}"
Jonathan Hart3980b742020-04-20 11:00:54 -0700100 {{- end }}
David Bainbridge2bdd4302020-06-09 17:13:18 -0700101 - "--voltha={{ template "fullname" . }}-api.{{ .Release.Namespace }}.svc:55555"
Marcos Aurelio Carrero (Furukawa)f6844f42023-06-06 15:18:58 -0300102 - "--kv_store_address={{ tpl .Values.services.etcd.address . }}"
divyadesai0b0e4a12020-03-12 09:33:56 +0000103 - "--kv_store_type=etcd"
Neha Sharmae5767ea2020-04-08 13:39:57 +0000104 - "--kv_store_request_timeout=60s"
divyadesai0b0e4a12020-03-12 09:33:56 +0000105 - "--log_level={{ $log_level }}"
Matteo Scandolo06ee58c2021-05-26 15:28:51 -0700106 - "--device-refresh-interval={{ .Values.ofagent.device_refresh_interval }}"
David Bainbridge32ac6072019-10-21 20:29:52 +0000107 - "--probe=:8080"
Matteo Scandolob4c5f4e2020-11-11 12:05:23 -0800108 - "--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 Bainbridge16b19cc2020-05-29 11:50:44 -0700111 {{- if .Values.securityContext.enabled }}
112 securityContext:
113 allowPrivilegeEscalation: false
114 {{- end }}
David Bainbridge32ac6072019-10-21 20:29:52 +0000115 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 Pozolotin7e928a92021-08-13 12:37:24 +0200127 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 Pozolotinda75c922021-08-24 17:41:08 +0200142 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 }}