COMAC-255 Improve ONOS chart for better support of various ONOS apps

- Add release name to configmap to allow multiple deployments
- Add ability to support additional Services

Change-Id: I16f45dbd6129aa1cc3e1fbf41bfd8de27b565bd2
diff --git a/onos/templates/_helpers.tpl b/onos/templates/_helpers.tpl
index 1dab05a..6d82564 100644
--- a/onos/templates/_helpers.tpl
+++ b/onos/templates/_helpers.tpl
@@ -106,5 +106,37 @@
 
 # Application logs
 {{ .Values.application_logs }}
+{{- end -}}
 
+{{/*
+Render a Service.
+*/}}
+{{- define "onos.service" -}}
+{{- $name := index . 0 -}}
+{{- $spec := index . 1 -}}
+{{- $context := index . 2 -}}
+{{- $namespace := $context.Release.Namespace }}
+{{- $serviceName := printf "%s-%s" (include "onos.fullname" $context) $name }}
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: {{ $serviceName }}
+  namespace: {{ $namespace }}
+  labels:
+    app: {{ template "onos.name" $context }}
+    chart: {{ template "onos.chart" $context }}
+    release: {{ $context.Release.Name }}
+    heritage: {{ $context.Release.Service }}
+spec:
+  type: {{ $spec.type }}
+  ports:
+  - name: {{ $name }}
+    port: {{ $spec.port }}
+{{- if and $spec.type (eq (printf "%s" $spec.type) "NodePort") }}
+    nodePort: {{ $spec.nodePort }}
+{{- end }}
+  selector:
+    app: {{ template "onos.name" $context }}
+    release: {{ $context.Release.Name }}
 {{- end -}}