Matteo Scandolo | 71d97d9 | 2021-06-24 11:58:32 +0200 | [diff] [blame] | 1 | --- |
| 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. |
| 15 | {{- $log_level := tpl .Values.log_level . }} |
| 16 | |
| 17 | apiVersion: apps/v1 |
| 18 | kind: Deployment |
| 19 | metadata: |
| 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 }} |
| 28 | spec: |
| 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 Scandolo | 70cadc5 | 2021-07-08 17:14:52 -0700 | [diff] [blame] | 64 | timeoutSeconds: 5 |
Matteo Scandolo | 71d97d9 | 2021-06-24 11:58:32 +0200 | [diff] [blame] | 65 | readinessProbe: |
| 66 | httpGet: |
| 67 | path: /v2/cfg |
| 68 | port: {{ .Values.bbsim_sadis_port }} |
| 69 | httpHeaders: |
| 70 | initialDelaySeconds: 5 |
| 71 | periodSeconds: 30 |
Matteo Scandolo | 70cadc5 | 2021-07-08 17:14:52 -0700 | [diff] [blame] | 72 | timeoutSeconds: 5 |
Matteo Scandolo | 71d97d9 | 2021-06-24 11:58:32 +0200 | [diff] [blame] | 73 | command: [ |
| 74 | "/app/bbsim", |
Matteo Scandolo | 70cadc5 | 2021-07-08 17:14:52 -0700 | [diff] [blame] | 75 | "-openolt_address", "0.0.0.0:{{ .Values.olt_tcp_port }}", |
Andrea Campanella | 97c47ab | 2021-07-21 20:59:44 +0200 | [diff] [blame] | 76 | "-dmi_server_address", ":{{ .Values.bbsim_dmi_port}}", |
Matteo Scandolo | 71d97d9 | 2021-06-24 11:58:32 +0200 | [diff] [blame] | 77 | "-olt_id", "{{ .Values.olt_id }}", |
| 78 | "-nni", "{{ .Values.nni }}", |
| 79 | "-pon", "{{ .Values.pon }}", |
| 80 | "-onu", "{{ .Values.onu }}", |
| 81 | "-uni", "{{ .Values.uni }}", |
| 82 | "-bp_format", "{{ .Values.bp_format }}", |
| 83 | "-oltRebootDelay", "{{ .Values.oltRebootDelay }}", |
| 84 | "-logLevel", "{{ $log_level }}", |
| 85 | "-delay", "{{ .Values.delay }}", |
| 86 | "-services", "configs/services.yaml", |
| 87 | "-rest_api_address", ":{{ .Values.bbsim_rest_port }}", |
| 88 | "-ca", "{{ .Values.controlledActivation }}", |
| 89 | "-omci_response_rate", "{{ .Values.omci_response_rate }}", |
| 90 | {{ if .Values.enableEvents -}} |
| 91 | "-enableEvents", |
| 92 | "-kafkaAddress", "{{ .Values.kafkaAddress }}", |
| 93 | {{ end -}} |
| 94 | {{ if .Values.enablePerf -}} |
| 95 | "-enableperf", |
| 96 | {{ end -}} |
| 97 | "-kafkaEventTopic", "{{ .Values.kafkaEventTopic }}", |
| 98 | {{ if .Values.authRetry -}} |
| 99 | "-authRetry", |
| 100 | {{ end -}} |
| 101 | {{ if .Values.dhcpRetry -}} |
| 102 | "-dhcpRetry", |
| 103 | {{ end -}} |
| 104 | ] |
| 105 | ports: |
| 106 | - name: "bbsim-{{ .Values.olt_id }}" |
| 107 | containerPort: {{ .Values.olt_tcp_port }} |
| 108 | protocol: TCP |
| 109 | - name: "bbsim-{{ .Values.olt_id }}-api" |
| 110 | containerPort: {{ .Values.bbsim_api_port }} |
| 111 | protocol: TCP |
| 112 | - name: "bbsim-{{ .Values.olt_id }}-sadis" |
| 113 | containerPort: {{ .Values.bbsim_sadis_port }} |
| 114 | protocol: TCP |
| 115 | - name: "bbsim-{{ .Values.olt_id }}-rest" |
| 116 | containerPort: {{ .Values.bbsim_rest_port }} |
| 117 | protocol: TCP |
| 118 | - name: "bbsim-{{ .Values.olt_id }}-dmi" |
| 119 | containerPort: {{ .Values.bbsim_dmi_port }} |
| 120 | protocol: TCP |
| 121 | env: |
| 122 | - name: POD_IP |
| 123 | valueFrom: |
| 124 | fieldRef: |
| 125 | fieldPath: status.podIP |
| 126 | - name: NAMESPACE |
| 127 | valueFrom: |
| 128 | fieldRef: |
| 129 | fieldPath: metadata.namespace |
| 130 | resources: |
| 131 | {{ toYaml .Values.resources | indent 12 }} |
| 132 | volumeMounts: |
| 133 | - name: bbsim-services-config |
| 134 | mountPath: /app/configs/services.yaml |
| 135 | subPath: services.yaml |
| 136 | volumes: |
| 137 | - name: bbsim-services-config |
| 138 | configMap: |
| 139 | name: bbsim-services-{{ .Values.olt_id }} |
| 140 | items: |
| 141 | - key: bbsimServicesConfig |
| 142 | path: services.yaml |
| 143 | {{- with .Values.nodeSelector }} |
| 144 | nodeSelector: |
| 145 | {{ toYaml . | indent 8 }} |
| 146 | {{- end }} |
| 147 | {{- with .Values.affinity }} |
| 148 | affinity: |
| 149 | {{ toYaml . | indent 8 }} |
| 150 | {{- end }} |
| 151 | {{- with .Values.tolerations }} |
| 152 | tolerations: |
| 153 | {{ toYaml . | indent 8 }} |
| 154 | {{- end }} |