blob: a2cb7c9069d46019c715504f7ea13ac825ea12a3 [file] [log] [blame]
Matteo Scandolo71d97d92021-06-24 11:58:32 +02001---
2# Copyright 2017-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
Elia Battiston587c6b22022-02-21 18:41:31 +010015{{- $log_level := tpl .Values.log_level . | lower }}
Matteo Scandolo71d97d92021-06-24 11:58:32 +020016
17apiVersion: apps/v1
18kind: Deployment
19metadata:
20 name: {{ template "bbsim.fullname" . }}
21 namespace: {{ .Release.Namespace }}
22 labels:
23 app: "bbsim"
24 name: {{ template "bbsim.name" . }}
25 chart: {{ template "bbsim.chart" . }}
26 release: {{ .Release.Name }}
27 heritage: {{ .Release.Service }}
28spec:
29 replicas: {{ .Values.replicaCount }}
30 selector:
31 matchLabels:
32 app: "bbsim"
33 name: {{ template "bbsim.name" . }}
34 release: {{ .Release.Name }}
35 template:
36 metadata:
37 labels:
38 app: "bbsim"
39 name: {{ template "bbsim.name" . }}
40 release: {{ .Release.Name }}
41 app.kubernetes.io/name: "bbsim"
42 app.kubernetes.io/version: {{ quote .Chart.AppVersion }}
43 app.kubernetes.io/component: "device-emulator"
44 app.kubernetes.io/part-of: "voltha"
45 app.kubernetes.io/managed-by: {{ quote .Release.Service }}
46 helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
47 spec:
48 serviceAccount: {{ .Values.serviceAccountName }}
49 serviceAccountName: {{ .Values.serviceAccountName }}
50 containers:
51 - name: {{ .Chart.Name }}
52 image: '{{ tpl .Values.images.bbsim.registry . }}{{ tpl .Values.images.bbsim.repository . }}:{{ tpl ( tpl .Values.images.bbsim.tag . ) . }}'
53 imagePullPolicy: {{ tpl .Values.images.bbsim.pullPolicy . }}
54 securityContext:
55 privileged: {{ .Values.privileged }}
56 livenessProbe:
57 exec:
58 command:
59 - bbsimctl
60 - olt
61 - get
62 initialDelaySeconds: 5
63 periodSeconds: 30
Matteo Scandolo70cadc52021-07-08 17:14:52 -070064 timeoutSeconds: 5
Matteo Scandolo71d97d92021-06-24 11:58:32 +020065 readinessProbe:
66 httpGet:
67 path: /v2/cfg
68 port: {{ .Values.bbsim_sadis_port }}
69 httpHeaders:
70 initialDelaySeconds: 5
71 periodSeconds: 30
Matteo Scandolo70cadc52021-07-08 17:14:52 -070072 timeoutSeconds: 5
Matteo Scandolo71d97d92021-06-24 11:58:32 +020073 command: [
74 "/app/bbsim",
Matteo Scandolo70cadc52021-07-08 17:14:52 -070075 "-openolt_address", "0.0.0.0:{{ .Values.olt_tcp_port }}",
Andrea Campanella97c47ab2021-07-21 20:59:44 +020076 "-dmi_server_address", ":{{ .Values.bbsim_dmi_port}}",
Matteo Scandolo71d97d92021-06-24 11:58:32 +020077 "-olt_id", "{{ .Values.olt_id }}",
78 "-nni", "{{ .Values.nni }}",
Elia Battiston587c6b22022-02-21 18:41:31 +010079 "-nni_speed", "{{ .Values.nni_speed }}",
Matteo Scandolo71d97d92021-06-24 11:58:32 +020080 "-pon", "{{ .Values.pon }}",
81 "-onu", "{{ .Values.onu }}",
82 "-uni", "{{ .Values.uni }}",
Elia Battistonffb9da52022-01-20 10:38:05 +010083 "-pots", "{{ .Values.pots }}",
Andrea Campanella66534ee2022-03-17 14:50:00 +010084 "-nni_dhcp_trap_vid", "{{ .Values.nni_dhcp_trap_vid }}",
Matteo Scandolo71d97d92021-06-24 11:58:32 +020085 "-bp_format", "{{ .Values.bp_format }}",
86 "-oltRebootDelay", "{{ .Values.oltRebootDelay }}",
87 "-logLevel", "{{ $log_level }}",
88 "-delay", "{{ .Values.delay }}",
89 "-services", "configs/services.yaml",
Elia Battiston587c6b22022-02-21 18:41:31 +010090 {{ if .Values.ponPortsConfig -}}
91 "-pon_port_config_file", "configs/pon-config.yaml",
92 {{ end -}}
Matteo Scandolo71d97d92021-06-24 11:58:32 +020093 "-rest_api_address", ":{{ .Values.bbsim_rest_port }}",
94 "-ca", "{{ .Values.controlledActivation }}",
95 "-omci_response_rate", "{{ .Values.omci_response_rate }}",
Matteo Scandoloa205aad2022-03-18 10:13:18 -070096 {{ if .Values.injectOmciUnknownMe }}
97 "-injectOmciUnknownMe",
98 {{ end -}}
Matteo Scandolod7938f12022-02-18 08:27:52 -080099 {{ if .Values.injectOmciUnknownAttributes }}
100 "-injectOmciUnknownAttributes",
101 {{ end -}}
Matteo Scandolo71d97d92021-06-24 11:58:32 +0200102 {{ if .Values.enableEvents -}}
103 "-enableEvents",
104 "-kafkaAddress", "{{ .Values.kafkaAddress }}",
105 {{ end -}}
106 {{ if .Values.enablePerf -}}
107 "-enableperf",
108 {{ end -}}
109 "-kafkaEventTopic", "{{ .Values.kafkaEventTopic }}",
110 {{ if .Values.authRetry -}}
111 "-authRetry",
112 {{ end -}}
113 {{ if .Values.dhcpRetry -}}
114 "-dhcpRetry",
115 {{ end -}}
116 ]
117 ports:
118 - name: "bbsim-{{ .Values.olt_id }}"
119 containerPort: {{ .Values.olt_tcp_port }}
120 protocol: TCP
121 - name: "bbsim-{{ .Values.olt_id }}-api"
122 containerPort: {{ .Values.bbsim_api_port }}
123 protocol: TCP
124 - name: "bbsim-{{ .Values.olt_id }}-sadis"
125 containerPort: {{ .Values.bbsim_sadis_port }}
126 protocol: TCP
127 - name: "bbsim-{{ .Values.olt_id }}-rest"
128 containerPort: {{ .Values.bbsim_rest_port }}
129 protocol: TCP
130 - name: "bbsim-{{ .Values.olt_id }}-dmi"
131 containerPort: {{ .Values.bbsim_dmi_port }}
132 protocol: TCP
133 env:
134 - name: POD_IP
135 valueFrom:
136 fieldRef:
137 fieldPath: status.podIP
138 - name: NAMESPACE
139 valueFrom:
140 fieldRef:
141 fieldPath: metadata.namespace
142 resources:
143{{ toYaml .Values.resources | indent 12 }}
144 volumeMounts:
145 - name: bbsim-services-config
146 mountPath: /app/configs/services.yaml
147 subPath: services.yaml
Elia Battiston587c6b22022-02-21 18:41:31 +0100148 - name: bbsim-pon-ports-config
149 mountPath: /app/configs/pon-config.yaml
150 subPath: pon-config.yaml
Matteo Scandolo71d97d92021-06-24 11:58:32 +0200151 volumes:
152 - name: bbsim-services-config
153 configMap:
154 name: bbsim-services-{{ .Values.olt_id }}
155 items:
156 - key: bbsimServicesConfig
157 path: services.yaml
Elia Battiston587c6b22022-02-21 18:41:31 +0100158 - name: bbsim-pon-ports-config
159 configMap:
160 name: bbsim-pon-ports-{{ .Values.olt_id }}
161 items:
162 - key: bbsimPonPortsConfig
163 path: pon-config.yaml
Matteo Scandolo71d97d92021-06-24 11:58:32 +0200164 {{- with .Values.nodeSelector }}
165 nodeSelector:
166{{ toYaml . | indent 8 }}
167 {{- end }}
168 {{- with .Values.affinity }}
169 affinity:
170{{ toYaml . | indent 8 }}
171 {{- end }}
172 {{- with .Values.tolerations }}
173 tolerations:
174{{ toYaml . | indent 8 }}
175 {{- end }}