| {{/* |
| # Copyright 2020-present Open Networking Foundation |
| |
| # SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0 |
| */}} |
| |
| {{- $upfConfig := index .Values.config.spgwu.cfgFiles "upf.json" }} |
| {{- $s1uConfig := index $upfConfig "s1u" }} |
| {{- $sgiConfig := index $upfConfig "sgi" }} |
| --- |
| apiVersion: apps/v1 |
| kind: StatefulSet |
| metadata: |
| name: spgwu |
| labels: |
| {{ tuple "spgwu" . | include "omec-user-plane.metadata_labels" | indent 4 }} |
| spec: |
| replicas: 1 |
| serviceName: spgwu-headless |
| selector: |
| matchLabels: |
| {{ tuple "spgwu" . | include "omec-user-plane.metadata_labels" | indent 6 }} |
| template: |
| metadata: |
| labels: |
| {{ tuple "spgwu" . | include "omec-user-plane.metadata_labels" | indent 8 }} |
| annotations: |
| k8s.v1.cni.cncf.io/networks: '[ |
| { |
| "name": "s1u-net", |
| "interface": {{ index $s1uConfig "ifname" | quote }}, |
| "ips": {{ .Values.config.spgwu.s1u.ip | quote }} |
| }, |
| { |
| "name": "sgi-net", |
| "interface": {{ index $sgiConfig "ifname" | quote }}, |
| "ips": {{ .Values.config.spgwu.sgi.ip | quote }} |
| } |
| ]' |
| spec: |
| shareProcessNamespace: true |
| {{- if .Values.nodeSelectors.enabled }} |
| nodeSelector: |
| {{ .Values.nodeSelectors.spgwu.label }}: {{ .Values.nodeSelectors.spgwu.value }} |
| {{- end }} |
| initContainers: |
| - name: bess-init |
| image: {{ .Values.images.tags.bess | quote }} |
| imagePullPolicy: {{ .Values.images.pullPolicy | quote }} |
| command: ["sh", "-xec"] |
| args: |
| - ip route replace {{ .Values.config.spgwu.enb.subnet }} via {{ .Values.config.spgwu.s1u.gateway }}; |
| ip route replace default via {{ .Values.config.spgwu.sgi.gateway }} metric 110; |
| iptables -I OUTPUT -p icmp --icmp-type port-unreachable -j DROP; |
| securityContext: |
| capabilities: |
| add: |
| - NET_ADMIN |
| {{- if .Values.config.coreDump.enabled }} |
| {{ tuple "spgwu" . | include "omec-user-plane.coredump_init" | indent 8 }} |
| {{- end }} |
| containers: |
| - name: bessd |
| image: {{ .Values.images.tags.bess | quote }} |
| imagePullPolicy: {{ .Values.images.pullPolicy | quote }} |
| securityContext: |
| capabilities: |
| add: |
| - IPC_LOCK |
| stdin: true |
| tty: true |
| command: ["/bin/bash", "-xc"] |
| args: |
| {{- if .Values.config.spgwu.hugepage.enabled }} |
| - bessd -f -grpc-url=0.0.0.0:10514 |
| {{- else }} |
| - bessd -m 0 -f -grpc-url=0.0.0.0:10514 |
| {{- end }} |
| lifecycle: |
| postStart: |
| exec: |
| command: ["/etc/bess/conf/bessd-poststart.sh"] |
| livenessProbe: |
| tcpSocket: |
| port: 10514 |
| initialDelaySeconds: 15 |
| periodSeconds: 20 |
| resources: |
| requests: |
| {{- if .Values.resources.enabled }} |
| {{ toYaml .Values.resources.bess.requests | indent 12 }} |
| {{- end }} |
| {{- if .Values.config.spgwu.hugepage.enabled }} |
| hugepages-1Gi: 2Gi |
| {{- end }} |
| {{- if .Values.config.spgwu.sriov.enabled }} |
| intel.com/sriov_vfio_s1u_net: 1 |
| intel.com/sriov_vfio_sgi_net: 1 |
| {{- end }} |
| limits: |
| {{- if .Values.resources.enabled }} |
| {{ toYaml .Values.resources.bess.limits | indent 12 }} |
| {{- end }} |
| {{- if .Values.config.spgwu.hugepage.enabled }} |
| hugepages-1Gi: 2Gi |
| {{- end }} |
| {{- if .Values.config.spgwu.sriov.enabled }} |
| intel.com/sriov_vfio_s1u_net: 1 |
| intel.com/sriov_vfio_sgi_net: 1 |
| {{- end }} |
| env: |
| - name: CONF_FILE |
| value: /etc/bess/conf/upf.json |
| volumeMounts: |
| {{- if .Values.config.spgwu.hugepage.enabled }} |
| - name: hugepages |
| mountPath: /dev/hugepages |
| {{- end }} |
| - name: configs |
| mountPath: /etc/bess/conf |
| {{- if .Values.config.coreDump.enabled }} |
| - name: coredump |
| mountPath: /tmp/coredump |
| {{- end }} |
| - name: routectl |
| image: {{ .Values.images.tags.bess | quote }} |
| imagePullPolicy: {{ .Values.images.pullPolicy | quote }} |
| env: |
| - name: PYTHONUNBUFFERED |
| value: "1" |
| command: ["/opt/bess/bessctl/conf/route_control.py"] |
| args: |
| - -i |
| - {{ index $s1uConfig "ifname" }} |
| - {{ index $sgiConfig "ifname" }} |
| {{- if .Values.resources.enabled }} |
| resources: |
| {{ toYaml .Values.resources.routectl | indent 10 }} |
| {{- end }} |
| - name: web |
| image: {{ .Values.images.tags.bess | quote }} |
| imagePullPolicy: {{ .Values.images.pullPolicy | quote }} |
| command: ["/bin/bash", "-xc", "bessctl http 0.0.0.0 8000"] |
| {{- if .Values.resources.enabled }} |
| resources: |
| {{ toYaml .Values.resources.web | indent 10 }} |
| {{- end }} |
| - name: cpiface |
| {{- if eq .Values.config.spgwu.cpiface.mode "zmq" }} |
| image: {{ .Values.images.tags.zmqiface | quote }} |
| imagePullPolicy: {{ .Values.images.pullPolicy | quote }} |
| env: |
| - name: GLOG_v |
| value: "1" |
| command: ["zmq-cpiface"] |
| args: |
| - --json_config |
| - /tmp/conf/upf.json |
| {{- else }} |
| image: {{ .Values.images.tags.pfcpiface | quote }} |
| imagePullPolicy: {{ .Values.images.pullPolicy | quote }} |
| command: ["pfcpiface"] |
| args: |
| - -config |
| - /tmp/conf/upf.json |
| {{- end }} |
| {{- if .Values.resources.enabled }} |
| resources: |
| {{ toYaml .Values.resources.cpiface | indent 10 }} |
| {{- end }} |
| volumeMounts: |
| - name: configs |
| mountPath: /tmp/conf |
| volumes: |
| - name: configs |
| configMap: |
| name: spgwu |
| defaultMode: 493 |
| {{- if .Values.config.spgwu.hugepage.enabled }} |
| - name: hugepages |
| emptyDir: |
| medium: HugePages |
| {{- end }} |
| {{- if .Values.config.coreDump.enabled }} |
| - name: host-rootfs |
| hostPath: |
| path: / |
| - name: coredump |
| hostPath: |
| path: {{ .Values.config.coreDump.path }} |
| {{- end }} |