blob: 11749e78500185d0946b4cda780e01b237ca97b6 [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 Moona24d3f92019-06-19 03:04:58 -050022 labels:
Hyunsun Moon7a007bb2019-08-19 16:41:36 -060023{{ tuple "spgwu" . | include "omec-data-plane.metadata_labels" | indent 4 }}
Hyunsun Moona24d3f92019-06-19 03:04:58 -050024spec:
25 replicas: 1
26 selector:
27 matchLabels:
Hyunsun Moon7a007bb2019-08-19 16:41:36 -060028{{ tuple "spgwu" . | include "omec-data-plane.metadata_labels" | indent 6 }}
Hyunsun Moona24d3f92019-06-19 03:04:58 -050029 template:
30 metadata:
31 labels:
Hyunsun Moon7a007bb2019-08-19 16:41:36 -060032{{ tuple "spgwu" . | include "omec-data-plane.metadata_labels" | indent 8 }}
Hyunsun Moona24d3f92019-06-19 03:04:58 -050033 annotations:
34 k8s.v1.cni.cncf.io/networks: '[
Hyunsun Moon7a921d12019-08-21 20:52:09 -050035 {
36 "name": "s1u-net",
37 "interface": {{ .Values.config.spgwu.s1u.device | quote }},
38 "ips": {{ .Values.config.spgwu.s1u.ip | quote }}
39 },
40 {
41 "name": "sgi-net",
42 "interface": {{ .Values.config.spgwu.sgi.device | quote }},
43 "ips": {{ .Values.config.spgwu.sgi.ip | quote }}
44 }
Hyunsun Moona24d3f92019-06-19 03:04:58 -050045 ]'
46 spec:
Hyunsun Moon06f98552019-08-15 13:44:47 -060047 {{- if .Values.nodeSelectors.enabled }}
Woojoong Kim314d57c2019-07-09 17:08:11 -070048 nodeSelector:
Hyunsun Moon06f98552019-08-15 13:44:47 -060049 {{ .Values.nodeSelectors.spgwu.label }}: {{ .Values.nodeSelectors.spgwu.value }}
50 {{- end }}
Hyunsun Moon7a007bb2019-08-19 16:41:36 -060051 {{- if not .Values.config.sriov.enabled }}
Hyunsun Moona24d3f92019-06-19 03:04:58 -050052 initContainers:
53 - name: spgwu-iptables-init
Hyunsun Moon06f98552019-08-15 13:44:47 -060054 image: {{ .Values.images.tags.init | quote }}
55 imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
Hyunsun Moona24d3f92019-06-19 03:04:58 -050056 command: [ "sh", "-xec"]
57 securityContext:
58 capabilities:
59 add:
60 - NET_ADMIN
61 args:
62 - iptables -I OUTPUT -p icmp --icmp-type destination-unreachable -j DROP;
63 - name: spgwu-af-iface-init
Hyunsun Moon06f98552019-08-15 13:44:47 -060064 image: {{ .Values.images.tags.init | quote }}
65 imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
Hyunsun Moona24d3f92019-06-19 03:04:58 -050066 securityContext:
67 capabilities:
68 add:
69 - NET_ADMIN
70 command:
71 - /opt/dp/scripts/setup-af-iface.sh
72 volumeMounts:
73 - name: dp-script
74 mountPath: /opt/dp/scripts/setup-af-iface.sh
75 subPath: setup-af-iface.sh
Hyunsun Moon06f98552019-08-15 13:44:47 -060076 {{- end }}
Hyunsun Moona24d3f92019-06-19 03:04:58 -050077 containers:
Hyunsun Moon06f98552019-08-15 13:44:47 -060078 - name: spgwu
79 image: {{ .Values.images.tags.spgwu | quote }}
80 imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
Hyunsun Moona24d3f92019-06-19 03:04:58 -050081 stdin: true
82 tty: true
83 env:
84 - name: MEM_LIMIT
85 valueFrom:
86 resourceFieldRef:
Hyunsun Moon06f98552019-08-15 13:44:47 -060087 containerName: spgwu
Hyunsun Moona24d3f92019-06-19 03:04:58 -050088 resource: limits.memory
89 divisor: 1Mi
Hyunsun Moonc4a7d542019-08-22 18:53:40 -050090 - name: POD_IP
Hyunsun Moona24d3f92019-06-19 03:04:58 -050091 valueFrom:
92 fieldRef:
93 fieldPath: status.podIP
Hyunsun Moona24d3f92019-06-19 03:04:58 -050094 command: ["bash", "-xc"]
95 args:
96 - ip a;
Hyunsun Moon06f98552019-08-15 13:44:47 -060097 /opt/dp/scripts/run.sh;
Hyunsun Moona24d3f92019-06-19 03:04:58 -050098 volumeMounts:
99 - name: dp-script
Hyunsun Moon06f98552019-08-15 13:44:47 -0600100 mountPath: /opt/dp/scripts/run.sh
101 subPath: run.sh
Hyunsun Moona24d3f92019-06-19 03:04:58 -0500102 - name: dp-config
103 mountPath: /etc/dp/config
Hyunsun Moona24d3f92019-06-19 03:04:58 -0500104 resources:
Hyunsun Moon06f98552019-08-15 13:44:47 -0600105 requests:
106 {{- if .Values.resources.enabled }}
107{{ toYaml .Values.resources.spgwu.requests | indent 12 }}
108 {{- end }}
Hyunsun Moon7a007bb2019-08-19 16:41:36 -0600109 {{- if .Values.config.sriov.enabled }}
Woojoong Kime455aab2019-07-12 10:53:43 -0700110 intel.com/sriov_vfio: 2
Hyunsun Moon06f98552019-08-15 13:44:47 -0600111 {{- end }}
112 limits:
113 {{- if .Values.resources.enabled }}
114{{ toYaml .Values.resources.spgwu.limits | indent 12 }}
115 {{- end }}
Hyunsun Moon7a007bb2019-08-19 16:41:36 -0600116 {{- if .Values.config.sriov.enabled }}
Hyunsun Moon06f98552019-08-15 13:44:47 -0600117 intel.com/sriov_vfio: 2
118 {{- end }}
Hyunsun Moona24d3f92019-06-19 03:04:58 -0500119 securityContext:
120 capabilities:
121 add:
122 - IPC_LOCK
123 volumes:
124 - name: dp-script
125 configMap:
Hyunsun Moon06f98552019-08-15 13:44:47 -0600126 name: spgwu
Hyunsun Moona24d3f92019-06-19 03:04:58 -0500127 defaultMode: 493
128 - name: dp-config
129 configMap:
Hyunsun Moon06f98552019-08-15 13:44:47 -0600130 name: spgwu
Hyunsun Moona24d3f92019-06-19 03:04:58 -0500131 defaultMode: 420