Add enodebd service helm chart

Change-Id: I95a32b40bc775d926b3d8efd92b452ca97356bca
diff --git a/apps/enodebd/.helmignore b/apps/enodebd/.helmignore
new file mode 100644
index 0000000..887abf2
--- /dev/null
+++ b/apps/enodebd/.helmignore
@@ -0,0 +1,27 @@
+# SPDX-FileCopyrightText: 2021 Open Networking Foundation
+#
+# SPDX-License-Identifier: Apache-2.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/apps/enodebd/Chart.yaml b/apps/enodebd/Chart.yaml
new file mode 100644
index 0000000..cd0d437
--- /dev/null
+++ b/apps/enodebd/Chart.yaml
@@ -0,0 +1,18 @@
+# SPDX-FileCopyrightText: 2021-present Open Networking Foundation <info@opennetworking.org>
+#
+# SPDX-License-Identifier: Apache-2.0
+
+apiVersion: v2
+name: enodebd
+description: Aether Enodebd Service
+kubeVersion: ">=1.15.0"
+type: application
+version: 0.0.2
+appVersion: 0.0.2
+keywords:
+  - aether
+  - enodebd
+home: https://www.opennetworking.org/aether/
+maintainers:
+  - name: Aether Ops team
+    email: support@opennetworking.org
diff --git a/apps/enodebd/templates/NOTES.txt b/apps/enodebd/templates/NOTES.txt
new file mode 100644
index 0000000..6b97039
--- /dev/null
+++ b/apps/enodebd/templates/NOTES.txt
@@ -0,0 +1,21 @@
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation
+#
+# SPDX-License-Identifier: Apache-2.0
+
+Thank you for installing {{ .Chart.Name }} Helm chart.
+
+Your release is named {{ .Release.Name }} in namespace {{ .Release.Namespace }}.
+See https://docs.onosproject.org/developers/deploy_with_helm/
+
+To learn more about the release, try:
+  $ helm -n {{ .Release.Namespace }} status {{ .Release.Name }}
+  $ helm -n {{ .Release.Namespace }} get all {{ .Release.Name }}
+
+{{ .Release.Name }} exposes on 2 NodePorts:
+- port 31005: the eNodeB configuration functionality via TR-069 protocol.
+- port 31006: the prometheus client to provide eNodeBD status
+
+To add customized configuration files for each enodeb devices: 
+1. Accessing the enodebd source code, and duplicate acs_common.yml file
+2. Customizing the configuration file and name the file as {serial_number}.yml
+3. Mounting the customized configuration in magma_config/serial_number directory
\ No newline at end of file
diff --git a/apps/enodebd/templates/_helpers.tpl b/apps/enodebd/templates/_helpers.tpl
new file mode 100644
index 0000000..9f18277
--- /dev/null
+++ b/apps/enodebd/templates/_helpers.tpl
@@ -0,0 +1,68 @@
+{{/*
+# Copyright 2022-present Open Networking Foundation
+
+# SPDX-License-Identifier: Apache-2.0
+*/}}
+
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "aether-enodebd.name" -}}
+{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
+{{- end }}
+
+{{/*
+Create a default fully qualified app name.
+We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
+If release name contains chart name it will be used as a full name.
+*/}}
+{{- define "aether-enodebd.fullname" -}}
+{{- if .Values.fullnameOverride }}
+{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
+{{- else }}
+{{- $name := default .Chart.Name .Values.nameOverride }}
+{{- if contains $name .Release.Name }}
+{{- .Release.Name | trunc 63 | trimSuffix "-" }}
+{{- else }}
+{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
+{{- end }}
+{{- end }}
+{{- end }}
+
+{{/*
+Create chart name and version as used by the chart label.
+*/}}
+{{- define "aether-enodebd.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
+{{- end }}
+
+{{/*
+Common labels
+*/}}
+{{- define "aether-enodebd.labels" -}}
+helm.sh/chart: {{ include "aether-enodebd.chart" . }}
+{{ include "aether-enodebd.selectorLabels" . }}
+{{- if .Chart.AppVersion }}
+app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
+{{- end }}
+app.kubernetes.io/managed-by: {{ .Release.Service }}
+{{- end }}
+
+{{/*
+Selector labels
+*/}}
+{{- define "aether-enodebd.selectorLabels" -}}
+app.kubernetes.io/name: {{ include "aether-enodebd.name" . }}
+app.kubernetes.io/instance: {{ .Release.Name }}
+{{- end }}
+
+{{/*
+Create the name of the service account to use
+*/}}
+{{- define "aether-enodebd.serviceAccountName" -}}
+{{- if .Values.serviceAccount.create }}
+{{- default (include "aether-enodebd.fullname" .) .Values.serviceAccount.name }}
+{{- else }}
+{{- default "default" .Values.serviceAccount.name }}
+{{- end }}
+{{- end }}
diff --git a/apps/enodebd/templates/configmap.yaml b/apps/enodebd/templates/configmap.yaml
new file mode 100644
index 0000000..5233747
--- /dev/null
+++ b/apps/enodebd/templates/configmap.yaml
@@ -0,0 +1,29 @@
+{{/*
+# Copyright 2022-present Open Networking Foundation
+
+# SPDX-License-Identifier: Apache-2.0
+*/}}
+
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: {{ template "aether-enodebd.fullname" . }}
+  namespace: {{ .Release.Namespace }}
+  labels:
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
+data:
+  enodebd.yml: |-
+    prometheus:
+      ip: 0.0.0.0
+      port: {{ .Values.service.prometheus.port }}
+    
+    tr069:
+      interface: {{ .Values.interface }}
+      port: {{ .Values.service.enodebd.port }}
+      perf_mgmt_port: 8081
+      public_ip: 0.0.0.0
+
+    reboot_enodeb_on_mme_disconnected: True
+    web_ui_enable_list: []
+    s1_interface: eth1
\ No newline at end of file
diff --git a/apps/enodebd/templates/deployment.yaml b/apps/enodebd/templates/deployment.yaml
new file mode 100644
index 0000000..aab2e15
--- /dev/null
+++ b/apps/enodebd/templates/deployment.yaml
@@ -0,0 +1,67 @@
+{{/*
+# Copyright 2022-present Open Networking Foundation
+
+# SPDX-License-Identifier: Apache-2.0
+*/}}
+
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: {{ include "aether-enodebd.fullname" . }}
+  labels:
+    {{- include "aether-enodebd.labels" . | nindent 4 }}
+spec:
+  {{- if not .Values.autoscaling.enabled }}
+  replicas: {{ .Values.replicaCount }}
+  {{- end }}
+  selector:
+    matchLabels:
+      {{- include "aether-enodebd.selectorLabels" . | nindent 6 }}
+  template:
+    metadata:
+      {{- with .Values.podAnnotations }}
+      annotations:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      labels:
+        {{- include "aether-enodebd.selectorLabels" . | nindent 8 }}
+    spec:
+    {{- with .Values.imagePullSecrets }}
+      imagePullSecrets:
+        {{- toYaml . | nindent 8 }}
+    {{- end }}
+      containers:
+        - name: {{ .Chart.Name }}
+          securityContext:
+            {{- toYaml .Values.securityContext | nindent 12 }}
+          image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
+          imagePullPolicy: {{ .Values.image.pullPolicy }}
+          ports:
+            {{- with .Values.ports }}
+            {{- range $key, $port := . }}
+            - name: {{ $key }}
+              {{ toYaml $port | nindent 14 }}
+            {{- end }}
+            {{- end }}
+          resources:
+            {{- toYaml .Values.resources | nindent 12 }}
+          volumeMounts:
+            - name: config-volume
+              mountPath: /opt/enodebd/magma_configs/enodebd.yml
+              subPath: enodebd.yml
+      volumes:
+        - name: config-volume
+          configMap:
+            name: {{ template "aether-enodebd.fullname" . }}
+    {{- with .Values.nodeSelector }}
+    nodeSelector:
+      {{- toYaml . | nindent 8 }}
+    {{- end }}
+    {{- with .Values.affinity }}
+      affinity:
+        {{- toYaml . | nindent 8 }}
+    {{- end }}
+    {{- with .Values.tolerations }}
+      tolerations:
+        {{- toYaml . | nindent 8 }}
+    {{- end }}
diff --git a/apps/enodebd/templates/service.yaml b/apps/enodebd/templates/service.yaml
new file mode 100644
index 0000000..e5f0c75
--- /dev/null
+++ b/apps/enodebd/templates/service.yaml
@@ -0,0 +1,25 @@
+{{/*
+# Copyright 2022-present Open Networking Foundation
+
+# SPDX-License-Identifier: Apache-2.0
+*/}}
+
+apiVersion: v1
+kind: Service
+metadata:
+  name: {{ include "aether-enodebd.fullname" . }}
+  labels:
+    {{- include "aether-enodebd.labels" . | nindent 4 }}
+spec:
+  type: {{ .Values.service.enodebd.type }}
+  ports:
+    - name: enodebd-service
+      port: {{ .Values.service.enodebd.port }}
+      targetPort: {{ .Values.service.enodebd.port }}
+      nodePort: {{ .Values.service.enodebd.external.nodePort }}
+    - name: prometheus-exporter
+      port: {{ .Values.service.prometheus.port }}
+      targetPort: {{ .Values.service.prometheus.port }}
+      nodePort: {{ .Values.service.prometheus.external.nodePort }}
+  selector:
+    {{- include "aether-enodebd.selectorLabels" . | nindent 4 }}
diff --git a/apps/enodebd/templates/tests/test-connection.yaml b/apps/enodebd/templates/tests/test-connection.yaml
new file mode 100644
index 0000000..090bf9d
--- /dev/null
+++ b/apps/enodebd/templates/tests/test-connection.yaml
@@ -0,0 +1,21 @@
+{{/*
+# Copyright 2022-present Open Networking Foundation
+
+# SPDX-License-Identifier: Apache-2.0
+*/}}
+
+apiVersion: v1
+kind: Pod
+metadata:
+  name: "{{ include "aether-enodebd.fullname" . }}-test-connection"
+  labels:
+    {{- include "aether-enodebd.labels" . | nindent 4 }}
+  annotations:
+    "helm.sh/hook": test
+spec:
+  containers:
+    - name: wget
+      image: busybox
+      command: ['wget']
+      args: ['{{ include "aether-enodebd.fullname" . }}:{{ .Values.service.port }}']
+  restartPolicy: Never
diff --git a/apps/enodebd/values.yaml b/apps/enodebd/values.yaml
new file mode 100644
index 0000000..43a0107
--- /dev/null
+++ b/apps/enodebd/values.yaml
@@ -0,0 +1,65 @@
+# SPDX-FileCopyrightText: 2021-present Open Networking Foundation <info@opennetworking.org>
+#
+# SPDX-License-Identifier: Apache-2.0
+
+# Default values for aether-enodebd.
+# This is a YAML-formatted file.
+# Declare variables to be passed into your templates.
+
+replicaCount: 1
+
+image:
+  repository: opennetworking/enodebd
+  tag: 0.2.3
+  pullPolicy: IfNotPresent
+
+imagePullSecrets: []
+nameOverride: ""
+fullnameOverride: "aether-enodebd"
+
+service:
+  enodebd:
+    type: NodePort
+    port: 48080
+    external:
+      nodePort: 31005
+  prometheus:
+    type: NodePort
+    port: 8000
+    external:
+      nodePort: 31006
+
+ports:
+  tr069:
+    containerPort: 48080
+    protocol: TCP
+  prometheus:
+    containerPort: 8000
+    protocol: TCP
+
+autoscaling:
+  enabled: false
+
+podAnnotations:
+  fluentbit.io/parser: enodebd
+  field.cattle.io/workloadMetrics: '[{"path":"/metrics","port":8000,"schema":"HTTP"}]'
+
+resources: {}
+  # We usually recommend not to specify default resources and to leave this as a conscious
+  # choice for the user. This also increases chances charts run on environments with little
+  # resources, such as Minikube. If you do want to specify resources, uncomment the following
+  # lines, adjust them as necessary, and remove the curly braces after 'resources:'.
+  # limits:
+  #   cpu: 100m
+  #   memory: 128Mi
+  # requests:
+  #   cpu: 100m
+  #   memory: 128Mi
+
+nodeSelector: {}
+
+tolerations: []
+
+affinity: {}
+
+interface: "eth0"
\ No newline at end of file