Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 1 | {{/* |
Jeremy Ronquillo | ec2d3e4 | 2020-06-05 11:33:39 -0700 | [diff] [blame] | 2 | # Copyright 2020-present Open Networking Foundation |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 3 | |
Jeremy Ronquillo | 6046ce3 | 2020-06-18 11:06:29 -0700 | [diff] [blame] | 4 | # SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0 |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 5 | */}} |
| 6 | |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 7 | {{- $upfConfig := index .Values.config.upf.cfgFiles "upf.json" }} |
| 8 | {{- $accessConfig := index $upfConfig "access" }} |
| 9 | {{- $coreConfig := index $upfConfig "core" }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 10 | --- |
| 11 | apiVersion: apps/v1 |
| 12 | kind: StatefulSet |
| 13 | metadata: |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 14 | name: upf |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 15 | labels: |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 16 | {{ tuple "upf" . | include "omec-user-plane.metadata_labels" | indent 4 }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 17 | spec: |
| 18 | replicas: 1 |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 19 | serviceName: upf-headless |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 20 | selector: |
| 21 | matchLabels: |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 22 | {{ tuple "upf" . | include "omec-user-plane.metadata_labels" | indent 6 }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 23 | template: |
| 24 | metadata: |
| 25 | labels: |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 26 | {{ tuple "upf" . | include "omec-user-plane.metadata_labels" | indent 8 }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 27 | annotations: |
| 28 | k8s.v1.cni.cncf.io/networks: '[ |
| 29 | { |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 30 | "name": "access-net", |
| 31 | "interface": {{ index $accessConfig "ifname" | quote }}, |
Hyunsun Moon | 1905a6e | 2020-11-09 05:59:55 +0000 | [diff] [blame] | 32 | {{- if hasKey .Values.config.upf.access "mac" }} |
| 33 | "mac": {{ .Values.config.upf.access.mac | quote }}, |
| 34 | {{- end }} |
Hyunsun Moon | d457d18 | 2020-09-10 15:52:09 -0700 | [diff] [blame] | 35 | "ips": [{{ .Values.config.upf.access.ip | quote }}] |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 36 | }, |
| 37 | { |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 38 | "name": "core-net", |
| 39 | "interface": {{ index $coreConfig "ifname" | quote }}, |
Hyunsun Moon | 1905a6e | 2020-11-09 05:59:55 +0000 | [diff] [blame] | 40 | {{- if hasKey .Values.config.upf.core "mac" }} |
| 41 | "mac": {{ .Values.config.upf.core.mac | quote }}, |
| 42 | {{- end }} |
Hyunsun Moon | d457d18 | 2020-09-10 15:52:09 -0700 | [diff] [blame] | 43 | "ips": [{{ .Values.config.upf.core.ip | quote }}] |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 44 | } |
| 45 | ]' |
| 46 | spec: |
| 47 | shareProcessNamespace: true |
| 48 | {{- if .Values.nodeSelectors.enabled }} |
| 49 | nodeSelector: |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 50 | {{ .Values.nodeSelectors.upf.label }}: {{ .Values.nodeSelectors.upf.value }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 51 | {{- end }} |
Hyunsun Moon | e3500a8 | 2021-05-08 18:12:08 -0700 | [diff] [blame] | 52 | {{- if hasKey .Values.images "pullSecrets" }} |
Hyunsun Moon | 8da1788 | 2020-10-14 21:28:44 -0500 | [diff] [blame] | 53 | imagePullSecrets: |
Hyunsun Moon | e3500a8 | 2021-05-08 18:12:08 -0700 | [diff] [blame] | 54 | {{ toYaml .Values.images.pullSecrets | indent 8 }} |
Hyunsun Moon | 8da1788 | 2020-10-14 21:28:44 -0500 | [diff] [blame] | 55 | {{- end }} |
Hyunsun Moon | 918f26b | 2020-06-11 13:16:39 -0700 | [diff] [blame] | 56 | initContainers: |
| 57 | - name: bess-init |
| 58 | image: {{ .Values.images.tags.bess | quote }} |
| 59 | imagePullPolicy: {{ .Values.images.pullPolicy | quote }} |
| 60 | command: ["sh", "-xec"] |
| 61 | args: |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 62 | - ip route replace {{ .Values.config.upf.enb.subnet }} via {{ .Values.config.upf.access.gateway }}; |
| 63 | ip route replace default via {{ .Values.config.upf.core.gateway }} metric 110; |
Hyunsun Moon | 617dc05 | 2020-06-21 20:13:22 -0500 | [diff] [blame] | 64 | iptables -I OUTPUT -p icmp --icmp-type port-unreachable -j DROP; |
Hyunsun Moon | 918f26b | 2020-06-11 13:16:39 -0700 | [diff] [blame] | 65 | securityContext: |
| 66 | capabilities: |
| 67 | add: |
| 68 | - NET_ADMIN |
Hyunsun Moon | 09b33e5 | 2021-08-19 17:53:53 -0700 | [diff] [blame] | 69 | resources: |
| 70 | limits: |
Hyunsun Moon | 350a774 | 2021-09-08 13:53:55 -0700 | [diff] [blame] | 71 | cpu: 128m |
| 72 | memory: 64Mi |
Hyunsun Moon | 09b33e5 | 2021-08-19 17:53:53 -0700 | [diff] [blame] | 73 | requests: |
Hyunsun Moon | 350a774 | 2021-09-08 13:53:55 -0700 | [diff] [blame] | 74 | cpu: 128m |
| 75 | memory: 64Mi |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 76 | {{- if .Values.config.coreDump.enabled }} |
Hyunsun Moon | 7f03a77 | 2020-09-27 23:23:50 -0500 | [diff] [blame] | 77 | {{ tuple "upf" . | include "omec-user-plane.coredump_init" | indent 6 }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 78 | {{- end }} |
| 79 | containers: |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 80 | - name: bessd |
| 81 | image: {{ .Values.images.tags.bess | quote }} |
| 82 | imagePullPolicy: {{ .Values.images.pullPolicy | quote }} |
| 83 | securityContext: |
Hyunsun Moon | 785d81b | 2020-11-06 05:56:21 +0000 | [diff] [blame] | 84 | {{- if .Values.config.upf.privileged }} |
| 85 | privileged: true |
| 86 | {{- end }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 87 | capabilities: |
| 88 | add: |
| 89 | - IPC_LOCK |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 90 | stdin: true |
| 91 | tty: true |
Hyunsun Moon | 617dc05 | 2020-06-21 20:13:22 -0500 | [diff] [blame] | 92 | command: ["/bin/bash", "-xc"] |
| 93 | args: |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 94 | {{- if .Values.config.upf.hugepage.enabled }} |
Hyunsun Moon | 617dc05 | 2020-06-21 20:13:22 -0500 | [diff] [blame] | 95 | - bessd -f -grpc-url=0.0.0.0:10514 |
| 96 | {{- else }} |
| 97 | - bessd -m 0 -f -grpc-url=0.0.0.0:10514 |
| 98 | {{- end }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 99 | lifecycle: |
| 100 | postStart: |
| 101 | exec: |
| 102 | command: ["/etc/bess/conf/bessd-poststart.sh"] |
| 103 | livenessProbe: |
| 104 | tcpSocket: |
| 105 | port: 10514 |
| 106 | initialDelaySeconds: 15 |
| 107 | periodSeconds: 20 |
| 108 | resources: |
| 109 | requests: |
| 110 | {{- if .Values.resources.enabled }} |
| 111 | {{ toYaml .Values.resources.bess.requests | indent 12 }} |
| 112 | {{- end }} |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 113 | {{- if .Values.config.upf.hugepage.enabled }} |
Hyunsun Moon | 617dc05 | 2020-06-21 20:13:22 -0500 | [diff] [blame] | 114 | hugepages-1Gi: 2Gi |
| 115 | {{- end }} |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 116 | {{- if .Values.config.upf.sriov.enabled }} |
Hyunsun Moon | 7ee8ae8 | 2021-08-14 18:21:59 -0700 | [diff] [blame] | 117 | {{- if eq .Values.config.upf.access.resourceName .Values.config.upf.core.resourceName }} |
| 118 | {{ .Values.config.upf.access.resourceName }}: 2 |
| 119 | {{- else }} |
| 120 | {{ .Values.config.upf.access.resourceName }}: 1 |
| 121 | {{ .Values.config.upf.core.resourceName }}: 1 |
| 122 | {{- end }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 123 | {{- end }} |
| 124 | limits: |
| 125 | {{- if .Values.resources.enabled }} |
| 126 | {{ toYaml .Values.resources.bess.limits | indent 12 }} |
| 127 | {{- end }} |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 128 | {{- if .Values.config.upf.hugepage.enabled }} |
Hyunsun Moon | 617dc05 | 2020-06-21 20:13:22 -0500 | [diff] [blame] | 129 | hugepages-1Gi: 2Gi |
| 130 | {{- end }} |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 131 | {{- if .Values.config.upf.sriov.enabled }} |
Hyunsun Moon | 7ee8ae8 | 2021-08-14 18:21:59 -0700 | [diff] [blame] | 132 | {{- if eq .Values.config.upf.access.resourceName .Values.config.upf.core.resourceName }} |
| 133 | {{ .Values.config.upf.access.resourceName }}: 2 |
| 134 | {{- else }} |
| 135 | {{ .Values.config.upf.access.resourceName }}: 1 |
| 136 | {{ .Values.config.upf.core.resourceName }}: 1 |
| 137 | {{- end }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 138 | {{- end }} |
| 139 | env: |
| 140 | - name: CONF_FILE |
Hyunsun Moon | d60fcaf | 2020-07-14 16:09:13 -0700 | [diff] [blame] | 141 | value: /etc/bess/conf/upf.json |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 142 | volumeMounts: |
badhri85 | 907510f | 2021-05-27 10:43:02 -0600 | [diff] [blame] | 143 | - name: shared-app |
| 144 | mountPath: /pod-share |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 145 | {{- if .Values.config.upf.hugepage.enabled }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 146 | - name: hugepages |
| 147 | mountPath: /dev/hugepages |
Hyunsun Moon | 617dc05 | 2020-06-21 20:13:22 -0500 | [diff] [blame] | 148 | {{- end }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 149 | - name: configs |
| 150 | mountPath: /etc/bess/conf |
| 151 | {{- if .Values.config.coreDump.enabled }} |
| 152 | - name: coredump |
| 153 | mountPath: /tmp/coredump |
| 154 | {{- end }} |
Hyunsun Moon | 918f26b | 2020-06-11 13:16:39 -0700 | [diff] [blame] | 155 | - name: routectl |
| 156 | image: {{ .Values.images.tags.bess | quote }} |
| 157 | imagePullPolicy: {{ .Values.images.pullPolicy | quote }} |
| 158 | env: |
| 159 | - name: PYTHONUNBUFFERED |
| 160 | value: "1" |
| 161 | command: ["/opt/bess/bessctl/conf/route_control.py"] |
| 162 | args: |
| 163 | - -i |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 164 | - {{ index $accessConfig "ifname" }} |
| 165 | - {{ index $coreConfig "ifname" }} |
Hyunsun Moon | 918f26b | 2020-06-11 13:16:39 -0700 | [diff] [blame] | 166 | {{- if .Values.resources.enabled }} |
| 167 | resources: |
| 168 | {{ toYaml .Values.resources.routectl | indent 10 }} |
| 169 | {{- end }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 170 | - name: web |
| 171 | image: {{ .Values.images.tags.bess | quote }} |
| 172 | imagePullPolicy: {{ .Values.images.pullPolicy | quote }} |
| 173 | command: ["/bin/bash", "-xc", "bessctl http 0.0.0.0 8000"] |
| 174 | {{- if .Values.resources.enabled }} |
| 175 | resources: |
| 176 | {{ toYaml .Values.resources.web | indent 10 }} |
| 177 | {{- end }} |
Hyunsun Moon | 350a774 | 2021-09-08 13:53:55 -0700 | [diff] [blame] | 178 | - name: pfcp-agent |
Hyunsun Moon | d60fcaf | 2020-07-14 16:09:13 -0700 | [diff] [blame] | 179 | image: {{ .Values.images.tags.pfcpiface | quote }} |
| 180 | imagePullPolicy: {{ .Values.images.pullPolicy | quote }} |
| 181 | command: ["pfcpiface"] |
| 182 | args: |
| 183 | - -config |
| 184 | - /tmp/conf/upf.json |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 185 | {{- if .Values.resources.enabled }} |
| 186 | resources: |
| 187 | {{ toYaml .Values.resources.cpiface | indent 10 }} |
| 188 | {{- end }} |
Hyunsun Moon | d60fcaf | 2020-07-14 16:09:13 -0700 | [diff] [blame] | 189 | volumeMounts: |
badhri85 | 907510f | 2021-05-27 10:43:02 -0600 | [diff] [blame] | 190 | - name: shared-app |
| 191 | mountPath: /pod-share |
Hyunsun Moon | d60fcaf | 2020-07-14 16:09:13 -0700 | [diff] [blame] | 192 | - name: configs |
| 193 | mountPath: /tmp/conf |
Hyunsun Moon | 350a774 | 2021-09-08 13:53:55 -0700 | [diff] [blame] | 194 | {{- if .Values.config.gratuitousArp.enabled }} |
| 195 | - name: arping |
| 196 | image: {{ .Values.images.tags.tools | quote }} |
| 197 | imagePullPolicy: {{ .Values.images.pullPolicy | quote }} |
| 198 | command: ["sh", "-xec"] |
| 199 | args: |
| 200 | - | |
| 201 | while true; do |
Hyunsun Moon | 5851c79 | 2021-10-20 20:00:00 -0700 | [diff] [blame] | 202 | # arping does not work - BESS graph is still disconnected |
| 203 | #arping -c 2 -I {{ index $accessConfig "ifname" }} {{ .Values.config.upf.access.gateway }} |
| 204 | #arping -c 2 -I {{ index $coreConfig "ifname" }} {{ .Values.config.upf.core.gateway }} |
Hyunsun Moon | 21b39cf | 2021-10-22 13:20:49 -0700 | [diff] [blame^] | 205 | ping -c 2 {{ .Values.config.upf.access.gateway }} |
| 206 | ping -c 2 {{ .Values.config.upf.core.gateway }} |
Hyunsun Moon | 350a774 | 2021-09-08 13:53:55 -0700 | [diff] [blame] | 207 | sleep {{ .Values.config.gratuitousArp.interval }} |
| 208 | done |
| 209 | resources: |
| 210 | limits: |
| 211 | cpu: 128m |
| 212 | memory: 64Mi |
| 213 | requests: |
| 214 | cpu: 128m |
| 215 | memory: 64Mi |
| 216 | {{- end }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 217 | volumes: |
| 218 | - name: configs |
| 219 | configMap: |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 220 | name: upf |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 221 | defaultMode: 493 |
badhri85 | 907510f | 2021-05-27 10:43:02 -0600 | [diff] [blame] | 222 | - name: shared-app |
| 223 | emptyDir: {} |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 224 | {{- if .Values.config.upf.hugepage.enabled }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 225 | - name: hugepages |
| 226 | emptyDir: |
| 227 | medium: HugePages |
Hyunsun Moon | 617dc05 | 2020-06-21 20:13:22 -0500 | [diff] [blame] | 228 | {{- end }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 229 | {{- if .Values.config.coreDump.enabled }} |
| 230 | - name: host-rootfs |
| 231 | hostPath: |
| 232 | path: / |
| 233 | - name: coredump |
| 234 | hostPath: |
| 235 | path: {{ .Values.config.coreDump.path }} |
| 236 | {{- end }} |