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/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