blob: 593f2d27ab17952bae5528cf6eef34da84a424a0 [file] [log] [blame]
Jeremy Ronquillo223db002020-06-05 10:28:22 -07001{{/*
2Copyright 2018-present Open Networking Foundation
3Copyright 2018 Intel Corporation
4
5Licensed under the Apache License, Version 2.0 (the "License");
6you may not use this file except in compliance with the License.
7You may obtain a copy of the License at
8
9http://www.apache.org/licenses/LICENSE-2.0
10
11Unless required by applicable law or agreed to in writing, software
12distributed under the License is distributed on an "AS IS" BASIS,
13WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14See the License for the specific language governing permissions and
15limitations under the License.
16*/}}
17---
18apiVersion: apps/v1
19kind: StatefulSet
20metadata:
21 name: spgwu
22 serviceName: spgwu-headless
23 labels:
24{{ tuple "spgwu" . | include "omec-data-plane.metadata_labels" | indent 4 }}
25spec:
26 replicas: 1
27 selector:
28 matchLabels:
29{{ tuple "spgwu" . | include "omec-data-plane.metadata_labels" | indent 6 }}
30 template:
31 metadata:
32 labels:
33{{ tuple "spgwu" . | include "omec-data-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 {{- if .Values.nodeSelectors.enabled }}
49 nodeSelector:
50 {{ .Values.nodeSelectors.spgwu.label }}: {{ .Values.nodeSelectors.spgwu.value }}
51 {{- end }}
52 {{- if not .Values.config.sriov.enabled }}
53 initContainers:
54 - name: spgwu-iptables-init
55 image: {{ .Values.images.tags.init | quote }}
56 imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
57 command: [ "sh", "-xec"]
58 securityContext:
59 capabilities:
60 add:
61 - NET_ADMIN
62 args:
63 - iptables -I OUTPUT -p icmp --icmp-type destination-unreachable -j DROP;
64 - name: spgwu-af-iface-init
65 image: {{ .Values.images.tags.init | quote }}
66 imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
67 securityContext:
68 capabilities:
69 add:
70 - NET_ADMIN
71 command:
72 - /opt/dp/scripts/setup-af-iface.sh
73 volumeMounts:
74 - name: dp-script
75 mountPath: /opt/dp/scripts/setup-af-iface.sh
76 subPath: setup-af-iface.sh
77 {{- end }}
78 {{- if .Values.config.coreDump.enabled }}
79{{ tuple "spgwc" . | include "omec-data-plane.coredump_init" | indent 8 }}
80 {{- end }}
81 containers:
82 - name: spgwu
83 image: {{ .Values.images.tags.spgwu | quote }}
84 imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
85 securityContext:
86 {{- if .Values.config.coreDump.enabled }}
87 privileged: true
88 runAsUser: 0
89 {{- end }}
90 capabilities:
91 add:
92 - IPC_LOCK
93 stdin: true
94 tty: true
95 env:
96 - name: MEM_LIMIT
97 valueFrom:
98 resourceFieldRef:
99 containerName: spgwu
100 resource: limits.memory
101 divisor: 1Mi
102 - name: POD_IP
103 valueFrom:
104 fieldRef:
105 fieldPath: status.podIP
106 - name: DP_NAME
107 value: "{{ .Values.config.spgwu.dpName }}"
108 command: ["bash", "-xc"]
109 args:
110 - ip a;
111 /opt/dp/scripts/run.sh;
112 volumeMounts:
113 - name: dp-script
114 mountPath: /opt/dp/scripts/run.sh
115 subPath: run.sh
116 - name: dp-config
117 mountPath: /etc/dp/config
118 {{- if .Values.config.coreDump.enabled }}
119 - name: coredump
120 mountPath: /tmp/coredump
121 {{- end }}
122 resources:
123 requests:
124 {{- if .Values.resources.enabled }}
125{{ toYaml .Values.resources.spgwu.requests | indent 12 }}
126 {{- end }}
127 {{- if .Values.config.sriov.enabled }}
128 intel.com/sriov_vfio_s1u_net: 1
129 intel.com/sriov_vfio_sgi_net: 1
130 {{- end }}
131 limits:
132 {{- if .Values.resources.enabled }}
133{{ toYaml .Values.resources.spgwu.limits | indent 12 }}
134 {{- end }}
135 {{- if .Values.config.sriov.enabled }}
136 intel.com/sriov_vfio_s1u_net: 1
137 intel.com/sriov_vfio_sgi_net: 1
138 {{- end }}
139 volumes:
140 - name: dp-script
141 configMap:
142 name: spgwu
143 defaultMode: 493
144 - name: dp-config
145 configMap:
146 name: spgwu
147 defaultMode: 420
148 {{- if .Values.config.coreDump.enabled }}
149 - name: host-rootfs
150 hostPath:
151 path: /
152 - name: coredump
153 hostPath:
154 path: {{ .Values.config.coreDump.path }}
155 {{- end }}