Add INT host reporter chart
Also modified the following
- image pull secrets, use the same way like other charts
- use generated fully qualified name
Change-Id: I4c00d9aa5786a15f2d1080e71e97710c49307de8
diff --git a/int-host-reporter/.helmignore b/int-host-reporter/.helmignore
new file mode 100644
index 0000000..c687fff
--- /dev/null
+++ b/int-host-reporter/.helmignore
@@ -0,0 +1,26 @@
+# Copyright 2021-present Open Networking Foundation
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+# Patterns to ignore when building packages.
+# This supports shell glob matching, relative path matching, and
+# negation (prefixed with !). Only one pattern per line.
+.DS_Store
+# Common VCS dirs
+.git/
+.gitignore
+.bzr/
+.bzrignore
+.hg/
+.hgignore
+.svn/
+# Common backup files
+*.swp
+*.bak
+*.tmp
+*.orig
+*~
+# Various IDEs
+.project
+.idea/
+*.tmproj
+.vscode/
diff --git a/int-host-reporter/Chart.yaml b/int-host-reporter/Chart.yaml
new file mode 100644
index 0000000..3869a5a
--- /dev/null
+++ b/int-host-reporter/Chart.yaml
@@ -0,0 +1,12 @@
+# Copyright 2021-present Open Networking Foundation
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+---
+apiVersion: v2
+name: int-host-reporter
+version: 0.0.1
+type: application
+keywords:
+ - In-band Network Telemetry
+ - SDN
+ - eBPF
+description: Host-INT
diff --git a/int-host-reporter/README.md b/int-host-reporter/README.md
new file mode 100644
index 0000000..ecccc22
--- /dev/null
+++ b/int-host-reporter/README.md
@@ -0,0 +1,31 @@
+<!--
+SPDX-FileCopyrightText: 2020 Open Networking Foundation <info@opennetworking.org>
+
+SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+-->
+
+# INT Host Reporter
+
+This directory contains the Helm chart for the [INT Host Reporter](https://github.com/opennetworkinglab/int-host-reporter).
+
+## Create the values.yaml for deployment
+
+Before deploy the INT host reporter to your cluster, you need to create a `value.yaml`
+file for your setup, in `values.yaml` we provides custom parts as below:
+
+* image: Configuration for the container image, you can use the default value in most of cases.
+* cni: The Container Network Interface(CNI) used in your Kubernetes setup, currently we only
+ supports the following: `cilium`, `calico-ebpf`, `calico-iptables`
+* dataInterface: The interface(e.g., `eno1`) on the host operating system that need to be
+ monitored by INT host reporter.
+ Note that we only suport monitoring same interface on every node for now.
+* intCollector: The address of the INT collector, the format is `[IP address]:[Collector UDP port]`.
+ Any collector compatible with the
+ [INT standard](https://github.com/p4lang/p4-applications/blob/master/docs/telemetry_report_v0_5.pdf)
+ can be used.
+* intWatchlistRules: A list of subnets and protocols to watch, each item contains the following:
+ * protocol: The leary 4 protocol, such as `TCP`, `UDP`, or `ICMP`
+ * srcAddr: The source IP address subnet, for example `192.168.99.0/24`
+ * dstAddr: the destination IP address subnet, for example `10.0.0.0/16`
+
+Checkout [values.yaml](values.yaml) as an example.
diff --git a/int-host-reporter/templates/_helpers.tpl b/int-host-reporter/templates/_helpers.tpl
new file mode 100644
index 0000000..a514959
--- /dev/null
+++ b/int-host-reporter/templates/_helpers.tpl
@@ -0,0 +1,23 @@
+{{- /*
+
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+*/ -}}
+
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "name" -}}
+{{- default .Chart.Name .Values.nameOverride | trunc 24 | trimSuffix "-" -}}
+{{- end -}}
+
+{{/*
+Create a default fully qualified app name.
+We truncate at 63 chars because some Kubernetes name fields are limited to 63 (by the DNS naming spec).
+*/}}
+{{- define "int-host-reporter.fullname" -}}
+{{- $name := default .Chart.Name .Values.nameOverride -}}
+{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
diff --git a/int-host-reporter/templates/configmap-watchlist.yaml b/int-host-reporter/templates/configmap-watchlist.yaml
new file mode 100644
index 0000000..123f3e5
--- /dev/null
+++ b/int-host-reporter/templates/configmap-watchlist.yaml
@@ -0,0 +1,22 @@
+# Copyright 2021-present Open Networking Foundation
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: "{{ template "int-host-reporter.fullname" . }}"
+ labels:
+ app: int-host-reporter
+ chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+ release: "{{ .Release.Name }}"
+ heritage: "{{ .Release.Service }}"
+data:
+ watchlist.yaml: |
+ rules:
+ {{- if .Values.intWatchlistRules }}
+ {{- range .Values.intWatchlistRules }}
+ - protocol: "{{ .protocol }}"
+ src-addr: "{{ .srcAddr }}"
+ dst-addr: "{{ .dstAddr }}"
+ {{- end }}
+ {{- end }}
\ No newline at end of file
diff --git a/int-host-reporter/templates/daemonset.yaml b/int-host-reporter/templates/daemonset.yaml
new file mode 100644
index 0000000..64730b9
--- /dev/null
+++ b/int-host-reporter/templates/daemonset.yaml
@@ -0,0 +1,76 @@
+# Copyright 2021-present Open Networking Foundation
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+---
+apiVersion: apps/v1
+kind: DaemonSet
+metadata:
+ name: {{ template "int-host-reporter.fullname" . }}
+ namespace: {{ .Release.Namespace }}
+ labels:
+ k8s-app: {{ template "int-host-reporter.fullname" . }}
+spec:
+ selector:
+ matchLabels:
+ name: {{ template "int-host-reporter.fullname" . }}
+ template:
+ metadata:
+ labels:
+ name: {{ template "int-host-reporter.fullname" . }}
+ spec:
+ nodeSelector:
+ kubernetes.io/os: linux
+ hostNetwork: true
+ {{- if .Values.image.pullSecrets }}
+ imagePullSecrets:
+ {{- range .Values.image.pullSecrets }}
+ - name: {{ . | quote }}
+ {{- end }}
+ {{- end }}
+ containers:
+ - name: {{ template "int-host-reporter.fullname" . }}
+ image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
+ imagePullPolicy: {{ .Values.image.pullPolicy }}
+ env:
+ - name: CNI
+ value: "{{ .Values.cni }}"
+ - name: DATA_INTERFACE
+ value: "{{ .Values.dataInterface }}"
+ - name: COLLECTOR
+ value: "{{ .Values.intCollector }}"
+ # we use Node IP as switch ID
+ - name: NODE_IP
+ valueFrom:
+ fieldRef:
+ fieldPath: status.hostIP
+ command:
+ - "int-host-reporter"
+ args:
+ - "--cni"
+ - "$(CNI)"
+ - "--data-interface"
+ - "$(DATA_INTERFACE)"
+ - "--collector"
+ - "$(COLLECTOR)"
+ - "--switch-id"
+ - "$(NODE_IP)"
+ - "-f"
+ - "/etc/watchlist/watchlist.yaml"
+ volumeMounts:
+ - name: bpffs
+ mountPath: /sys/fs/bpf
+ - name: int-watchlist
+ mountPath: /etc/watchlist/watchlist.yaml
+ subPath: watchlist.yaml
+ securityContext:
+ privileged: true
+ capabilities:
+ add:
+ - "NET_ADMIN"
+ - "NET_RAW"
+ volumes:
+ - name: bpffs
+ hostPath:
+ path: /sys/fs/bpf
+ - name: int-watchlist
+ configMap:
+ name: int-watchlist
diff --git a/int-host-reporter/values.yaml b/int-host-reporter/values.yaml
new file mode 100644
index 0000000..a2a009f
--- /dev/null
+++ b/int-host-reporter/values.yaml
@@ -0,0 +1,21 @@
+# Copyright 2021-present Open Networking Foundation
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+image:
+ repository: registry.hub.docker.com/opennetworking/int-host-reporter
+ pullPolicy: Always
+ # Overrides the image tag whose default is the chart appVersion.
+ tag: "latest"
+
+# CNI in use, possible values: cilium, calico-ebpf, calico-iptables
+cni: cilium
+dataInterface: enp0s8
+intCollector: 192.168.33.50:30001
+
+intWatchlistRules:
+ # - protocol: "UDP"
+ # srcAddr: "192.168.99.50/32"
+ # dstAddr: "192.168.99.20/32"
+ # - protocol: "TCP"
+ # srcAddr: "192.168.99.50/32"
+ # dstAddr: "192.168.99.20/32"