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 }}", |
Matteo Scandolo | 71d97d9 | 2021-06-24 11:58:32 +0200 | [diff] [blame] | 76 | "-olt_id", "{{ .Values.olt_id }}", |
| 77 | "-nni", "{{ .Values.nni }}", |
| 78 | "-pon", "{{ .Values.pon }}", |
| 79 | "-onu", "{{ .Values.onu }}", |
| 80 | "-uni", "{{ .Values.uni }}", |
| 81 | "-bp_format", "{{ .Values.bp_format }}", |
| 82 | "-oltRebootDelay", "{{ .Values.oltRebootDelay }}", |
| 83 | "-logLevel", "{{ $log_level }}", |
| 84 | "-delay", "{{ .Values.delay }}", |
| 85 | "-services", "configs/services.yaml", |
| 86 | "-rest_api_address", ":{{ .Values.bbsim_rest_port }}", |
| 87 | "-ca", "{{ .Values.controlledActivation }}", |
| 88 | "-omci_response_rate", "{{ .Values.omci_response_rate }}", |
| 89 | {{ if .Values.enableEvents -}} |
| 90 | "-enableEvents", |
| 91 | "-kafkaAddress", "{{ .Values.kafkaAddress }}", |
| 92 | {{ end -}} |
| 93 | {{ if .Values.enablePerf -}} |
| 94 | "-enableperf", |
| 95 | {{ end -}} |
| 96 | "-kafkaEventTopic", "{{ .Values.kafkaEventTopic }}", |
| 97 | {{ if .Values.authRetry -}} |
| 98 | "-authRetry", |
| 99 | {{ end -}} |
| 100 | {{ if .Values.dhcpRetry -}} |
| 101 | "-dhcpRetry", |
| 102 | {{ end -}} |
| 103 | ] |
| 104 | ports: |
| 105 | - name: "bbsim-{{ .Values.olt_id }}" |
| 106 | containerPort: {{ .Values.olt_tcp_port }} |
| 107 | protocol: TCP |
| 108 | - name: "bbsim-{{ .Values.olt_id }}-api" |
| 109 | containerPort: {{ .Values.bbsim_api_port }} |
| 110 | protocol: TCP |
| 111 | - name: "bbsim-{{ .Values.olt_id }}-sadis" |
| 112 | containerPort: {{ .Values.bbsim_sadis_port }} |
| 113 | protocol: TCP |
| 114 | - name: "bbsim-{{ .Values.olt_id }}-rest" |
| 115 | containerPort: {{ .Values.bbsim_rest_port }} |
| 116 | protocol: TCP |
| 117 | - name: "bbsim-{{ .Values.olt_id }}-dmi" |
| 118 | containerPort: {{ .Values.bbsim_dmi_port }} |
| 119 | protocol: TCP |
| 120 | env: |
| 121 | - name: POD_IP |
| 122 | valueFrom: |
| 123 | fieldRef: |
| 124 | fieldPath: status.podIP |
| 125 | - name: NAMESPACE |
| 126 | valueFrom: |
| 127 | fieldRef: |
| 128 | fieldPath: metadata.namespace |
| 129 | resources: |
| 130 | {{ toYaml .Values.resources | indent 12 }} |
| 131 | volumeMounts: |
| 132 | - name: bbsim-services-config |
| 133 | mountPath: /app/configs/services.yaml |
| 134 | subPath: services.yaml |
| 135 | volumes: |
| 136 | - name: bbsim-services-config |
| 137 | configMap: |
| 138 | name: bbsim-services-{{ .Values.olt_id }} |
| 139 | items: |
| 140 | - key: bbsimServicesConfig |
| 141 | path: services.yaml |
| 142 | {{- with .Values.nodeSelector }} |
| 143 | nodeSelector: |
| 144 | {{ toYaml . | indent 8 }} |
| 145 | {{- end }} |
| 146 | {{- with .Values.affinity }} |
| 147 | affinity: |
| 148 | {{ toYaml . | indent 8 }} |
| 149 | {{- end }} |
| 150 | {{- with .Values.tolerations }} |
| 151 | tolerations: |
| 152 | {{ toYaml . | indent 8 }} |
| 153 | {{- end }} |