blob: 5518f2dfc298cfae3d8bbbe9042378a3a03284f5 [file] [log] [blame]
Jeremy Ronquillo223db002020-06-05 10:28:22 -07001{{/*
Jeremy Ronquilloec2d3e42020-06-05 11:33:39 -07002# Copyright 2018-present Open Networking Foundation
3# Copyright 2018 Intel Corporation
Jeremy Ronquillo223db002020-06-05 10:28:22 -07004
Jeremy Ronquilloec2d3e42020-06-05 11:33:39 -07005# SPDX-License-Identifier: Apache-2.0
Jeremy Ronquillo6046ce32020-06-18 11:06:29 -07006# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
Jeremy Ronquillo223db002020-06-05 10:28:22 -07007*/}}
8---
9apiVersion: apps/v1
10kind: StatefulSet
11metadata:
12 name: spgwu
13 serviceName: spgwu-headless
14 labels:
15{{ tuple "spgwu" . | include "omec-data-plane.metadata_labels" | indent 4 }}
16spec:
17 replicas: 1
18 selector:
19 matchLabels:
20{{ tuple "spgwu" . | include "omec-data-plane.metadata_labels" | indent 6 }}
21 template:
22 metadata:
23 labels:
24{{ tuple "spgwu" . | include "omec-data-plane.metadata_labels" | indent 8 }}
25 annotations:
26 k8s.v1.cni.cncf.io/networks: '[
27 {
28 "name": "s1u-net",
29 "interface": {{ .Values.config.spgwu.s1u.device | quote }},
30 "ips": {{ .Values.config.spgwu.s1u.ip | quote }}
31 },
32 {
33 "name": "sgi-net",
34 "interface": {{ .Values.config.spgwu.sgi.device | quote }},
35 "ips": {{ .Values.config.spgwu.sgi.ip | quote }}
36 }
37 ]'
38 spec:
39 {{- if .Values.nodeSelectors.enabled }}
40 nodeSelector:
41 {{ .Values.nodeSelectors.spgwu.label }}: {{ .Values.nodeSelectors.spgwu.value }}
42 {{- end }}
43 {{- if not .Values.config.sriov.enabled }}
44 initContainers:
45 - name: spgwu-iptables-init
46 image: {{ .Values.images.tags.init | quote }}
47 imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
48 command: [ "sh", "-xec"]
49 securityContext:
50 capabilities:
51 add:
52 - NET_ADMIN
53 args:
54 - iptables -I OUTPUT -p icmp --icmp-type destination-unreachable -j DROP;
55 - name: spgwu-af-iface-init
56 image: {{ .Values.images.tags.init | quote }}
57 imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
58 securityContext:
59 capabilities:
60 add:
61 - NET_ADMIN
62 command:
63 - /opt/dp/scripts/setup-af-iface.sh
64 volumeMounts:
65 - name: dp-script
66 mountPath: /opt/dp/scripts/setup-af-iface.sh
67 subPath: setup-af-iface.sh
68 {{- end }}
69 {{- if .Values.config.coreDump.enabled }}
70{{ tuple "spgwc" . | include "omec-data-plane.coredump_init" | indent 8 }}
71 {{- end }}
72 containers:
73 - name: spgwu
74 image: {{ .Values.images.tags.spgwu | quote }}
75 imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
76 securityContext:
77 {{- if .Values.config.coreDump.enabled }}
78 privileged: true
79 runAsUser: 0
80 {{- end }}
81 capabilities:
82 add:
83 - IPC_LOCK
84 stdin: true
85 tty: true
86 env:
87 - name: MEM_LIMIT
88 valueFrom:
89 resourceFieldRef:
90 containerName: spgwu
91 resource: limits.memory
92 divisor: 1Mi
93 - name: POD_IP
94 valueFrom:
95 fieldRef:
96 fieldPath: status.podIP
97 - name: DP_NAME
98 value: "{{ .Values.config.spgwu.dpName }}"
99 command: ["bash", "-xc"]
100 args:
101 - ip a;
102 /opt/dp/scripts/run.sh;
103 volumeMounts:
104 - name: dp-script
105 mountPath: /opt/dp/scripts/run.sh
106 subPath: run.sh
107 - name: dp-config
108 mountPath: /etc/dp/config
109 {{- if .Values.config.coreDump.enabled }}
110 - name: coredump
111 mountPath: /tmp/coredump
112 {{- end }}
113 resources:
114 requests:
115 {{- if .Values.resources.enabled }}
116{{ toYaml .Values.resources.spgwu.requests | indent 12 }}
117 {{- end }}
118 {{- if .Values.config.sriov.enabled }}
119 intel.com/sriov_vfio_s1u_net: 1
120 intel.com/sriov_vfio_sgi_net: 1
121 {{- end }}
122 limits:
123 {{- if .Values.resources.enabled }}
124{{ toYaml .Values.resources.spgwu.limits | indent 12 }}
125 {{- end }}
126 {{- if .Values.config.sriov.enabled }}
127 intel.com/sriov_vfio_s1u_net: 1
128 intel.com/sriov_vfio_sgi_net: 1
129 {{- end }}
130 volumes:
131 - name: dp-script
132 configMap:
133 name: spgwu
134 defaultMode: 493
135 - name: dp-config
136 configMap:
137 name: spgwu
138 defaultMode: 420
139 {{- if .Values.config.coreDump.enabled }}
140 - name: host-rootfs
141 hostPath:
142 path: /
143 - name: coredump
144 hostPath:
145 path: {{ .Values.config.coreDump.path }}
146 {{- end }}