Add Aether files and directories from helm-charts
Change-Id: I2edb76ebbf8f1da147f760c0fa4618219c49b6cc
diff --git a/omec/omec-data-plane/templates/_helpers.tpl b/omec/omec-data-plane/templates/_helpers.tpl
new file mode 100644
index 0000000..24733ea
--- /dev/null
+++ b/omec/omec-data-plane/templates/_helpers.tpl
@@ -0,0 +1,56 @@
+{{- /*
+# Copyright 2019-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+*/ -}}
+
+{{/*
+Renders a set of standardised labels.
+*/}}
+{{- define "omec-data-plane.metadata_labels" -}}
+{{- $application := index . 0 -}}
+{{- $context := index . 1 -}}
+release: {{ $context.Release.Name }}
+app: {{ $application }}
+{{- end -}}
+
+{{/*
+Render the given template.
+*/}}
+{{- define "omec-data-plane.template" -}}
+{{- $name := index . 0 -}}
+{{- $context := index . 1 -}}
+{{- $last := base $context.Template.Name }}
+{{- $wtf := $context.Template.Name | replace $last $name -}}
+{{ include $wtf $context }}
+{{- end -}}
+
+{{/*
+Render init container for coredump.
+*/}}
+{{- define "omec-data-plane.coredump_init" -}}
+{{- $pod := index . 0 -}}
+{{- $context := index . 1 -}}
+- name: {{ $pod }}-coredump-init
+ image: {{ $context.Values.images.tags.init | quote }}
+ imagePullPolicy: {{ $context.Values.images.pullPolicy }}
+ securityContext:
+ privileged: true
+ runAsUser: 0
+ command: ["bash", "-xc"]
+ args:
+ - echo '/tmp/coredump/core.%h.%e.%t' > /mnt/host-rootfs/proc/sys/kernel/core_pattern
+ volumeMounts:
+ - name: host-rootfs
+ mountPath: /mnt/host-rootfs
+{{- end -}}
diff --git a/omec/omec-data-plane/templates/bin/_spgwu-run.sh.tpl b/omec/omec-data-plane/templates/bin/_spgwu-run.sh.tpl
new file mode 100644
index 0000000..3d77d81
--- /dev/null
+++ b/omec/omec-data-plane/templates/bin/_spgwu-run.sh.tpl
@@ -0,0 +1,31 @@
+#!/bin/bash
+#
+# Copyright 2019-present Open Networking Foundation
+# Copyright 2019 Intel Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -ex
+
+{{- if .Values.config.coreDump.enabled }}
+cp /bin/ngic_dataplane /tmp/coredump/
+{{- end }}
+
+mkdir -p /opt/dp/config
+cd /opt/dp/config
+cp /etc/dp/config/{cdr.cfg,dp_config.cfg,interface.cfg} .
+
+sed -i "s/DP_ADDR/$POD_IP/g" interface.cfg
+
+source dp_config.cfg
+ngic_dataplane $EAL_ARGS -- $APP_ARGS
diff --git a/omec/omec-data-plane/templates/bin/_spgwu-setup-af-iface.sh.tpl b/omec/omec-data-plane/templates/bin/_spgwu-setup-af-iface.sh.tpl
new file mode 100644
index 0000000..714d79c
--- /dev/null
+++ b/omec/omec-data-plane/templates/bin/_spgwu-setup-af-iface.sh.tpl
@@ -0,0 +1,47 @@
+#!/bin/sh
+#
+# Copyright 2019-present Open Networking Foundation
+# Copyright 2019 Intel Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -ex
+
+UL_IFACE="{{ .Values.config.spgwu.s1u.device }}-veth"
+DL_IFACE="{{ .Values.config.spgwu.sgi.device }}-veth"
+
+if ! ip link show $UL_IFACE; then
+ s1u_mac=$(ip addr show dev s1u-net | awk '$1=="link/ether"{print $2}')
+ ip link add $UL_IFACE type veth peer name l_$UL_IFACE
+ ip link set $UL_IFACE up
+ ip link set l_$UL_IFACE up
+ ip link set dev $UL_IFACE address $s1u_mac
+fi
+if ! ip link show $DL_IFACE; then
+ sgi_mac=$(ip addr show dev sgi-net | awk '$1=="link/ether"{print $2}')
+ ip link add $DL_IFACE type veth peer name l_$DL_IFACE
+ ip link set $DL_IFACE up
+ ip link set l_$DL_IFACE up
+ ip link set dev $DL_IFACE address $sgi_mac
+fi
+
+if ! ip addr show $UL_IFACE | grep inet; then
+ s1u_ip=$(ip addr show s1u-net | grep inet | grep -v inet6 | awk '{print $2}')
+ ip addr add $s1u_ip dev $UL_IFACE
+fi
+if ! ip addr show $DL_IFACE | grep inet; then
+ sgi_ip=$(ip addr show sgi-net | grep inet | grep -v inet6 | awk '{print $2}')
+ ip addr add $sgi_ip dev $DL_IFACE
+fi
+
+ip a
diff --git a/omec/omec-data-plane/templates/configmap-spgwu.yaml b/omec/omec-data-plane/templates/configmap-spgwu.yaml
new file mode 100644
index 0000000..81319c1
--- /dev/null
+++ b/omec/omec-data-plane/templates/configmap-spgwu.yaml
@@ -0,0 +1,79 @@
+{{/*
+Copyright 2019-present Open Networking Foundation
+Copyright 2019 Intel Corporation
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/}}
+
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: spgwu
+ labels:
+{{ tuple "spgwu" . | include "omec-data-plane.metadata_labels" | indent 4 }}
+data:
+ dp_config.cfg: |
+ if [ ! -d "/dev/hugepages" ]; then
+ MEMORY="--no-huge -m $((MEM_LIMIT-1024))"
+ fi
+ CORES="-c $(taskset -p $$ | awk '{print $NF}')"
+ EAL_ARGS="${CORES} ${MEMORY} {{ .Values.config.spgwu.devices }}"
+
+ {{- if .Values.config.sriov.enabled }}
+ S1U_DEVNAME={{ .Values.config.spgwu.s1u.device }}
+ {{- else }}
+ S1U_DEVNAME={{ .Values.config.spgwu.s1u.device }}-veth
+ {{- end }}
+ {{- if .Values.config.sriov.enabled }}
+ SGI_DEVNAME={{ .Values.config.spgwu.sgi.device }}
+ {{- else }}
+ SGI_DEVNAME={{ .Values.config.spgwu.sgi.device }}-veth
+ {{- end }}
+
+ S1U_IP=$(ip -4 addr show dev ${S1U_DEVNAME} | grep -oP '(?<=inet\s)\d+(\.\d+){3}')
+ SGI_IP=$(ip -4 addr show dev ${SGI_DEVNAME} | grep -oP '(?<=inet\s)\d+(\.\d+){3}')
+ S1U_MAC=$(ip addr show dev ${S1U_DEVNAME} | awk '$1=="link/ether"{print $2}')
+ SGI_MAC=$(ip addr show dev ${SGI_DEVNAME} | awk '$1=="link/ether"{print $2}')
+
+ S1U="--s1u_ip ${S1U_IP} --s1u_mac ${S1U_MAC} --ul_iface ${S1U_DEVNAME}"
+ SGI="--sgi_ip ${SGI_IP} --sgi_mac ${SGI_MAC} --dl_iface ${SGI_DEVNAME} --sgi_gw_ip {{ .Values.networks.sgi.gateway }} --sgi_mask {{ .Values.networks.sgi.mask }}"
+ MISC="--log 1"
+ SPGW_CFG="--spgw_cfg 03"
+
+ APP_ARGS="${S1U} ${SGI} ${MISC} ${SPGW_CFG}"
+ cdr.cfg: |
+ CDR_PATH=./cdr
+ MASTER_CDR=./cdr/master.csv
+ interface.cfg: |
+ [0]
+ zmq_protocol = tcp
+ dp_comm_ip = DP_ADDR
+ dp_comm_port = 20
+{{- if .Values.config.spgwu.multiUpfs }}
+ cp_nb_ip = {{ .Values.config.spgwu.cpComm.addr }}
+ cp_nb_port = {{ .Values.config.spgwu.cpComm.port }}
+ cp_comm_ip = {{ .Values.config.spgwu.cpComm.addr }}
+ cp_comm_port = {{ .Values.config.spgwu.cpComm.port }}
+ zmq_dp_ip=127.0.0.1
+ zmq_cp_ip=127.0.0.1
+{{- else }}
+ cp_comm_ip = {{ .Values.config.spgwu.cpComm.addr }}
+ cp_comm_port = {{ .Values.config.spgwu.cpComm.port }}
+{{- end }}
+{{- if not .Values.config.sriov.enabled }}
+ setup-af-iface.sh: |
+{{ tuple "bin/_spgwu-setup-af-iface.sh.tpl" . | include "omec-data-plane.template" | indent 4 }}
+{{- end }}
+ run.sh: |
+{{ tuple "bin/_spgwu-run.sh.tpl" . | include "omec-data-plane.template" | indent 4 }}
diff --git a/omec/omec-data-plane/templates/networks.yaml b/omec/omec-data-plane/templates/networks.yaml
new file mode 100644
index 0000000..e937d62
--- /dev/null
+++ b/omec/omec-data-plane/templates/networks.yaml
@@ -0,0 +1,49 @@
+{{/*
+Copyright 2018-present Open Networking Foundation
+Copyright 2018 Intel Corporation
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/}}
+
+---
+apiVersion: "k8s.cni.cncf.io/v1"
+kind: NetworkAttachmentDefinition
+metadata:
+ name: s1u-net
+{{- if $.Values.config.sriov.enabled }}
+ annotations:
+ k8s.v1.cni.cncf.io/resourceName: intel.com/sriov_vfio_s1u_net
+{{- end }}
+spec:
+ config: '{
+ "type": {{ .Values.networks.cniPlugin | quote }},
+ "ipam": {
+ "type": {{ .Values.networks.ipam | quote }}
+ }
+ }'
+---
+apiVersion: "k8s.cni.cncf.io/v1"
+kind: NetworkAttachmentDefinition
+metadata:
+ name: sgi-net
+{{- if $.Values.config.sriov.enabled }}
+ annotations:
+ k8s.v1.cni.cncf.io/resourceName: intel.com/sriov_vfio_sgi_net
+{{- end }}
+spec:
+ config: '{
+ "type": {{ .Values.networks.cniPlugin | quote }},
+ "ipam": {
+ "type": {{ .Values.networks.ipam | quote }}
+ }
+ }'
diff --git a/omec/omec-data-plane/templates/service-spgwu.yaml b/omec/omec-data-plane/templates/service-spgwu.yaml
new file mode 100644
index 0000000..6985e22
--- /dev/null
+++ b/omec/omec-data-plane/templates/service-spgwu.yaml
@@ -0,0 +1,72 @@
+{{/*
+Copyright 2019-present Open Networking Foundation
+Copyright 2019 Intel Corporation
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/}}
+
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: spgwu
+ labels:
+{{ tuple "spgwu" . | include "omec-data-plane.metadata_labels" | indent 4 }}
+spec:
+ selector:
+{{ tuple "spgwu" . | include "omec-data-plane.metadata_labels" | indent 4 }}
+ ports:
+ - name: dp-comm
+ port: {{ .Values.config.spgwu.dpComm.port }}
+{{- if .Values.config.spgwu.multiUpfs }}
+ protocol: TCP
+{{- else }}
+ protocol: UDP
+{{- end }}
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: spgwu-headless
+ labels:
+{{ tuple "spgwu" . | include "omec-data-plane.metadata_labels" | indent 4 }}
+spec:
+ clusterIP: None
+ selector:
+{{ tuple "spgwu" . | include "omec-data-plane.metadata_labels" | indent 4 }}
+ ports:
+ - name: dp-comm
+ port: {{ .Values.config.spgwu.dpComm.port }}
+{{- if .Values.config.spgwu.multiUpfs }}
+ protocol: TCP
+{{- else }}
+ protocol: UDP
+{{- end }}
+{{- if and (not .Values.config.spgwu.multiUpfs) .Values.config.spgwu.dpComm.nodePort.enabled }}
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: spgwu-external
+ labels:
+{{ tuple "spgwu" . | include "omec-data-plane.metadata_labels" | indent 4 }}
+spec:
+ selector:
+{{ tuple "spgwu" . | include "omec-data-plane.metadata_labels" | indent 4 }}
+ type: NodePort
+ ports:
+ - name: dp-comm
+ port: {{ .Values.config.spgwu.dpComm.port }}
+ protocol: UDP
+ nodePort: {{ .Values.config.spgwu.dpComm.nodePort.port }}
+{{- end }}
diff --git a/omec/omec-data-plane/templates/statefulset-spgwu.yaml b/omec/omec-data-plane/templates/statefulset-spgwu.yaml
new file mode 100644
index 0000000..593f2d2
--- /dev/null
+++ b/omec/omec-data-plane/templates/statefulset-spgwu.yaml
@@ -0,0 +1,155 @@
+{{/*
+Copyright 2018-present Open Networking Foundation
+Copyright 2018 Intel Corporation
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/}}
+---
+apiVersion: apps/v1
+kind: StatefulSet
+metadata:
+ name: spgwu
+ serviceName: spgwu-headless
+ labels:
+{{ tuple "spgwu" . | include "omec-data-plane.metadata_labels" | indent 4 }}
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+{{ tuple "spgwu" . | include "omec-data-plane.metadata_labels" | indent 6 }}
+ template:
+ metadata:
+ labels:
+{{ tuple "spgwu" . | include "omec-data-plane.metadata_labels" | indent 8 }}
+ annotations:
+ k8s.v1.cni.cncf.io/networks: '[
+ {
+ "name": "s1u-net",
+ "interface": {{ .Values.config.spgwu.s1u.device | quote }},
+ "ips": {{ .Values.config.spgwu.s1u.ip | quote }}
+ },
+ {
+ "name": "sgi-net",
+ "interface": {{ .Values.config.spgwu.sgi.device | quote }},
+ "ips": {{ .Values.config.spgwu.sgi.ip | quote }}
+ }
+ ]'
+ spec:
+ {{- if .Values.nodeSelectors.enabled }}
+ nodeSelector:
+ {{ .Values.nodeSelectors.spgwu.label }}: {{ .Values.nodeSelectors.spgwu.value }}
+ {{- end }}
+ {{- if not .Values.config.sriov.enabled }}
+ initContainers:
+ - name: spgwu-iptables-init
+ image: {{ .Values.images.tags.init | quote }}
+ imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
+ command: [ "sh", "-xec"]
+ securityContext:
+ capabilities:
+ add:
+ - NET_ADMIN
+ args:
+ - iptables -I OUTPUT -p icmp --icmp-type destination-unreachable -j DROP;
+ - name: spgwu-af-iface-init
+ image: {{ .Values.images.tags.init | quote }}
+ imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
+ securityContext:
+ capabilities:
+ add:
+ - NET_ADMIN
+ command:
+ - /opt/dp/scripts/setup-af-iface.sh
+ volumeMounts:
+ - name: dp-script
+ mountPath: /opt/dp/scripts/setup-af-iface.sh
+ subPath: setup-af-iface.sh
+ {{- end }}
+ {{- if .Values.config.coreDump.enabled }}
+{{ tuple "spgwc" . | include "omec-data-plane.coredump_init" | indent 8 }}
+ {{- end }}
+ containers:
+ - name: spgwu
+ image: {{ .Values.images.tags.spgwu | quote }}
+ imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
+ securityContext:
+ {{- if .Values.config.coreDump.enabled }}
+ privileged: true
+ runAsUser: 0
+ {{- end }}
+ capabilities:
+ add:
+ - IPC_LOCK
+ stdin: true
+ tty: true
+ env:
+ - name: MEM_LIMIT
+ valueFrom:
+ resourceFieldRef:
+ containerName: spgwu
+ resource: limits.memory
+ divisor: 1Mi
+ - name: POD_IP
+ valueFrom:
+ fieldRef:
+ fieldPath: status.podIP
+ - name: DP_NAME
+ value: "{{ .Values.config.spgwu.dpName }}"
+ command: ["bash", "-xc"]
+ args:
+ - ip a;
+ /opt/dp/scripts/run.sh;
+ volumeMounts:
+ - name: dp-script
+ mountPath: /opt/dp/scripts/run.sh
+ subPath: run.sh
+ - name: dp-config
+ mountPath: /etc/dp/config
+ {{- if .Values.config.coreDump.enabled }}
+ - name: coredump
+ mountPath: /tmp/coredump
+ {{- end }}
+ resources:
+ requests:
+ {{- if .Values.resources.enabled }}
+{{ toYaml .Values.resources.spgwu.requests | indent 12 }}
+ {{- end }}
+ {{- if .Values.config.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.spgwu.limits | indent 12 }}
+ {{- end }}
+ {{- if .Values.config.sriov.enabled }}
+ intel.com/sriov_vfio_s1u_net: 1
+ intel.com/sriov_vfio_sgi_net: 1
+ {{- end }}
+ volumes:
+ - name: dp-script
+ configMap:
+ name: spgwu
+ defaultMode: 493
+ - name: dp-config
+ configMap:
+ name: spgwu
+ defaultMode: 420
+ {{- if .Values.config.coreDump.enabled }}
+ - name: host-rootfs
+ hostPath:
+ path: /
+ - name: coredump
+ hostPath:
+ path: {{ .Values.config.coreDump.path }}
+ {{- end }}