blob: cb89df53cb4bcbe4e045f620e4a52c6fb5f05e1c [file] [log] [blame]
Badhrinath Pa3a3088a2020-07-28 18:37:16 -07001{{/*
2# Copyright 2018-present Open Networking Foundation
3# Copyright 2018 Intel Corporation
4
5# SPDX-License-Identifier: Apache-2.0
6# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
7*/}}
8---
9apiVersion: apps/v1
10kind: StatefulSet
11metadata:
12 name: pfcp-agent
13 serviceName: pfcp-headless
14 labels:
15{{ tuple "pfcp-agent" . | include "omec-pfcp-agent.metadata_labels" | indent 4 }}
16spec:
17 replicas: 1
18 selector:
19 matchLabels:
20{{ tuple "pfcp-agent" . | include "omec-pfcp-agent.metadata_labels" | indent 6 }}
21 template:
22 metadata:
23 labels:
24{{ tuple "pfcp-agent" . | include "omec-pfcp-agent.metadata_labels" | indent 8 }}
25 annotations:
26 k8s.v1.cni.cncf.io/networks: '[
27 {
28 "name": "s1u-net",
29 "interface": {{ .Values.config.pfcpAgent.s1u.device | quote }},
30 "ips": {{ .Values.config.pfcpAgent.s1u.ip | quote }}
31 },
32 {
33 "name": "sgi-net",
34 "interface": {{ .Values.config.pfcpAgent.sgi.device | quote }},
35 "ips": {{ .Values.config.pfcpAgent.sgi.ip | quote }}
36 }
37 ]'
38 spec:
39 {{- if .Values.nodeSelectors.enabled }}
40 nodeSelector:
41 {{ .Values.nodeSelectors.pfcpAgent.label }}: {{ .Values.nodeSelectors.pfcpAgent.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 "pfcp-agent" . | include "omec-pfcp-agent.coredump_init" | indent 8 }}
71 {{- end }}
72 containers:
73 - name: pfcp-agent
74 image: {{ .Values.images.tags.pfcpAgent | 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: pfcp-agent
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.pfcpAgent.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.pfcpAgent.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.pfcpAgent.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: pfcp-agent
134 defaultMode: 493
135 - name: dp-config
136 configMap:
137 name: pfcp-agent
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 }}