AETHER-986 Add support of user plane access to Google app

Change-Id: I749e0172f9393d1b33f0861270ff4cdf4563f133
diff --git a/apps/google-phylo/templates/deployment-phylo.yaml b/apps/google-phylo/templates/deployment-phylo.yaml
index 8e31eb3..0158711 100644
--- a/apps/google-phylo/templates/deployment-phylo.yaml
+++ b/apps/google-phylo/templates/deployment-phylo.yaml
@@ -1,9 +1,7 @@
 {{- /*
-
 # Copyright 2020-present Open Networking Foundation
 #
 # SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
-
 */ -}}
 
 {{ tuple "phylo" . | include "phylo.service_account" }}
@@ -26,11 +24,23 @@
     metadata:
       labels:
 {{ tuple $name $context | include "phylo.metadata_labels" | indent 8 }}
+    {{- if $context.Values.config.userPlane.enabled }}
+      annotations:
+        danm.k8s.io/interfaces: |
+          [
+            {"clusterNetwork": "default"},
+            {"clusterNetwork": {{ $context.Values.config.userPlane.name | quote }}, "ip": "dynamic"}
+          ]
+    {{- end }}
     spec:
     {{- if $context.Values.nodeSelectors.enabled }}
       nodeSelector:
         {{ $context.Values.nodeSelectors.phylo.label }}: {{ $context.Values.nodeSelectors.phylo.value }}
     {{- end }}
+    {{- if $context.Values.images.credentials }}
+      imagePullSecrets:
+        - name: {{ $context.Release.Name }}.registry
+    {{- end }}
       serviceAccountName: phylo
       initContainers:
       - name: phylo-dep-check
diff --git a/apps/google-phylo/templates/deployment-wowza-server.yaml b/apps/google-phylo/templates/deployment-wowza-server.yaml
index d9f7798..0ba1bd5 100644
--- a/apps/google-phylo/templates/deployment-wowza-server.yaml
+++ b/apps/google-phylo/templates/deployment-wowza-server.yaml
@@ -1,9 +1,7 @@
 {{- /*
-
 # Copyright 2020-present Open Networking Foundation
 #
 # SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
-
 */ -}}
 
 ---
@@ -22,11 +20,23 @@
     metadata:
       labels:
 {{ tuple "wowza" . | include "phylo.metadata_labels" | indent 8 }}
+    {{- if .Values.config.userPlane.enabled }}
+      annotations:
+        danm.k8s.io/interfaces: |
+          [
+            {"clusterNetwork": "default"},
+            {"clusterNetwork": {{ .Values.config.userPlane.name | quote }}, "ip": "dynamic"}
+          ]
+    {{- end }}
     spec:
     {{- if .Values.nodeSelectors.enabled }}
       nodeSelector:
         {{ .Values.nodeSelectors.wowza.label }}: {{ .Values.nodeSelectors.wowza.value }}
     {{- end }}
+    {{- if .Values.images.credentials }}
+      imagePullSecrets:
+        - name: {{ .Release.Name }}.registry
+    {{- end }}
       containers:
       - name: wowza
         image: {{ .Values.images.tags.wowza }}
diff --git a/apps/google-phylo/templates/secret-registry.yaml b/apps/google-phylo/templates/secret-registry.yaml
new file mode 100644
index 0000000..1502049
--- /dev/null
+++ b/apps/google-phylo/templates/secret-registry.yaml
@@ -0,0 +1,18 @@
+{{/*
+# Copyright 2020-present Open Networking Foundation
+
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+*/}}
+
+{{- if .Values.images.credentials }}
+---
+kind: Secret
+apiVersion: v1
+metadata:
+  name: {{ .Release.Name }}.registry
+  labels:
+    release: {{ .Release.Name }}
+type: kubernetes.io/dockerconfigjson
+data:
+  .dockerconfigjson: {{ printf `{"auths":{%s:{"auth":"%s"}}}` (.Values.images.credentials.registry | quote) (printf "%s:%s" .Values.images.credentials.username .Values.images.credentials.password | b64enc) | b64enc | quote }}
+{{- end }}
diff --git a/apps/google-phylo/templates/service-phylo-rabbitmq.yaml b/apps/google-phylo/templates/service-phylo-rabbitmq.yaml
index cdd7b0a..d788b74 100644
--- a/apps/google-phylo/templates/service-phylo-rabbitmq.yaml
+++ b/apps/google-phylo/templates/service-phylo-rabbitmq.yaml
@@ -11,7 +11,7 @@
 apiVersion: v1
 kind: Service
 metadata:
-  name: rabbitmq-{{ .key }}-external
+  name: rabbitmq-{{ .key }}
   labels:
 {{ tuple $name $context | include "phylo.metadata_labels" | indent 4 }}
 spec:
diff --git a/apps/google-phylo/templates/service-phylo-rtsp-server.yaml b/apps/google-phylo/templates/service-phylo-rtsp-server.yaml
index fd79bd1..22a0a81 100644
--- a/apps/google-phylo/templates/service-phylo-rtsp-server.yaml
+++ b/apps/google-phylo/templates/service-phylo-rtsp-server.yaml
@@ -11,16 +11,25 @@
 apiVersion: v1
 kind: Service
 metadata:
-  name: rtsp-server-{{ .key }}-external
+  name: rtsp-server-{{ .key }}
   labels:
 {{ tuple $name $context | include "phylo.metadata_labels" | indent 4 }}
+{{- if $context.Values.config.userPlane.enabled }}
+  annotations:
+    danm.k8s.io/clusterNetwork: {{ $context.Values.config.userPlane.name }}
+    danm.k8s.io/selector: '{"app": {{ $name | quote }}}'
+{{- end }}
 spec:
+{{- if $context.Values.config.userPlane.enabled }}
+  clusterIP: None
+{{- else }}
   selector:
 {{ tuple $name $context | include "phylo.metadata_labels" | indent 4 }}
+  type: NodePort
   ports:
     - port: 8554
       targetPort: 8554
       protocol: TCP
       name: tcp-8554
-  type: NodePort
+{{- end }}
 {{ end }}
diff --git a/apps/google-phylo/templates/service-wowza.yaml b/apps/google-phylo/templates/service-wowza.yaml
index 663ccde..09993bd 100644
--- a/apps/google-phylo/templates/service-wowza.yaml
+++ b/apps/google-phylo/templates/service-wowza.yaml
@@ -1,9 +1,7 @@
 {{- /*
-
 # Copyright 2020-present Open Networking Foundation
 #
 # SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
-
 */ -}}
 
 ---
@@ -13,46 +11,15 @@
   name: wowza
   labels:
 {{ tuple "wowza" . | include "phylo.metadata_labels" | indent 4 }}
+{{- if .Values.config.userPlane.enabled }}
+  annotations:
+    danm.k8s.io/clusterNetwork: {{ .Values.config.userPlane.name }}
+    danm.k8s.io/selector: '{"app": "wowza"}'
+{{- end }}
 spec:
-  selector:
-{{ tuple "wowza" . | include "phylo.metadata_labels" | indent 4 }}
-  ports:
-    - port: 554 #
-      targetPort: 554
-      protocol: TCP
-      name: tcp-554
-    - port: 1935 # RTMP/RTMPT/RTMPE/RTSP(interleaved)
-      targetPort: 1935
-      protocol: TCP
-      name: tcp-1935
-    - port: 8084 #
-      targetPort: 8084
-      protocol: TCP
-      name: tcp-8084
-    - port: 8085 #
-      targetPort: 8085
-      protocol: TCP
-      name: tcp-8085
-    - port: 8086 #
-      targetPort: 8086
-      protocol: TCP
-      name: tcp-8086
-    - port: 8087 #
-      targetPort: 8087
-      protocol: TCP
-      name: tcp-8087
-    - port: 8088 #
-      targetPort: 8088
-      protocol: TCP
-      name: tcp-8088
----
-apiVersion: v1
-kind: Service
-metadata:
-  name: wowza-external
-  labels:
-{{ tuple "wowza" . | include "phylo.metadata_labels" | indent 4 }}
-spec:
+{{- if .Values.config.userPlane.enabled }}
+  clusterIP: None
+{{- else }}
   selector:
 {{ tuple "wowza" . | include "phylo.metadata_labels" | indent 4 }}
   type: NodePort
@@ -66,3 +33,4 @@
       targetPort: 1935
       protocol: TCP
       nodePort: 31935
+{{- end }}