forked from omec-project/upf
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathupf-k8s.yaml
More file actions
193 lines (192 loc) · 4.38 KB
/
Copy pathupf-k8s.yaml
File metadata and controls
193 lines (192 loc) · 4.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# SPDX-License-Identifier: Apache-2.0
# Copyright 2019 Intel Corporation
# Copyright 2020 Open Networking Foundation
---
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: access-net
annotations:
k8s.v1.cni.cncf.io/resourceName: intel.com/sriov_vfio_access_net
spec:
config: '{
"cniVersion": "0.3.1",
"type": "vfioveth",
"name": "access-net",
"ipam": {
"type": "host-local",
"subnet": "198.18.0.0/24",
"rangeStart": "198.18.0.2",
"rangeEnd": "198.18.0.250",
"gateway": "198.18.0.1"
}
}'
---
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: core-net
annotations:
k8s.v1.cni.cncf.io/resourceName: intel.com/sriov_vfio_core_net
spec:
config: '{
"cniVersion": "0.3.1",
"type": "vfioveth",
"name": "core-net",
"ipam": {
"type": "host-local",
"subnet": "198.19.0.0/24",
"rangeStart": "198.19.0.2",
"rangeEnd": "198.19.0.250",
"gateway": "198.19.0.1"
}
}'
---
apiVersion: v1
kind: ConfigMap
metadata:
name: upf-conf
data:
upf.json: |
{
"access": {
"ifname": "access"
},
"core": {
"ifname": "core"
},
"measure_upf": true,
"workers": "1",
"cpiface": {
"dnn": "internet"
}
}
---
apiVersion: v1
kind: Pod
metadata:
name: upf
labels:
app: upf
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "8080"
k8s.v1.cni.cncf.io/networks: '[
{ "name": "access-net", "interface": "access" },
{ "name": "core-net", "interface": "core" }
]'
spec:
shareProcessNamespace: true
initContainers:
# Currently CNI doesn't allow metric we're doing it here instead of net-attach-def
- name: routes
image: omecproject/upf-epc-bess:master-latest
env:
- name: ENB_SUBNET
value: '11.1.1.128/25'
- name: S1U_GATEWAY
value: '198.18.0.1'
- name: SGI_GATEWAY
value: '198.19.0.1'
command: ["sh", "-xec"]
args:
- ip route add $ENB_SUBNET via $S1U_GATEWAY;
ip route add default via $SGI_GATEWAY metric 110;
securityContext:
capabilities:
add:
- NET_ADMIN
# Reqd. if working with AF_PACKET so that kernel does not reply to GTP-U packets
#- name: iptables
# image: omecproject/upf-epc-bess:master-latest
# command: [ "sh", "-xec"]
# args:
# - iptables -I OUTPUT -p icmp --icmp-type port-unreachable -j DROP;
# securityContext:
# capabilities:
# add:
# - NET_ADMIN
containers:
- name: routectl
image: omecproject/upf-epc-bess:master-latest
command: ["/opt/bess/bessctl/conf/route_control.py"]
args:
- -i
- access
- core
env:
- name: PYTHONUNBUFFERED
value: "1"
resources:
limits:
cpu: 256m
memory: 128Mi
- name: bessd
image: omecproject/upf-epc-bess:master-latest
stdin: true
tty: true
args:
- -grpc-url=0.0.0.0:10514
env:
- name: CONF_FILE
value: /conf/upf.json
livenessProbe:
tcpSocket:
port: 10514
initialDelaySeconds: 30
periodSeconds: 20
lifecycle:
postStart:
exec:
command: ["sh", "-c", "until ss | grep -q 10514; do sleep 5; echo waiting for bessd; done; ./bessctl run up4;"]
securityContext:
capabilities:
add:
- IPC_LOCK # AF_PACKET vdev (and 4K pages) uses mmap
resources:
limits:
hugepages-1Gi: 2Gi
cpu: 2
memory: 256Mi
intel.com/sriov_vfio_access_net: '1'
intel.com/sriov_vfio_core_net: '1'
volumeMounts:
- name: upf-conf
mountPath: /conf
- name: hugepages
mountPath: /dev/hugepages
- name: web
image: omecproject/upf-epc-bess:master-latest
command: ["bessctl"]
args:
- http
- 0.0.0.0
- '8000'
resources:
limits:
cpu: 256m
memory: 128Mi
- name: pfcpiface
image: omecproject/upf-epc-pfcpiface:master-latest
command: ["pfcpiface"]
args:
- -config
- /conf/upf.json
volumeMounts:
- name: upf-conf
mountPath: /conf
ports:
- name: http
containerPort: 8080
protocol: TCP
resources:
limits:
cpu: 256m
memory: 128Mi
volumes:
- name: upf-conf
configMap:
name: upf-conf
- name: hugepages
emptyDir:
medium: HugePages