Add router chart
Change-Id: I1a7c66a159f0d6b5095521329ee451445f78aec5
diff --git a/router/Chart.yaml b/router/Chart.yaml
new file mode 100644
index 0000000..1fece39
--- /dev/null
+++ b/router/Chart.yaml
@@ -0,0 +1,11 @@
+---
+# SPDX-FileCopyrightText: {C) 2022 Intel Corporation
+#
+# SPDX-License-Identifier: Apache-2.0
+
+apiVersion: v2
+description: Route Data plane packets from Gnb to UPF to Internet and vice versa
+name: router
+icon: https://guide.opencord.org/logos/cord.svg
+
+version: 0.1.0
diff --git a/router/templates/network.yaml b/router/templates/network.yaml
new file mode 100644
index 0000000..d92d5f8
--- /dev/null
+++ b/router/templates/network.yaml
@@ -0,0 +1,23 @@
+# SPDX-FileCopyrightText: {C) 2022 Intel Corporation
+#
+# SPDX-License-Identifier: Apache-2.0
+
+apiVersion: "k8s.cni.cncf.io/v1"
+kind: NetworkAttachmentDefinition
+metadata:
+ name: router-net
+{{- if eq .Values.config.router.cni "sriov" }}
+ annotations:
+ k8s.v1.cni.cncf.io/resourceName: {{ .Values.config.router.resourceName }}
+{{- end }}
+spec:
+ config: '{
+ "cniVersion": "0.3.1",
+ "type": "{{ .Values.config.router.cni }}",
+ {{- if eq .Values.config.router.cni "macvlan" }}
+ "master": "{{ .Values.config.router.dataIface }}",
+ {{- end }}
+ "ipam": {
+ "type": "static"
+ }
+ }'
diff --git a/router/templates/router-deployment.yaml b/router/templates/router-deployment.yaml
new file mode 100644
index 0000000..0b279f5
--- /dev/null
+++ b/router/templates/router-deployment.yaml
@@ -0,0 +1,54 @@
+# SPDX-FileCopyrightText: {C) 2022 Intel Corporation
+#
+# SPDX-License-Identifier: Apache-2.0
+
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: router
+ labels:
+ app: router
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: router
+ template:
+ metadata:
+ labels:
+ app: router
+ annotations:
+ k8s.v1.cni.cncf.io/networks: '[
+ {{- $first := true}}
+ {{- range .Values.config.router.interfaces }}
+ {{- if $first }}
+ {{- $first = false }}
+ {{- else }},
+ {{- end }}
+ { "name": "router-net", "interface": {{ .name | quote }}, "ips": [{{.ip | quote }}] }
+ {{- end }}
+ ]'
+ spec:
+ containers:
+ - name: router
+ command: ["/bin/bash", "-c"]
+ args:
+ - >
+ sysctl -w net.ipv4.ip_forward=1;
+ iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE;
+ {{- range .Values.config.router.routes }}
+ ip route add {{ .to }} via {{ .via }};
+ {{- end }}
+ trap : TERM INT; sleep infinity & wait
+ image: {{ .Values.images.tags.router }}
+ securityContext:
+ capabilities:
+ add:
+ - NET_ADMIN
+ {{- if eq .Values.config.router.cni "sriov" }}
+ resources:
+ requests:
+ {{ .Values.config.router.resourceName }}: {{ len .Values.config.router.interfaces }}
+ limits:
+ {{ .Values.config.router.resourceName }}: {{ len .Values.config.router.interfaces }}
+ {{- end }}
diff --git a/router/values.yaml b/router/values.yaml
new file mode 100644
index 0000000..ab4f793
--- /dev/null
+++ b/router/values.yaml
@@ -0,0 +1,38 @@
+# SPDX-FileCopyrightText: {C) 2022 Intel Corporation
+#
+# SPDX-License-Identifier: Apache-2.0
+
+images:
+ repository: "" #default docker hub
+ tags:
+ router: docker.io/ubuntu:latest
+ pullPolicy: IfNotPresent
+
+resources:
+ enabled: false
+ router:
+ requests:
+ cpu: 0.5
+ memory: 256Mi
+ limits:
+ cpu: 0.5
+ memory: 256Mi
+
+config:
+ router:
+ deploy: true
+ cni: "sriov"
+ # resourceName is valid only when sriov cni is used
+ resourceName: "intel.com/intel_sriov_netdevice"
+ # dataIface is required when macvlan cni is used
+ # dataIface: "eno1"
+ routes:
+ - to: "172.250.0.0/16"
+ via: "192.168.250.3"
+ interfaces:
+ - name: core
+ ip: "192.168.250.1/24"
+ - name: access
+ ip: "192.168.252.1/24"
+ - name: ran
+ ip: "192.168.251.1/24"