Expose ONOS ports as NodePorts

Change-Id: Ie01375b02197338a9af24a1f6177bc47d92f36e3
diff --git a/onos/templates/service.yaml b/onos/templates/openflow-service.yaml
similarity index 64%
copy from onos/templates/service.yaml
copy to onos/templates/openflow-service.yaml
index b1ada6f..c61f611 100644
--- a/onos/templates/service.yaml
+++ b/onos/templates/openflow-service.yaml
@@ -1,6 +1,4 @@
----
-
-# Copyright 2018-present Open Networking Foundation
+# Copyright 2017-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -17,27 +15,17 @@
 apiVersion: v1
 kind: Service
 metadata:
-  name: {{ template "onos.fullname" . }}
+  name: {{ template "onos.fullname" . }}-openflow
   labels:
     app: {{ template "onos.name" . }}
     chart: {{ template "onos.chart" . }}
     release: {{ .Release.Name }}
     heritage: {{ .Release.Service }}
 spec:
-  clusterIP: None
+  type: {{ .Values.services.serviceType }}
   ports:
-    - port: {{ .Values.services.ovsdb.port }}
-      targetPort: ovsdb
-      name: ovsdb
-    - port: {{ .Values.services.openflow.port }}
-      targetPort: openflow
-      name: openflow
-    - port: {{ .Values.services.ssh.port }}
-      targetPort: ssh
-      name: ssh
-    - port: {{ .Values.services.ui.port }}
-      targetPort: ui
-      name: ui
+  - name: openflow
+{{ toYaml .Values.services.openflow | indent 4 }}
   selector:
     app: {{ template "onos.name" . }}
     release: {{ .Release.Name }}
diff --git a/onos/templates/service.yaml b/onos/templates/ovsdb-service.yaml
similarity index 64%
copy from onos/templates/service.yaml
copy to onos/templates/ovsdb-service.yaml
index b1ada6f..cfda477 100644
--- a/onos/templates/service.yaml
+++ b/onos/templates/ovsdb-service.yaml
@@ -1,6 +1,4 @@
----
-
-# Copyright 2018-present Open Networking Foundation
+# Copyright 2017-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -17,27 +15,17 @@
 apiVersion: v1
 kind: Service
 metadata:
-  name: {{ template "onos.fullname" . }}
+  name: {{ template "onos.fullname" . }}-ovsdb
   labels:
     app: {{ template "onos.name" . }}
     chart: {{ template "onos.chart" . }}
     release: {{ .Release.Name }}
     heritage: {{ .Release.Service }}
 spec:
-  clusterIP: None
+  type: {{ .Values.services.serviceType }}
   ports:
-    - port: {{ .Values.services.ovsdb.port }}
-      targetPort: ovsdb
-      name: ovsdb
-    - port: {{ .Values.services.openflow.port }}
-      targetPort: openflow
-      name: openflow
-    - port: {{ .Values.services.ssh.port }}
-      targetPort: ssh
-      name: ssh
-    - port: {{ .Values.services.ui.port }}
-      targetPort: ui
-      name: ui
+  - name: ovsdb
+{{ toYaml .Values.services.ovsdb | indent 4 }}
   selector:
     app: {{ template "onos.name" . }}
     release: {{ .Release.Name }}
diff --git a/onos/templates/service.yaml b/onos/templates/ssh-service.yaml
similarity index 64%
copy from onos/templates/service.yaml
copy to onos/templates/ssh-service.yaml
index b1ada6f..fdcbb66 100644
--- a/onos/templates/service.yaml
+++ b/onos/templates/ssh-service.yaml
@@ -1,6 +1,4 @@
----
-
-# Copyright 2018-present Open Networking Foundation
+# Copyright 2017-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -17,27 +15,17 @@
 apiVersion: v1
 kind: Service
 metadata:
-  name: {{ template "onos.fullname" . }}
+  name: {{ template "onos.fullname" . }}-ssh
   labels:
     app: {{ template "onos.name" . }}
     chart: {{ template "onos.chart" . }}
     release: {{ .Release.Name }}
     heritage: {{ .Release.Service }}
 spec:
-  clusterIP: None
+  type: {{ .Values.services.serviceType }}
   ports:
-    - port: {{ .Values.services.ovsdb.port }}
-      targetPort: ovsdb
-      name: ovsdb
-    - port: {{ .Values.services.openflow.port }}
-      targetPort: openflow
-      name: openflow
-    - port: {{ .Values.services.ssh.port }}
-      targetPort: ssh
-      name: ssh
-    - port: {{ .Values.services.ui.port }}
-      targetPort: ui
-      name: ui
+  - name: ssh
+{{ toYaml .Values.services.ssh | indent 4 }}
   selector:
     app: {{ template "onos.name" . }}
     release: {{ .Release.Name }}
diff --git a/onos/templates/service.yaml b/onos/templates/ui-service.yaml
similarity index 64%
rename from onos/templates/service.yaml
rename to onos/templates/ui-service.yaml
index b1ada6f..40cbd68 100644
--- a/onos/templates/service.yaml
+++ b/onos/templates/ui-service.yaml
@@ -1,6 +1,4 @@
----
-
-# Copyright 2018-present Open Networking Foundation
+# Copyright 2017-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -17,27 +15,17 @@
 apiVersion: v1
 kind: Service
 metadata:
-  name: {{ template "onos.fullname" . }}
+  name: {{ template "onos.fullname" . }}-ui
   labels:
     app: {{ template "onos.name" . }}
     chart: {{ template "onos.chart" . }}
     release: {{ .Release.Name }}
     heritage: {{ .Release.Service }}
 spec:
-  clusterIP: None
+  type: {{ .Values.services.serviceType }}
   ports:
-    - port: {{ .Values.services.ovsdb.port }}
-      targetPort: ovsdb
-      name: ovsdb
-    - port: {{ .Values.services.openflow.port }}
-      targetPort: openflow
-      name: openflow
-    - port: {{ .Values.services.ssh.port }}
-      targetPort: ssh
-      name: ssh
-    - port: {{ .Values.services.ui.port }}
-      targetPort: ui
-      name: ui
+  - name: ui
+{{ toYaml .Values.services.ui | indent 4 }}
   selector:
     app: {{ template "onos.name" . }}
     release: {{ .Release.Name }}