blob: f3452d49c80fbed2fa750dcdc26f7c13c6647591 [file] [log] [blame]
Hyunsun Moon06f98552019-08-15 13:44:47 -06001{{/*
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*/}}
Hyunsun Moona24d3f92019-06-19 03:04:58 -050017---
18apiVersion: apps/v1
19kind: StatefulSet
20metadata:
Hyunsun Moon06f98552019-08-15 13:44:47 -060021 name: spgwu
Hyunsun Moon834c28f2019-12-05 18:26:22 -080022 serviceName: spgwu-headless
Hyunsun Moona24d3f92019-06-19 03:04:58 -050023 labels:
Hyunsun Moon7a007bb2019-08-19 16:41:36 -060024{{ tuple "spgwu" . | include "omec-data-plane.metadata_labels" | indent 4 }}
Hyunsun Moona24d3f92019-06-19 03:04:58 -050025spec:
26 replicas: 1
27 selector:
28 matchLabels:
Hyunsun Moon7a007bb2019-08-19 16:41:36 -060029{{ tuple "spgwu" . | include "omec-data-plane.metadata_labels" | indent 6 }}
Hyunsun Moona24d3f92019-06-19 03:04:58 -050030 template:
31 metadata:
32 labels:
Hyunsun Moon7a007bb2019-08-19 16:41:36 -060033{{ tuple "spgwu" . | include "omec-data-plane.metadata_labels" | indent 8 }}
Hyunsun Moona24d3f92019-06-19 03:04:58 -050034 annotations:
35 k8s.v1.cni.cncf.io/networks: '[
Hyunsun Moon7a921d12019-08-21 20:52:09 -050036 {
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 }
Hyunsun Moona24d3f92019-06-19 03:04:58 -050046 ]'
47 spec:
Hyunsun Moon06f98552019-08-15 13:44:47 -060048 {{- if .Values.nodeSelectors.enabled }}
Woojoong Kim314d57c2019-07-09 17:08:11 -070049 nodeSelector:
Hyunsun Moon06f98552019-08-15 13:44:47 -060050 {{ .Values.nodeSelectors.spgwu.label }}: {{ .Values.nodeSelectors.spgwu.value }}
51 {{- end }}
Hyunsun Moon7a007bb2019-08-19 16:41:36 -060052 {{- if not .Values.config.sriov.enabled }}
Hyunsun Moona24d3f92019-06-19 03:04:58 -050053 initContainers:
54 - name: spgwu-iptables-init
Hyunsun Moon06f98552019-08-15 13:44:47 -060055 image: {{ .Values.images.tags.init | quote }}
56 imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
Hyunsun Moona24d3f92019-06-19 03:04:58 -050057 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
Hyunsun Moon06f98552019-08-15 13:44:47 -060065 image: {{ .Values.images.tags.init | quote }}
66 imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
Hyunsun Moona24d3f92019-06-19 03:04:58 -050067 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
Hyunsun Moon06f98552019-08-15 13:44:47 -060077 {{- end }}
Hyunsun Moonec0b44d2020-01-10 15:50:53 -070078 {{- if .Values.config.coreDump.enabled }}
79{{ tuple "spgwc" . | include "omec-data-plane.coredump_init" | indent 8 }}
80 {{- end }}
Hyunsun Moona24d3f92019-06-19 03:04:58 -050081 containers:
Hyunsun Moon06f98552019-08-15 13:44:47 -060082 - name: spgwu
83 image: {{ .Values.images.tags.spgwu | quote }}
84 imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
Hyunsun Moonec0b44d2020-01-10 15:50:53 -070085 securityContext:
86 {{- if .Values.config.coreDump.enabled }}
87 privileged: true
88 runAsUser: 0
89 {{- end }}
90 capabilities:
91 add:
92 - IPC_LOCK
Hyunsun Moona24d3f92019-06-19 03:04:58 -050093 stdin: true
94 tty: true
95 env:
96 - name: MEM_LIMIT
97 valueFrom:
98 resourceFieldRef:
Hyunsun Moon06f98552019-08-15 13:44:47 -060099 containerName: spgwu
Hyunsun Moona24d3f92019-06-19 03:04:58 -0500100 resource: limits.memory
101 divisor: 1Mi
Hyunsun Moonc4a7d542019-08-22 18:53:40 -0500102 - name: POD_IP
Hyunsun Moona24d3f92019-06-19 03:04:58 -0500103 valueFrom:
104 fieldRef:
105 fieldPath: status.podIP
Woojoong Kim4866d752019-12-17 16:32:23 -0800106 - name: DP_NAME
107 value: "{{ .Values.config.spgwu.dpName }}"
Hyunsun Moona24d3f92019-06-19 03:04:58 -0500108 command: ["bash", "-xc"]
109 args:
110 - ip a;
Hyunsun Moon06f98552019-08-15 13:44:47 -0600111 /opt/dp/scripts/run.sh;
Hyunsun Moona24d3f92019-06-19 03:04:58 -0500112 volumeMounts:
113 - name: dp-script
Hyunsun Moon06f98552019-08-15 13:44:47 -0600114 mountPath: /opt/dp/scripts/run.sh
115 subPath: run.sh
Hyunsun Moona24d3f92019-06-19 03:04:58 -0500116 - name: dp-config
117 mountPath: /etc/dp/config
Hyunsun Moonec0b44d2020-01-10 15:50:53 -0700118 {{- if .Values.config.coreDump.enabled }}
119 - name: coredump
120 mountPath: /tmp/coredump
121 {{- end }}
Hyunsun Moona24d3f92019-06-19 03:04:58 -0500122 resources:
Hyunsun Moon06f98552019-08-15 13:44:47 -0600123 requests:
124 {{- if .Values.resources.enabled }}
125{{ toYaml .Values.resources.spgwu.requests | indent 12 }}
126 {{- end }}
Hyunsun Moon7a007bb2019-08-19 16:41:36 -0600127 {{- if .Values.config.sriov.enabled }}
Woojoong Kime455aab2019-07-12 10:53:43 -0700128 intel.com/sriov_vfio: 2
Hyunsun Moon06f98552019-08-15 13:44:47 -0600129 {{- end }}
130 limits:
131 {{- if .Values.resources.enabled }}
132{{ toYaml .Values.resources.spgwu.limits | indent 12 }}
133 {{- end }}
Hyunsun Moon7a007bb2019-08-19 16:41:36 -0600134 {{- if .Values.config.sriov.enabled }}
Hyunsun Moon06f98552019-08-15 13:44:47 -0600135 intel.com/sriov_vfio: 2
136 {{- end }}
Hyunsun Moona24d3f92019-06-19 03:04:58 -0500137 volumes:
138 - name: dp-script
139 configMap:
Hyunsun Moon06f98552019-08-15 13:44:47 -0600140 name: spgwu
Hyunsun Moona24d3f92019-06-19 03:04:58 -0500141 defaultMode: 493
142 - name: dp-config
143 configMap:
Hyunsun Moon06f98552019-08-15 13:44:47 -0600144 name: spgwu
Hyunsun Moona24d3f92019-06-19 03:04:58 -0500145 defaultMode: 420
Hyunsun Moonec0b44d2020-01-10 15:50:53 -0700146 {{- if .Values.config.coreDump.enabled }}
147 - name: host-rootfs
148 hostPath:
149 path: /
150 - name: coredump
151 hostPath:
152 path: {{ .Values.config.coreDump.path }}
153 {{- end }}