-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupf.yaml
123 lines (123 loc) · 3.95 KB
/
upf.yaml
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
apiVersion: kubevirt.io/v1alpha3
kind: VirtualMachine
metadata:
name: upf
spec:
running: true
template:
metadata:
labels:
kubevirt.io/name: f5xc-vm
vmi: upf
spec:
domain:
cpu:
sockets: 1
cores: 2
memory:
guest: "2G"
devices:
autoattachPodInterface: true # true by default, explicitly setting for clarity
disks:
- name: bootdisk
disk:
bus: virtio
- name: cloud-init
disk:
bus: virtio
- name: upf-cfg
serial: upfconfigmap
interfaces:
- name: default
bridge: {}
- name: multus-n3
bridge: {}
- name: multus-n6
bridge: {}
terminationGracePeriodSeconds: 0
networks:
- name: default
pod: {}
- multus:
networkName: upf-n3
name: multus-n3
- multus:
networkName: upf-n6
name: multus-n6
volumes:
- name: bootdisk
containerDisk:
image: mcas/kubevirt-ubuntu-20.04:latest
- name: cloud-init
cloudInitNoCloud:
userData: |-
#cloud-config
password: ubuntu
chpasswd: { expire: False }
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8w6XIlwkNCMQgYy2xxRII7mHGYdpBfA/AqidcbKNv74NOMsyoXGF6TcJytCYd3XX+g5HvYFqXiK94YjrlIGMixfc12IEkX1ANMyF/B4UNHGMNCoCWF7qcjDLESk3aVDP5HtDpuxfKHkYtm68VERlluTLqnwaDUcniaZ//p7UjN3lVoKKUoShBuiDoG2YZkfnDTCohHN2ZNPsydg+NBdg6lM5GhgQfKDDKqOzD/CjhPQeKoiOJFm1ObnjbDAXA0yYfVR8W0fxxXel6Pe70TrcoUxZKzYZG8vsy2zEZc7vdRhlzLlIIN9TvjR3EwmB3GlevGfh726WAj3bV/fuPpQof [email protected]
bootcmd:
# Mount the ConfigMap
- "sudo mkdir /tmp/upfcfg"
- "sudo mount /dev/disk/by-id/ata-QEMU_HARDDISK_upfconfigmap /tmp/upfcfg"
package_update: true
packages:
- git
- gcc
- g++
- cmake
- autoconf
- libtool
- pkg-config
- libmnl-dev
- libyaml-dev
snap:
commands:
00: snap install go --classic --channel=1.18/stable
runcmd:
- sysctl -w net.ipv4.ip_forward=1 ; iptables -t nat -A POSTROUTING -o enp1s0 -j MASQUERADE ; iptables -A FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --set-mss 1400 ; systemctl stop ufw
- cd /opt ; git clone -b v0.8.2 https://github.com/free5gc/gtp5g.git ; cd gtp5g ; make ; make install
- cd /opt ; git clone --recursive -b v3.3.0 -j `nproc` https://github.com/free5gc/free5gc.git ; cd free5gc ; su root -c 'make upf'
- cp /tmp/upfcfg/upfcfg.yaml /etc/upfcfg.yaml
- a=$(ip addr show dev enp1s0 | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/') ; sed -i "s/tobereplaced/$a/" /etc/upfcfg.yaml
- /opt/free5gc/bin/upf -c /etc/upfcfg.yaml &
networkData: |
network:
version: 1
config:
- type: physical
name: enp1s0
subnets:
- type: dhcp
- type: physical
name: enp2s0
subnets:
- type: dhcp
- type: physical
name: enp3s0
subnets:
- type: dhcp
- name: upf-cfg
configMap:
name: upf-configmap
---
apiVersion: v1
kind: Service
metadata:
name: upf-service #make sure smf point to right service name in their configmap file
spec:
ports:
- port: 22
name: ssh
protocol: TCP
targetPort: 22
- port: 80
name: http
protocol: TCP
targetPort: 80
- port: 8805
name: pfcp
protocol: UDP
targetPort: 8805
selector:
vmi: upf