blob: ef9194d91929879fe9782185d7143ab011a85186 [file] [log] [blame]
Jeremy Ronquillo223db002020-06-05 10:28:22 -07001{{/*
Jeremy Ronquilloec2d3e42020-06-05 11:33:39 -07002# Copyright 2020-present Open Networking Foundation
Jeremy Ronquillo223db002020-06-05 10:28:22 -07003
Jeremy Ronquillo6046ce32020-06-18 11:06:29 -07004# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
Jeremy Ronquillo223db002020-06-05 10:28:22 -07005*/}}
6
Hyunsun Moon33d85312020-08-20 00:55:31 -07007{{- $upfConfig := index .Values.config.upf.cfgFiles "upf.json" }}
8{{- $accessConfig := index $upfConfig "access" }}
9{{- $coreConfig := index $upfConfig "core" }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -070010---
11apiVersion: apps/v1
12kind: StatefulSet
13metadata:
Hyunsun Moon33d85312020-08-20 00:55:31 -070014 name: upf
Jeremy Ronquillo223db002020-06-05 10:28:22 -070015 labels:
Hyunsun Moon33d85312020-08-20 00:55:31 -070016{{ tuple "upf" . | include "omec-user-plane.metadata_labels" | indent 4 }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -070017spec:
18 replicas: 1
Hyunsun Moon33d85312020-08-20 00:55:31 -070019 serviceName: upf-headless
Jeremy Ronquillo223db002020-06-05 10:28:22 -070020 selector:
21 matchLabels:
Hyunsun Moon33d85312020-08-20 00:55:31 -070022{{ tuple "upf" . | include "omec-user-plane.metadata_labels" | indent 6 }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -070023 template:
24 metadata:
25 labels:
Hyunsun Moon33d85312020-08-20 00:55:31 -070026{{ tuple "upf" . | include "omec-user-plane.metadata_labels" | indent 8 }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -070027 annotations:
28 k8s.v1.cni.cncf.io/networks: '[
29 {
Hyunsun Moon33d85312020-08-20 00:55:31 -070030 "name": "access-net",
31 "interface": {{ index $accessConfig "ifname" | quote }},
Hyunsun Moon1905a6e2020-11-09 05:59:55 +000032 {{- if hasKey .Values.config.upf.access "mac" }}
33 "mac": {{ .Values.config.upf.access.mac | quote }},
34 {{- end }}
Hyunsun Moond457d182020-09-10 15:52:09 -070035 "ips": [{{ .Values.config.upf.access.ip | quote }}]
Jeremy Ronquillo223db002020-06-05 10:28:22 -070036 },
37 {
Hyunsun Moon33d85312020-08-20 00:55:31 -070038 "name": "core-net",
39 "interface": {{ index $coreConfig "ifname" | quote }},
Hyunsun Moon1905a6e2020-11-09 05:59:55 +000040 {{- if hasKey .Values.config.upf.core "mac" }}
41 "mac": {{ .Values.config.upf.core.mac | quote }},
42 {{- end }}
Hyunsun Moond457d182020-09-10 15:52:09 -070043 "ips": [{{ .Values.config.upf.core.ip | quote }}]
Jeremy Ronquillo223db002020-06-05 10:28:22 -070044 }
45 ]'
46 spec:
47 shareProcessNamespace: true
48 {{- if .Values.nodeSelectors.enabled }}
49 nodeSelector:
Hyunsun Moon33d85312020-08-20 00:55:31 -070050 {{ .Values.nodeSelectors.upf.label }}: {{ .Values.nodeSelectors.upf.value }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -070051 {{- end }}
Hyunsun Moone3500a82021-05-08 18:12:08 -070052 {{- if hasKey .Values.images "pullSecrets" }}
Hyunsun Moon8da17882020-10-14 21:28:44 -050053 imagePullSecrets:
Hyunsun Moone3500a82021-05-08 18:12:08 -070054{{ toYaml .Values.images.pullSecrets | indent 8 }}
Hyunsun Moon8da17882020-10-14 21:28:44 -050055 {{- end }}
Hyunsun Moon918f26b2020-06-11 13:16:39 -070056 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 Moon33d85312020-08-20 00:55:31 -070062 - 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 Moon617dc052020-06-21 20:13:22 -050064 iptables -I OUTPUT -p icmp --icmp-type port-unreachable -j DROP;
Hyunsun Moon918f26b2020-06-11 13:16:39 -070065 securityContext:
66 capabilities:
67 add:
68 - NET_ADMIN
Hyunsun Moon09b33e52021-08-19 17:53:53 -070069 resources:
70 limits:
Hyunsun Moon350a7742021-09-08 13:53:55 -070071 cpu: 128m
72 memory: 64Mi
Hyunsun Moon09b33e52021-08-19 17:53:53 -070073 requests:
Hyunsun Moon350a7742021-09-08 13:53:55 -070074 cpu: 128m
75 memory: 64Mi
Jeremy Ronquillo223db002020-06-05 10:28:22 -070076 {{- if .Values.config.coreDump.enabled }}
Hyunsun Moon7f03a772020-09-27 23:23:50 -050077{{ tuple "upf" . | include "omec-user-plane.coredump_init" | indent 6 }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -070078 {{- end }}
79 containers:
Jeremy Ronquillo223db002020-06-05 10:28:22 -070080 - name: bessd
81 image: {{ .Values.images.tags.bess | quote }}
82 imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
83 securityContext:
Hyunsun Moon785d81b2020-11-06 05:56:21 +000084 {{- if .Values.config.upf.privileged }}
85 privileged: true
86 {{- end }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -070087 capabilities:
88 add:
89 - IPC_LOCK
Jeremy Ronquillo223db002020-06-05 10:28:22 -070090 stdin: true
91 tty: true
Hyunsun Moon617dc052020-06-21 20:13:22 -050092 command: ["/bin/bash", "-xc"]
93 args:
Hyunsun Moon33d85312020-08-20 00:55:31 -070094 {{- if .Values.config.upf.hugepage.enabled }}
Hyunsun Moon617dc052020-06-21 20:13:22 -050095 - 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 Ronquillo223db002020-06-05 10:28:22 -070099 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 Moon33d85312020-08-20 00:55:31 -0700113 {{- if .Values.config.upf.hugepage.enabled }}
Hyunsun Moon617dc052020-06-21 20:13:22 -0500114 hugepages-1Gi: 2Gi
115 {{- end }}
Hyunsun Moon33d85312020-08-20 00:55:31 -0700116 {{- if .Values.config.upf.sriov.enabled }}
Hyunsun Moon7ee8ae82021-08-14 18:21:59 -0700117 {{- 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 Ronquillo223db002020-06-05 10:28:22 -0700123 {{- end }}
124 limits:
125 {{- if .Values.resources.enabled }}
126{{ toYaml .Values.resources.bess.limits | indent 12 }}
127 {{- end }}
Hyunsun Moon33d85312020-08-20 00:55:31 -0700128 {{- if .Values.config.upf.hugepage.enabled }}
Hyunsun Moon617dc052020-06-21 20:13:22 -0500129 hugepages-1Gi: 2Gi
130 {{- end }}
Hyunsun Moon33d85312020-08-20 00:55:31 -0700131 {{- if .Values.config.upf.sriov.enabled }}
Hyunsun Moon7ee8ae82021-08-14 18:21:59 -0700132 {{- 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 Ronquillo223db002020-06-05 10:28:22 -0700138 {{- end }}
139 env:
140 - name: CONF_FILE
Hyunsun Moond60fcaf2020-07-14 16:09:13 -0700141 value: /etc/bess/conf/upf.json
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700142 volumeMounts:
badhri85907510f2021-05-27 10:43:02 -0600143 - name: shared-app
144 mountPath: /pod-share
Hyunsun Moon33d85312020-08-20 00:55:31 -0700145 {{- if .Values.config.upf.hugepage.enabled }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700146 - name: hugepages
147 mountPath: /dev/hugepages
Hyunsun Moon617dc052020-06-21 20:13:22 -0500148 {{- end }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700149 - name: configs
150 mountPath: /etc/bess/conf
151 {{- if .Values.config.coreDump.enabled }}
152 - name: coredump
153 mountPath: /tmp/coredump
154 {{- end }}
Hyunsun Moon918f26b2020-06-11 13:16:39 -0700155 - 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 Moon33d85312020-08-20 00:55:31 -0700164 - {{ index $accessConfig "ifname" }}
165 - {{ index $coreConfig "ifname" }}
Hyunsun Moon918f26b2020-06-11 13:16:39 -0700166 {{- if .Values.resources.enabled }}
167 resources:
168{{ toYaml .Values.resources.routectl | indent 10 }}
169 {{- end }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700170 - 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 Moon350a7742021-09-08 13:53:55 -0700178 - name: pfcp-agent
Hyunsun Moond60fcaf2020-07-14 16:09:13 -0700179 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 Ronquillo223db002020-06-05 10:28:22 -0700185 {{- if .Values.resources.enabled }}
186 resources:
187{{ toYaml .Values.resources.cpiface | indent 10 }}
188 {{- end }}
Hyunsun Moond60fcaf2020-07-14 16:09:13 -0700189 volumeMounts:
badhri85907510f2021-05-27 10:43:02 -0600190 - name: shared-app
191 mountPath: /pod-share
Hyunsun Moond60fcaf2020-07-14 16:09:13 -0700192 - name: configs
193 mountPath: /tmp/conf
Hyunsun Moon350a7742021-09-08 13:53:55 -0700194 {{- if .Values.config.gratuitousArp.enabled }}
195 - name: arping
196 image: {{ .Values.images.tags.tools | quote }}
197 imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
Hyunsun Moona9bb8582021-10-22 15:41:23 -0700198 command: ["sh", "-xc"]
Hyunsun Moon350a7742021-09-08 13:53:55 -0700199 args:
200 - |
201 while true; do
Hyunsun Moon5851c792021-10-20 20:00:00 -0700202 # 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 Moon21b39cf2021-10-22 13:20:49 -0700205 ping -c 2 {{ .Values.config.upf.access.gateway }}
206 ping -c 2 {{ .Values.config.upf.core.gateway }}
Hyunsun Moon350a7742021-09-08 13:53:55 -0700207 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 Ronquillo223db002020-06-05 10:28:22 -0700217 volumes:
218 - name: configs
219 configMap:
Hyunsun Moon33d85312020-08-20 00:55:31 -0700220 name: upf
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700221 defaultMode: 493
badhri85907510f2021-05-27 10:43:02 -0600222 - name: shared-app
223 emptyDir: {}
Hyunsun Moon33d85312020-08-20 00:55:31 -0700224 {{- if .Values.config.upf.hugepage.enabled }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700225 - name: hugepages
226 emptyDir:
227 medium: HugePages
Hyunsun Moon617dc052020-06-21 20:13:22 -0500228 {{- end }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700229 {{- 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 }}