blob: f17b60d6484af2d3019b158af85a4551153d164f [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 }},
32 "ips": {{ .Values.config.upf.access.ip | quote }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -070033 },
34 {
Hyunsun Moon33d85312020-08-20 00:55:31 -070035 "name": "core-net",
36 "interface": {{ index $coreConfig "ifname" | quote }},
37 "ips": {{ .Values.config.upf.core.ip | quote }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -070038 }
39 ]'
40 spec:
41 shareProcessNamespace: true
42 {{- if .Values.nodeSelectors.enabled }}
43 nodeSelector:
Hyunsun Moon33d85312020-08-20 00:55:31 -070044 {{ .Values.nodeSelectors.upf.label }}: {{ .Values.nodeSelectors.upf.value }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -070045 {{- end }}
Hyunsun Moon918f26b2020-06-11 13:16:39 -070046 initContainers:
47 - name: bess-init
48 image: {{ .Values.images.tags.bess | quote }}
49 imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
50 command: ["sh", "-xec"]
51 args:
Hyunsun Moon33d85312020-08-20 00:55:31 -070052 - ip route replace {{ .Values.config.upf.enb.subnet }} via {{ .Values.config.upf.access.gateway }};
53 ip route replace default via {{ .Values.config.upf.core.gateway }} metric 110;
Hyunsun Moon617dc052020-06-21 20:13:22 -050054 iptables -I OUTPUT -p icmp --icmp-type port-unreachable -j DROP;
Hyunsun Moon918f26b2020-06-11 13:16:39 -070055 securityContext:
56 capabilities:
57 add:
58 - NET_ADMIN
Jeremy Ronquillo223db002020-06-05 10:28:22 -070059 {{- if .Values.config.coreDump.enabled }}
Hyunsun Moon33d85312020-08-20 00:55:31 -070060{{ tuple "upf" . | include "omec-user-plane.coredump_init" | indent 8 }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -070061 {{- end }}
62 containers:
Jeremy Ronquillo223db002020-06-05 10:28:22 -070063 - name: bessd
64 image: {{ .Values.images.tags.bess | quote }}
65 imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
66 securityContext:
Jeremy Ronquillo223db002020-06-05 10:28:22 -070067 capabilities:
68 add:
69 - IPC_LOCK
Jeremy Ronquillo223db002020-06-05 10:28:22 -070070 stdin: true
71 tty: true
Hyunsun Moon617dc052020-06-21 20:13:22 -050072 command: ["/bin/bash", "-xc"]
73 args:
Hyunsun Moon33d85312020-08-20 00:55:31 -070074 {{- if .Values.config.upf.hugepage.enabled }}
Hyunsun Moon617dc052020-06-21 20:13:22 -050075 - bessd -f -grpc-url=0.0.0.0:10514
76 {{- else }}
77 - bessd -m 0 -f -grpc-url=0.0.0.0:10514
78 {{- end }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -070079 lifecycle:
80 postStart:
81 exec:
82 command: ["/etc/bess/conf/bessd-poststart.sh"]
83 livenessProbe:
84 tcpSocket:
85 port: 10514
86 initialDelaySeconds: 15
87 periodSeconds: 20
88 resources:
89 requests:
90 {{- if .Values.resources.enabled }}
91{{ toYaml .Values.resources.bess.requests | indent 12 }}
92 {{- end }}
Hyunsun Moon33d85312020-08-20 00:55:31 -070093 {{- if .Values.config.upf.hugepage.enabled }}
Hyunsun Moon617dc052020-06-21 20:13:22 -050094 hugepages-1Gi: 2Gi
95 {{- end }}
Hyunsun Moon33d85312020-08-20 00:55:31 -070096 {{- if .Values.config.upf.sriov.enabled }}
97 intel.com/sriov_vfio_access_net: 1
98 intel.com/sriov_vfio_core_net: 1
Jeremy Ronquillo223db002020-06-05 10:28:22 -070099 {{- end }}
100 limits:
101 {{- if .Values.resources.enabled }}
102{{ toYaml .Values.resources.bess.limits | indent 12 }}
103 {{- end }}
Hyunsun Moon33d85312020-08-20 00:55:31 -0700104 {{- if .Values.config.upf.hugepage.enabled }}
Hyunsun Moon617dc052020-06-21 20:13:22 -0500105 hugepages-1Gi: 2Gi
106 {{- end }}
Hyunsun Moon33d85312020-08-20 00:55:31 -0700107 {{- if .Values.config.upf.sriov.enabled }}
108 intel.com/sriov_vfio_access_net: 1
109 intel.com/sriov_vfio_core_net: 1
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700110 {{- end }}
111 env:
112 - name: CONF_FILE
Hyunsun Moond60fcaf2020-07-14 16:09:13 -0700113 value: /etc/bess/conf/upf.json
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700114 volumeMounts:
Hyunsun Moon33d85312020-08-20 00:55:31 -0700115 {{- if .Values.config.upf.hugepage.enabled }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700116 - name: hugepages
117 mountPath: /dev/hugepages
Hyunsun Moon617dc052020-06-21 20:13:22 -0500118 {{- end }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700119 - name: configs
120 mountPath: /etc/bess/conf
121 {{- if .Values.config.coreDump.enabled }}
122 - name: coredump
123 mountPath: /tmp/coredump
124 {{- end }}
Hyunsun Moon918f26b2020-06-11 13:16:39 -0700125 - name: routectl
126 image: {{ .Values.images.tags.bess | quote }}
127 imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
128 env:
129 - name: PYTHONUNBUFFERED
130 value: "1"
131 command: ["/opt/bess/bessctl/conf/route_control.py"]
132 args:
133 - -i
Hyunsun Moon33d85312020-08-20 00:55:31 -0700134 - {{ index $accessConfig "ifname" }}
135 - {{ index $coreConfig "ifname" }}
Hyunsun Moon918f26b2020-06-11 13:16:39 -0700136 {{- if .Values.resources.enabled }}
137 resources:
138{{ toYaml .Values.resources.routectl | indent 10 }}
139 {{- end }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700140 - name: web
141 image: {{ .Values.images.tags.bess | quote }}
142 imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
143 command: ["/bin/bash", "-xc", "bessctl http 0.0.0.0 8000"]
144 {{- if .Values.resources.enabled }}
145 resources:
146{{ toYaml .Values.resources.web | indent 10 }}
147 {{- end }}
148 - name: cpiface
Hyunsun Moon33d85312020-08-20 00:55:31 -0700149 {{- if eq .Values.config.upf.cpiface.mode "zmq" }}
Hyunsun Moond60fcaf2020-07-14 16:09:13 -0700150 image: {{ .Values.images.tags.zmqiface | quote }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700151 imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
152 env:
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700153 - name: GLOG_v
154 value: "1"
155 command: ["zmq-cpiface"]
156 args:
Hyunsun Moond60fcaf2020-07-14 16:09:13 -0700157 - --json_config
158 - /tmp/conf/upf.json
159 {{- else }}
160 image: {{ .Values.images.tags.pfcpiface | quote }}
161 imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
162 command: ["pfcpiface"]
163 args:
164 - -config
165 - /tmp/conf/upf.json
166 {{- end }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700167 {{- if .Values.resources.enabled }}
168 resources:
169{{ toYaml .Values.resources.cpiface | indent 10 }}
170 {{- end }}
Hyunsun Moond60fcaf2020-07-14 16:09:13 -0700171 volumeMounts:
172 - name: configs
173 mountPath: /tmp/conf
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700174 volumes:
175 - name: configs
176 configMap:
Hyunsun Moon33d85312020-08-20 00:55:31 -0700177 name: upf
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700178 defaultMode: 493
Hyunsun Moon33d85312020-08-20 00:55:31 -0700179 {{- if .Values.config.upf.hugepage.enabled }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700180 - name: hugepages
181 emptyDir:
182 medium: HugePages
Hyunsun Moon617dc052020-06-21 20:13:22 -0500183 {{- end }}
Jeremy Ronquillo223db002020-06-05 10:28:22 -0700184 {{- if .Values.config.coreDump.enabled }}
185 - name: host-rootfs
186 hostPath:
187 path: /
188 - name: coredump
189 hostPath:
190 path: {{ .Values.config.coreDump.path }}
191 {{- end }}