blob: 64e123dce86690eca6477e3d39eef0c609fffe80 [file] [log] [blame]
Hyunsun Moon6ff622e2020-03-11 17:14:48 -07001{{/*
2Copyright 2020-present Open Networking Foundation
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/}}
16
17---
18apiVersion: apps/v1
19kind: StatefulSet
20metadata:
21 name: spgwu
22 serviceName: spgwu-headless
23 labels:
24{{ tuple "spgwu" . | include "omec-user-plane.metadata_labels" | indent 4 }}
25spec:
26 replicas: 1
27 selector:
28 matchLabels:
29{{ tuple "spgwu" . | include "omec-user-plane.metadata_labels" | indent 6 }}
30 template:
31 metadata:
32 labels:
33{{ tuple "spgwu" . | include "omec-user-plane.metadata_labels" | indent 8 }}
34 annotations:
35 k8s.v1.cni.cncf.io/networks: '[
36 {
37 "name": "s1u-net",
38 "interface": {{ .Values.config.spgwu.s1u.device | quote }},
39 "ips": {{ .Values.config.spgwu.s1u.ip | quote }}
40 },
41 {
42 "name": "sgi-net",
43 "interface": {{ .Values.config.spgwu.sgi.device | quote }},
44 "ips": {{ .Values.config.spgwu.sgi.ip | quote }}
45 }
46 ]'
47 spec:
48 shareProcessNamespace: true
49 {{- if .Values.nodeSelectors.enabled }}
50 nodeSelector:
51 {{ .Values.nodeSelectors.spgwu.label }}: {{ .Values.nodeSelectors.spgwu.value }}
52 {{- end }}
53 {{- if .Values.config.coreDump.enabled }}
54{{ tuple "spgwu" . | include "omec-user-plane.coredump_init" | indent 8 }}
55 {{- end }}
56 containers:
57 - name: routectl
58 image: {{ .Values.images.tags.bess | quote }}
59 imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
60 env:
61 - name: PYTHONUNBUFFERED
62 value: "1"
63 command: ["/bin/conf/route_control.py"]
64 args:
65 - -i
66 - {{ .Values.config.spgwu.s1u.device }}
67 - {{ .Values.config.spgwu.sgi.device }}
68 {{- if .Values.resources.enabled }}
69 resources:
70{{ toYaml .Values.resources.routectl | indent 10 }}
71 {{- end }}
72 volumeMounts:
73 - name: scripts
74 mountPath: /bin/conf
75 - name: bessd
76 image: {{ .Values.images.tags.bess | quote }}
77 imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
78 securityContext:
79 privileged: true
80 capabilities:
81 add:
82 - IPC_LOCK
83 - NET_ADMIN
84 stdin: true
85 tty: true
86 command: ["/bin/bash", "-xc", "bessd -f -grpc-url=0.0.0.0:10514;"]
87 lifecycle:
88 postStart:
89 exec:
90 command: ["/bin/conf/bessd-poststart.sh"]
91 livenessProbe:
92 tcpSocket:
93 port: 10514
94 initialDelaySeconds: 15
95 periodSeconds: 20
96 resources:
97 requests:
98 {{- if .Values.resources.enabled }}
99{{ toYaml .Values.resources.bess.requests | indent 12 }}
100 {{- end }}
101 {{- if .Values.networks.sriov.enabled }}
102 intel.com/sriov_vfio_s1u_net: 1
103 intel.com/sriov_vfio_sgi_net: 1
104 {{- end }}
105 limits:
106 {{- if .Values.resources.enabled }}
107{{ toYaml .Values.resources.bess.limits | indent 12 }}
108 {{- end }}
109 {{- if .Values.networks.sriov.enabled }}
110 intel.com/sriov_vfio_s1u_net: 1
111 intel.com/sriov_vfio_sgi_net: 1
112 {{- end }}
113 volumeMounts:
114 - name: hugepages
115 mountPath: /dev/hugepages
116 - name: configs
117 mountPath: /opt/bess/bessctl/conf
118 - name: scripts
119 mountPath: /bin/conf
120 {{- if .Values.config.coreDump.enabled }}
121 - name: coredump
122 mountPath: /tmp/coredump
123 {{- end }}
124 - name: web
125 image: {{ .Values.images.tags.bess | quote }}
126 imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
127 command: ["/bin/bash", "-xc", "bessctl http 0.0.0.0 8000"]
128 {{- if .Values.resources.enabled }}
129 resources:
130{{ toYaml .Values.resources.web | indent 10 }}
131 {{- end }}
132 volumeMounts:
133 - name: configs
134 mountPath: /opt/bess/bessctl/conf
135 - name: scripts
136 mountPath: /bin/conf
137 - name: cpiface
138 image: {{ .Values.images.tags.cpiface | quote }}
139 imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
140 env:
141 - name: ZMQD_IP
142 valueFrom:
143 fieldRef:
144 fieldPath: status.podIP
145 - name: GLOG_v
146 value: "1"
147 command: ["zmq-cpiface"]
148 args:
149 - --hostname
150 - {{ .Values.config.spgwu.name | quote }}
151 - --zmqd_nb_ip
152 - {{ .Values.config.spgwu.zmq.spgwc.addr | quote }}
153 - --zmqd_nb_port
154 - {{ .Values.config.spgwu.zmq.spgwc.port | quote }}
155 - --zmqd_recv_port
156 - {{ .Values.config.spgwu.zmq.recvPort | quote }}
157 - --zmqd_ip
158 - $(ZMQD_IP)
159 - --s1u_sgw_ip
160 - {{ (split "/" .Values.config.spgwu.s1u.ip)._0 | quote }}
161 {{- if .Values.resources.enabled }}
162 resources:
163{{ toYaml .Values.resources.cpiface | indent 10 }}
164 {{- end }}
165 volumes:
166 - name: configs
167 configMap:
168 name: spgwu
169 defaultMode: 420
170 - name: scripts
171 configMap:
172 name: spgwu
173 defaultMode: 493
174 - name: hugepages
175 emptyDir:
176 medium: HugePages
177 {{- if .Values.config.coreDump.enabled }}
178 - name: host-rootfs
179 hostPath:
180 path: /
181 - name: coredump
182 hostPath:
183 path: {{ .Values.config.coreDump.path }}
184 {{- end }}