[VOL-2992] Expose pprof server when requested for openolt-adapter and rw-core

Change-Id: I740189d5a47957120907a1a8b33ae31b1f4ad00f
diff --git a/voltha-adapter-openolt/Chart.yaml b/voltha-adapter-openolt/Chart.yaml
index ec08fa2..86e972e 100644
--- a/voltha-adapter-openolt/Chart.yaml
+++ b/voltha-adapter-openolt/Chart.yaml
@@ -17,5 +17,5 @@
 description: A Helm chart for Voltha OpenOLT Adapter
 icon: https://guide.opencord.org/logos/cord.svg
 
-version: 2.4.1
+version: 2.4.2
 appVersion: 2.4.1
diff --git a/voltha-adapter-openolt/templates/adapters-openolt.yaml b/voltha-adapter-openolt/templates/adapters-openolt.yaml
index a62506d..6151c4b 100644
--- a/voltha-adapter-openolt/templates/adapters-openolt.yaml
+++ b/voltha-adapter-openolt/templates/adapters-openolt.yaml
@@ -13,6 +13,23 @@
 # limitations under the License.
 {{- $log_level := tpl .Values.adapter_open_olt.log_level . | upper }}
 
+{{- if .Values.profiler.enabled }}
+apiVersion: v1
+kind: Service
+metadata:
+  name: adapter-open-olt-profiler
+  serviceAccountName: {{ .Values.serviceaccount }}
+spec:
+  serviceAccountName: {{ .Values.serviceaccount }}
+  clusterIP: None
+  ports:
+    - name: profiler
+      port: 6060
+      targetPort: 6060
+  selector:
+    app: adapter-open-olt
+---
+{{- end }}
 apiVersion: apps/v1
 kind: Deployment
 metadata:
diff --git a/voltha-adapter-openolt/values.yaml b/voltha-adapter-openolt/values.yaml
index 7dab4bd..7c8fce3 100644
--- a/voltha-adapter-openolt/values.yaml
+++ b/voltha-adapter-openolt/values.yaml
@@ -36,6 +36,10 @@
     service: voltha-etcd-cluster-client.voltha.svc.cluster.local
     port: 2379
 
+# Expose the golang pprof webserver, if enabled
+profiler:
+  enabled: false
+
 # Define the recplica count for everything
 replicas:
   adapter_open_olt: 1