Create separate service for streaming and input

LB cannot be created for a service with multiple protocols.

Change-Id: I7e10c9af20e87fda6eed1aa00ba632bb6d33391d
diff --git a/apps/person-detection-app/Chart.yaml b/apps/person-detection-app/Chart.yaml
index 25a79ff..1a7db19 100644
--- a/apps/person-detection-app/Chart.yaml
+++ b/apps/person-detection-app/Chart.yaml
@@ -18,7 +18,7 @@
 # This is the chart version. This version number should be incremented each time you make changes
 # to the chart and its templates, including the app version.
 # Versions are expected to follow Semantic Versioning (https://semver.org/)
-version: 0.1.2
+version: 0.1.3
 
 # This is the version number of the application being deployed. This version number should be
 # incremented each time you make changes to the application. Versions are not expected to
diff --git a/apps/person-detection-app/templates/NOTES.txt b/apps/person-detection-app/templates/NOTES.txt
index ef28adf..3315e01 100644
--- a/apps/person-detection-app/templates/NOTES.txt
+++ b/apps/person-detection-app/templates/NOTES.txt
@@ -10,16 +10,16 @@
   http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
   {{- end }}
 {{- end }}
-{{- else if contains "NodePort" .Values.service.type }}
+{{- else if contains "NodePort" .Values.service.streaming.type }}
   export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "person-detection-app.fullname" . }})
   export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
   echo http://$NODE_IP:$NODE_PORT
-{{- else if contains "LoadBalancer" .Values.service.type }}
+{{- else if contains "LoadBalancer" .Values.service.streaming.type }}
      NOTE: It may take a few minutes for the LoadBalancer IP to be available.
            You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "person-detection-app.fullname" . }}'
   export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "person-detection-app.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
-  echo http://$SERVICE_IP:{{ .Values.service.port }}
-{{- else if contains "ClusterIP" .Values.service.type }}
+  echo http://$SERVICE_IP:{{ .Values.service.streaming.port }}
+{{- else if contains "ClusterIP" .Values.service.streaming.type }}
   export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "person-detection-app.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
   export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
   echo "Visit http://127.0.0.1:8080 to use your application"
diff --git a/apps/person-detection-app/templates/ingress.yaml b/apps/person-detection-app/templates/ingress.yaml
index c9952ec..25822dd 100644
--- a/apps/person-detection-app/templates/ingress.yaml
+++ b/apps/person-detection-app/templates/ingress.yaml
@@ -6,7 +6,7 @@
 
 {{- if .Values.ingress.enabled -}}
 {{- $fullName := include "person-detection-app.fullname" . -}}
-{{- $svcPort := .Values.service.port -}}
+{{- $svcPort := .Values.service.streaming.port -}}
 {{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
   {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
   {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
@@ -55,11 +55,11 @@
             backend:
               {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
               service:
-                name: {{ $fullName }}
+                name: {{ $fullName }}-streaming
                 port:
                   number: {{ $svcPort }}
               {{- else }}
-              serviceName: {{ $fullName }}
+              serviceName: {{ $fullName }}-streaming
               servicePort: {{ $svcPort }}
               {{- end }}
           {{- end }}
diff --git a/apps/person-detection-app/templates/service.yaml b/apps/person-detection-app/templates/service.yaml
index caba73e..3b37784 100644
--- a/apps/person-detection-app/templates/service.yaml
+++ b/apps/person-detection-app/templates/service.yaml
@@ -7,17 +7,27 @@
 apiVersion: v1
 kind: Service
 metadata:
-  name: {{ include "person-detection-app.fullname" . }}
+  name: {{ include "person-detection-app.fullname" . }}-streaming
   labels:
     {{- include "person-detection-app.labels" . | nindent 4 }}
 spec:
-  type: {{ .Values.service.type }}
+  type: {{ .Values.service.streaming.type }}
   ports:
-    - port: {{ .Values.service.port }}
-      targetPort: http
+    - port: {{ .Values.service.streaming.port }}
       protocol: TCP
-      name: http
-    - port: {{ .Values.service.port }}
+  selector:
+    {{- include "person-detection-app.selectorLabels" . | nindent 4 }}
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: {{ include "person-detection-app.fullname" . }}-input
+  labels:
+    {{- include "person-detection-app.labels" . | nindent 4 }}
+spec:
+  type: {{ .Values.service.input.type }}
+  ports:
+    - port: {{ .Values.service.input.port }}
       protocol: UDP
   selector:
     {{- include "person-detection-app.selectorLabels" . | nindent 4 }}
diff --git a/apps/person-detection-app/templates/tests/test-connection.yaml b/apps/person-detection-app/templates/tests/test-connection.yaml
index 79766bb..23c6081 100644
--- a/apps/person-detection-app/templates/tests/test-connection.yaml
+++ b/apps/person-detection-app/templates/tests/test-connection.yaml
@@ -17,5 +17,5 @@
     - name: wget
       image: busybox
       command: ['wget']
-      args: ['{{ include "person-detection-app.fullname" . }}:{{ .Values.service.port }}']
+      args: ['{{ include "person-detection-app.fullname" . }}:{{ .Values.service.streaming.port }}']
   restartPolicy: Never
diff --git a/apps/person-detection-app/values.yaml b/apps/person-detection-app/values.yaml
index 6272fba..55475d2 100644
--- a/apps/person-detection-app/values.yaml
+++ b/apps/person-detection-app/values.yaml
@@ -48,8 +48,12 @@
   # runAsUser: 1000
 
 service:
-  type: NodePort
-  port: 5000
+  streaming:
+    type: ClusterIP
+    port: 5000
+  input:
+    type: LoadBalancer
+    port: 5000
 
 ingress:
   enabled: false