blob: 2aac00cd1f8005c5db719f8dd0f125953d1049e8 [file] [log] [blame]
David K. Bainbridge707022f2020-01-23 14:15:07 -08001# Copyright 2020-present Open Networking Foundation
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']
David Bainbridge2f9b76f2019-05-15 13:48:11 -070089 args:
David K. Bainbridge707022f2020-01-23 14:15:07 -080090 - "/app/ofagent"
Matteo Scandolof65e8752021-07-20 13:53:44 -070091 {{- if eq (len .Values.services.controller) 0 }}
Matteo Scandolob65a5a72021-04-30 16:16:05 -070092 {{- range $controllers.controllers }}
93 - "--controller={{ . }}"
94 {{- end }}
Matteo Scandolof65e8752021-07-20 13:53:44 -070095 {{- end }}
Jonathan Hart3980b742020-04-20 11:00:54 -070096 {{- range .Values.services.controller }}
Matteo Scandolob4c5f4e2020-11-11 12:05:23 -080097 - "--controller={{ tpl .address $ }}"
Jonathan Hart3980b742020-04-20 11:00:54 -070098 {{- end }}
David Bainbridge2bdd4302020-06-09 17:13:18 -070099 - "--voltha={{ template "fullname" . }}-api.{{ .Release.Namespace }}.svc:55555"
Neha Sharma1a3da1c2020-06-24 13:12:48 +0000100 - "--kv_store_address={{ .Values.services.etcd.address }}"
divyadesai0b0e4a12020-03-12 09:33:56 +0000101 - "--kv_store_type=etcd"
Neha Sharmae5767ea2020-04-08 13:39:57 +0000102 - "--kv_store_request_timeout=60s"
divyadesai0b0e4a12020-03-12 09:33:56 +0000103 - "--log_level={{ $log_level }}"
Matteo Scandolo06ee58c2021-05-26 15:28:51 -0700104 - "--device-refresh-interval={{ .Values.ofagent.device_refresh_interval }}"
David Bainbridge32ac6072019-10-21 20:29:52 +0000105 - "--probe=:8080"
Matteo Scandolob4c5f4e2020-11-11 12:05:23 -0800106 - "--trace_enabled={{ .Values.global.tracing.enabled }}"
107 - "--trace_agent_address={{ tpl .Values.services.tracing_agent.address . }}"
108 - "--log_correlation_enabled={{ .Values.global.log_correlation.enabled }}"
David Bainbridge16b19cc2020-05-29 11:50:44 -0700109 {{- if .Values.securityContext.enabled }}
110 securityContext:
111 allowPrivilegeEscalation: false
112 {{- end }}
David Bainbridge32ac6072019-10-21 20:29:52 +0000113 livenessProbe:
114 httpGet:
115 path: /healthz
116 port: 8080
117 initialDelaySeconds: 10
118 periodSeconds: 5
119 readinessProbe:
120 httpGet:
121 path: /readz
122 port: 8080
123 initialDelaySeconds: 10
124 periodSeconds: 5
Andrey Pozolotin7e928a92021-08-13 12:37:24 +0200125 resources:
126 requests:
127 {{- if .Values.resources.ofagent.requests.memory }}
128 memory: {{ .Values.resources.ofagent.requests.memory }}
129 {{- end }}
130 {{- if .Values.resources.ofagent.requests.cpu }}
131 cpu: {{ .Values.resources.ofagent.requests.cpu }}
132 {{- end }}
133 limits:
134 {{- if .Values.resources.ofagent.limits.memory }}
135 memory: {{ .Values.resources.ofagent.limits.memory }}
136 {{- end }}
137 {{- if .Values.resources.ofagent.limits.cpu }}
138 cpu: {{ .Values.resources.ofagent.limits.cpu }}
139 {{- end }}
Andrey Pozolotinda75c922021-08-24 17:41:08 +0200140 affinity:
141 podAffinity:
142 preferredDuringSchedulingIgnoredDuringExecution:
143 {{- if .Values.scheduleRules.preferStackPodsOnSameNode }}
144 - podAffinityTerm:
145 topologyKey: kubernetes.io/hostname
146 labelSelector:
147 matchExpressions:
148 - key: app.kubernetes.io/stack
149 operator: In
150 values:
151 - {{ .Values.global.stack_name }}
152 weight: 100
153 {{- end }}
154 podAntiAffinity:
155 preferredDuringSchedulingIgnoredDuringExecution:
156 {{- if .Values.scheduleRules.preferStacksOnDifferentNodes }}
157 - podAffinityTerm:
158 topologyKey: kubernetes.io/hostname
159 labelSelector:
160 matchExpressions:
161 - key: app.kubernetes.io/name
162 operator: In
163 values:
164 - open-flow-agent
165 weight: 100
166 {{- end }}