blob: 303f27b256e69fa54e133b1693d5ce9ff570f86a [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
Jeremy Ronquillo223db002020-06-05 10:28:22 -070069 {{- if .Values.config.coreDump.enabled }}
Hyunsun Moon7f03a772020-09-27 23:23:50 -050070{{ tuple "upf" . | include "omec-user-plane.coredump_init" | indent 6 }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -070071 {{- end }}
72 containers:
Jeremy Ronquillo223db002020-06-05 10:28:22 -070073 - name: bessd
74 image: {{ .Values.images.tags.bess | quote }}
75 imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
76 securityContext:
Hyunsun Moon785d81b2020-11-06 05:56:21 +000077 {{- if .Values.config.upf.privileged }}
78 privileged: true
79 {{- end }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -070080 capabilities:
81 add:
82 - IPC_LOCK
Jeremy Ronquillo223db002020-06-05 10:28:22 -070083 stdin: true
84 tty: true
Hyunsun Moon617dc052020-06-21 20:13:22 -050085 command: ["/bin/bash", "-xc"]
86 args:
Hyunsun Moon33d85312020-08-20 00:55:31 -070087 {{- if .Values.config.upf.hugepage.enabled }}
Hyunsun Moon617dc052020-06-21 20:13:22 -050088 - bessd -f -grpc-url=0.0.0.0:10514
89 {{- else }}
90 - bessd -m 0 -f -grpc-url=0.0.0.0:10514
91 {{- end }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -070092 lifecycle:
93 postStart:
94 exec:
95 command: ["/etc/bess/conf/bessd-poststart.sh"]
96 livenessProbe:
97 tcpSocket:
98 port: 10514
99 initialDelaySeconds: 15
100 periodSeconds: 20
101 resources:
102 requests:
103 {{- if .Values.resources.enabled }}
104{{ toYaml .Values.resources.bess.requests | indent 12 }}
105 {{- end }}
Hyunsun Moon33d85312020-08-20 00:55:31 -0700106 {{- if .Values.config.upf.hugepage.enabled }}
Hyunsun Moon617dc052020-06-21 20:13:22 -0500107 hugepages-1Gi: 2Gi
108 {{- end }}
Hyunsun Moon33d85312020-08-20 00:55:31 -0700109 {{- if .Values.config.upf.sriov.enabled }}
Hyunsun Moondc4cc7a2021-08-10 17:17:49 -0700110 {{ .Values.config.upf.sriov.resourceName }}: 2
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700111 {{- end }}
112 limits:
113 {{- if .Values.resources.enabled }}
114{{ toYaml .Values.resources.bess.limits | indent 12 }}
115 {{- end }}
Hyunsun Moon33d85312020-08-20 00:55:31 -0700116 {{- if .Values.config.upf.hugepage.enabled }}
Hyunsun Moon617dc052020-06-21 20:13:22 -0500117 hugepages-1Gi: 2Gi
118 {{- end }}
Hyunsun Moon33d85312020-08-20 00:55:31 -0700119 {{- if .Values.config.upf.sriov.enabled }}
Hyunsun Moondc4cc7a2021-08-10 17:17:49 -0700120 {{ .Values.config.upf.sriov.resourceName }}: 2
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700121 {{- end }}
122 env:
123 - name: CONF_FILE
Hyunsun Moond60fcaf2020-07-14 16:09:13 -0700124 value: /etc/bess/conf/upf.json
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700125 volumeMounts:
badhri85907510f2021-05-27 10:43:02 -0600126 - name: shared-app
127 mountPath: /pod-share
Hyunsun Moon33d85312020-08-20 00:55:31 -0700128 {{- if .Values.config.upf.hugepage.enabled }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700129 - name: hugepages
130 mountPath: /dev/hugepages
Hyunsun Moon617dc052020-06-21 20:13:22 -0500131 {{- end }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700132 - name: configs
133 mountPath: /etc/bess/conf
134 {{- if .Values.config.coreDump.enabled }}
135 - name: coredump
136 mountPath: /tmp/coredump
137 {{- end }}
Hyunsun Moon918f26b2020-06-11 13:16:39 -0700138 - name: routectl
139 image: {{ .Values.images.tags.bess | quote }}
140 imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
141 env:
142 - name: PYTHONUNBUFFERED
143 value: "1"
144 command: ["/opt/bess/bessctl/conf/route_control.py"]
145 args:
146 - -i
Hyunsun Moon33d85312020-08-20 00:55:31 -0700147 - {{ index $accessConfig "ifname" }}
148 - {{ index $coreConfig "ifname" }}
Hyunsun Moon918f26b2020-06-11 13:16:39 -0700149 {{- if .Values.resources.enabled }}
150 resources:
151{{ toYaml .Values.resources.routectl | indent 10 }}
152 {{- end }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700153 - name: web
154 image: {{ .Values.images.tags.bess | quote }}
155 imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
156 command: ["/bin/bash", "-xc", "bessctl http 0.0.0.0 8000"]
157 {{- if .Values.resources.enabled }}
158 resources:
159{{ toYaml .Values.resources.web | indent 10 }}
160 {{- end }}
161 - name: cpiface
Hyunsun Moond60fcaf2020-07-14 16:09:13 -0700162 image: {{ .Values.images.tags.pfcpiface | quote }}
163 imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
164 command: ["pfcpiface"]
165 args:
166 - -config
167 - /tmp/conf/upf.json
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700168 {{- if .Values.resources.enabled }}
169 resources:
170{{ toYaml .Values.resources.cpiface | indent 10 }}
171 {{- end }}
Hyunsun Moond60fcaf2020-07-14 16:09:13 -0700172 volumeMounts:
badhri85907510f2021-05-27 10:43:02 -0600173 - name: shared-app
174 mountPath: /pod-share
Hyunsun Moond60fcaf2020-07-14 16:09:13 -0700175 - name: configs
176 mountPath: /tmp/conf
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700177 volumes:
178 - name: configs
179 configMap:
Hyunsun Moon33d85312020-08-20 00:55:31 -0700180 name: upf
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700181 defaultMode: 493
badhri85907510f2021-05-27 10:43:02 -0600182 - name: shared-app
183 emptyDir: {}
Hyunsun Moon33d85312020-08-20 00:55:31 -0700184 {{- if .Values.config.upf.hugepage.enabled }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700185 - name: hugepages
186 emptyDir:
187 medium: HugePages
Hyunsun Moon617dc052020-06-21 20:13:22 -0500188 {{- end }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700189 {{- if .Values.config.coreDump.enabled }}
190 - name: host-rootfs
191 hostPath:
192 path: /
193 - name: coredump
194 hostPath:
195 path: {{ .Values.config.coreDump.path }}
196 {{- end }}