[EDGEPOD-160] Add google application for Aether
Change-Id: Idaa77616aa3f83a29372c5754c431d4c4ac1c661
diff --git a/aether-apps/google-phylo/Chart.yaml b/aether-apps/google-phylo/Chart.yaml
new file mode 100644
index 0000000..3c70cbd
--- /dev/null
+++ b/aether-apps/google-phylo/Chart.yaml
@@ -0,0 +1,20 @@
+# Copyright 2020-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.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+---
+apiVersion: v1
+description: Google Video Analytics Application for Aether
+name: google-phylo
+
+version: 0.1.0
diff --git a/aether-apps/google-phylo/templates/_helpers.tpl b/aether-apps/google-phylo/templates/_helpers.tpl
new file mode 100644
index 0000000..bf90988
--- /dev/null
+++ b/aether-apps/google-phylo/templates/_helpers.tpl
@@ -0,0 +1,94 @@
+{{- /*
+# Copyright 2020-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.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+*/ -}}
+
+{{/*
+Renders a set of standardised labels
+*/}}
+{{- define "phylo.metadata_labels" -}}
+{{- $application := index . 0 -}}
+{{- $context := index . 1 -}}
+release: {{ $context.Release.Name }}
+app: {{ $application }}
+{{- end -}}
+
+{{/*
+Render the given template.
+*/}}
+{{- define "phylo.template" -}}
+{{- $name := index . 0 -}}
+{{- $context := index . 1 -}}
+{{- $last := base $context.Template.Name }}
+{{- $wtf := $context.Template.Name | replace $last $name -}}
+{{ include $wtf $context }}
+{{- end -}}
+
+{{/*
+Render ServiceAccount, Role, and RoleBinding required for kubernetes-entrypoint.
+*/}}
+{{- define "phylo.service_account" -}}
+{{- $context := index . 1 -}}
+{{- $saName := index . 0 -}}
+{{- $saNamespace := $context.Release.Namespace }}
+---
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: {{ $saName }}
+ namespace: {{ $saNamespace }}
+ labels:
+{{ tuple $saName $context | include "phylo.metadata_labels" | indent 4 }}
+---
+apiVersion: rbac.authorization.k8s.io/v1beta1
+kind: RoleBinding
+metadata:
+ name: {{ $saName }}
+ namespace: {{ $saNamespace }}
+ labels:
+{{ tuple $saName $context | include "phylo.metadata_labels" | indent 4 }}
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: Role
+ name: {{ $saName }}
+subjects:
+ - kind: ServiceAccount
+ name: {{ $saName }}
+ namespace: {{ $saNamespace }}
+---
+apiVersion: rbac.authorization.k8s.io/v1beta1
+kind: Role
+metadata:
+ name: {{ $saName }}
+ namespace: {{ $saNamespace }}
+ labels:
+{{ tuple $saName $context | include "phylo.metadata_labels" | indent 4 }}
+rules:
+ - apiGroups:
+ - ""
+ - extensions
+ - batch
+ - apps
+ verbs:
+ - get
+ - list
+ resources:
+ - statefulsets
+ - daemonsets
+ - jobs
+ - pods
+ - services
+ - endpoints
+ - configmaps
+{{- end -}}
diff --git a/aether-apps/google-phylo/templates/bin/_run-video-analytics-server.sh.tpl b/aether-apps/google-phylo/templates/bin/_run-video-analytics-server.sh.tpl
new file mode 100644
index 0000000..4bd7729
--- /dev/null
+++ b/aether-apps/google-phylo/templates/bin/_run-video-analytics-server.sh.tpl
@@ -0,0 +1,27 @@
+#!/bin/bash
+#
+# Copyright 2020-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.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+/google/video_analytics_server_main \
+ --mediapipe_graph_path=/google/demo_graph.pbtxt \
+ --person_detection_tf_saved_model_dir=/google/saved_model/ \
+ --camera_scene_geometry_path=/google/camera_scene_geometry.pbtxt \
+ --grpc_port=50051 \
+ --mq_address=localhost:5672 \
+ --mediapipe_detection_topic_name=phylo.mediapipe_detection \
+ --person_detection_topic_name=phylo.person_detection \
+ --bbox_decoded_video_frame_topic_name=phylo.bbox_decoded_video_frame \
+ --publish_to_mq=true \
+ --publish_to_log=true
diff --git a/aether-apps/google-phylo/templates/configmap-phylo.yaml b/aether-apps/google-phylo/templates/configmap-phylo.yaml
new file mode 100644
index 0000000..c10b501
--- /dev/null
+++ b/aether-apps/google-phylo/templates/configmap-phylo.yaml
@@ -0,0 +1,25 @@
+{{- /*
+# Copyright 2020-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.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+*/ -}}
+
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: phylo
+ labels:
+{{ tuple "phylo" . | include "phylo.metadata_labels" | indent 4 }}
+data:
+ run-video-analytics-server.sh: |
+{{ tuple "bin/_run-video-analytics-server.sh.tpl" . | include "phylo.template" | indent 4 }}
diff --git a/aether-apps/google-phylo/templates/deployment-phylo.yaml b/aether-apps/google-phylo/templates/deployment-phylo.yaml
new file mode 100644
index 0000000..bea130b
--- /dev/null
+++ b/aether-apps/google-phylo/templates/deployment-phylo.yaml
@@ -0,0 +1,143 @@
+{{- /*
+# Copyright 2020-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.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+*/ -}}
+
+{{ tuple "phylo" . | include "phylo.service_account" }}
+
+{{ $context := . }}
+{{ range .Values.config.phylo.sources }}
+{{- $name := printf "%s-%s" "phylo" .key -}}
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: {{ $name }}
+ labels:
+{{ tuple $name $context | include "phylo.metadata_labels" | indent 4 }}
+spec:
+ selector:
+ matchLabels:
+{{ tuple $name $context | include "phylo.metadata_labels" | indent 6 }}
+ template:
+ metadata:
+ labels:
+{{ tuple $name $context | include "phylo.metadata_labels" | indent 8 }}
+ spec:
+ {{- if $context.Values.nodeSelectors.enabled }}
+ nodeSelector:
+ {{ $context.Values.nodeSelectors.phylo.label }}: {{ $context.Values.nodeSelectors.phylo.value }}
+ {{- end }}
+ serviceAccountName: phylo
+ initContainers:
+ - name: phylo-dep-check
+ image: {{ $context.Values.images.tags.depCheck | quote }}
+ imagePullPolicy: {{ $context.Values.images.pullPolicy }}
+ securityContext:
+ allowPrivilegeEscalation: false
+ readOnlyRootFilesystem: false
+ runAsUser: 0
+ env:
+ - name: POD_NAME
+ valueFrom:
+ fieldRef:
+ apiVersion: v1
+ fieldPath: metadata.name
+ - name: NAMESPACE
+ valueFrom:
+ fieldRef:
+ apiVersion: v1
+ fieldPath: metadata.namespace
+ - name: PATH
+ value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/
+ - name: COMMAND
+ value: "echo done"
+ - name: DEPENDENCY_POD_JSON
+ value: '[{"labels": {"app": "wowza"}, "requireSameNode": false}]'
+ # add dependency job for make_certs.sh
+ command:
+ - kubernetes-entrypoint
+ volumeMounts:
+ []
+ containers:
+ - name: rabbitmq
+ image: {{ $context.Values.images.tags.phyloRabbitmq }}
+ imagePullPolicy: {{ $context.Values.images.pullPolicy }}
+ {{- if $context.Values.resources.enabled }}
+ resources:
+{{ toYaml $context.Values.resources.phyloRabbitmq | indent 10 }}
+ {{- end }}
+ - name: video-analytics-server
+ image: {{ $context.Values.images.tags.videoAnalyticsServer | quote }}
+ imagePullPolicy: {{ $context.Values.images.pullPolicy }}
+ env:
+ - name: GLOG_logtostderr
+ value: "1"
+ command: ["/bin/bash","-xc","sleep 60 && /bin/run-video-analytics-server.sh"]
+ resources:
+ {{- if $context.Values.resources.enabled }}
+{{ toYaml $context.Values.resources.videoAnalyticsServer | indent 10 }}
+ {{- end }}
+ volumeMounts:
+ - name: script
+ mountPath: /bin/run-video-analytics-server.sh
+ readOnly: true
+ subPath: run-video-analytics-server.sh
+ - name: camera-ingestion
+ image: {{ $context.Values.images.tags.cameraIngestion | quote }}
+ imagePullPolicy: {{ $context.Values.images.pullPolicy }}
+ env:
+ - name: GLOG_logtostderr
+ value: "1"
+ - name: SOURCE_URI
+ value: {{ .uri }}
+ command: ["/bin/bash","-xc","sleep 90 && /google/run.sh"]
+ {{- if $context.Values.resources.enabled }}
+ resources:
+{{ toYaml $context.Values.resources.cameraIngestion | indent 10 }}
+ {{- end }}
+ - name: phylo-rabbitmq-pubsub
+ image: {{ $context.Values.images.tags.phyloRabbitmqPubsub }}
+ imagePullPolicy: {{ $context.Values.images.pullPolicy }}
+ {{- if $context.Values.resources.enabled }}
+ resources:
+{{ toYaml $context.Values.resources.phyloRabbitmqPubsub | indent 10 }}
+ {{- end }}
+ env:
+ - name: SOURCE_URI
+ value: {{ .uri }}
+ - name: RMQ_HOST_NAME
+ value: "0.0.0.0"
+ command: ["/bin/bash","-xc","sleep 120 && /google/run.sh"]
+ - name: phylo-rtsp-server
+ image: {{ $context.Values.images.tags.rtspServer }}
+ imagePullPolicy: {{ $context.Values.images.pullPolicy }}
+ {{- if $context.Values.resources.enabled }}
+ resources:
+{{ toYaml $context.Values.resources.rtspServer | indent 10 }}
+ {{- end }}
+ command: ["/bin/bash","-xc","sleep 150 && \
+ /google/rmq_rtsp_server_main \
+ --rmq_broker_address=localhost:5672 \
+ --rmq_exchange_name=phylo.bbox_decoded_video_frame \
+ --resize_width=640 \
+ --resize_height=480 \
+ --rtsp_port=8554 \
+ --rtsp_url_suffix=/live"]
+ volumes:
+ - name: script
+ configMap:
+ defaultMode: 0700
+ name: phylo
+{{ end }}
diff --git a/aether-apps/google-phylo/templates/deployment-wowza-server.yaml b/aether-apps/google-phylo/templates/deployment-wowza-server.yaml
new file mode 100644
index 0000000..f982142
--- /dev/null
+++ b/aether-apps/google-phylo/templates/deployment-wowza-server.yaml
@@ -0,0 +1,51 @@
+{{- /*
+# Copyright 2020-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.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+*/ -}}
+
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: wowza
+ labels:
+{{ tuple "wowza" . | include "phylo.metadata_labels" | indent 4 }}
+spec:
+ replicas: {{ .Values.config.wowza.replica }}
+ selector:
+ matchLabels:
+{{ tuple "wowza" . | include "phylo.metadata_labels" | indent 6 }}
+ template:
+ metadata:
+ labels:
+{{ tuple "wowza" . | include "phylo.metadata_labels" | indent 8 }}
+ spec:
+ {{- if .Values.nodeSelectors.enabled }}
+ nodeSelector:
+ {{ .Values.nodeSelectors.wowza.label }}: {{ .Values.nodeSelectors.wowza.value }}
+ {{- end }}
+ containers:
+ - name: wowza
+ image: {{ .Values.images.tags.wowza }}
+ imagePullPolicy: {{ .Values.images.pullPolicy }}
+ {{- if .Values.resources.enabled }}
+ resources:
+{{ toYaml .Values.resources.wowza | indent 10 }}
+ {{- end }}
+ volumeMounts:
+ - mountPath: /usr/local/WowzaStreamingEngine/data
+ name: wowza
+ volumes:
+ - name: wowza
+ emptyDir: {}
diff --git a/aether-apps/google-phylo/templates/service-phylo-rabbitmq.yaml b/aether-apps/google-phylo/templates/service-phylo-rabbitmq.yaml
new file mode 100644
index 0000000..e9662da
--- /dev/null
+++ b/aether-apps/google-phylo/templates/service-phylo-rabbitmq.yaml
@@ -0,0 +1,41 @@
+{{/*
+Copyright 2019-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.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/}}
+
+{{- $context := . -}}
+{{ range .Values.config.phylo.sources }}
+{{- $name := printf "%s-%s" "phylo" .key -}}
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: rabbitmq-{{ .key }}-external
+ labels:
+{{ tuple $name $context | include "phylo.metadata_labels" | indent 4 }}
+spec:
+ selector:
+{{ tuple $name $context | include "phylo.metadata_labels" | indent 4 }}
+ ports:
+ - port: 15672
+ targetPort: 15672
+ protocol: TCP
+ nodePort: 25672
+ name: tcp-15672
+ - port: 5672
+ targetPort: 5672
+ protocol: TCP
+ name: tcp-5672
+ type: NodePort
+{{ end }}
diff --git a/aether-apps/google-phylo/templates/service-phylo-rtsp-server.yaml b/aether-apps/google-phylo/templates/service-phylo-rtsp-server.yaml
new file mode 100644
index 0000000..80a2449
--- /dev/null
+++ b/aether-apps/google-phylo/templates/service-phylo-rtsp-server.yaml
@@ -0,0 +1,37 @@
+{{/*
+Copyright 2019-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.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/}}
+
+{{- $context := . -}}
+{{ range .Values.config.phylo.sources }}
+{{- $name := printf "%s-%s" "phylo" .key -}}
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: rtsp-server-{{ .key }}-external
+ labels:
+{{ tuple $name $context | include "phylo.metadata_labels" | indent 4 }}
+spec:
+ selector:
+{{ tuple $name $context | include "phylo.metadata_labels" | indent 4 }}
+ ports:
+ - port: 8554
+ targetPort: 8554
+ protocol: TCP
+ nodePort: 28554
+ name: tcp-8554
+ type: NodePort
+{{ end }}
diff --git a/aether-apps/google-phylo/templates/service-wowza.yaml b/aether-apps/google-phylo/templates/service-wowza.yaml
new file mode 100644
index 0000000..88e2647
--- /dev/null
+++ b/aether-apps/google-phylo/templates/service-wowza.yaml
@@ -0,0 +1,76 @@
+{{- /*
+# Copyright 2020-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.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+*/ -}}
+
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: wowza
+ labels:
+{{ tuple "wowza" . | include "phylo.metadata_labels" | indent 4 }}
+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:
+ selector:
+{{ tuple "wowza" . | include "phylo.metadata_labels" | indent 4 }}
+ type: NodePort
+ ports:
+ - name: management
+ port: 8088
+ protocol: TCP
+ nodePort: 30088
+ - name: rtmp
+ port: 1935 # RTMP/RTMPT/RTMPE/RTSP(interleaved)
+ targetPort: 1935
+ protocol: TCP
+ nodePort: 31935
diff --git a/aether-apps/google-phylo/values.yaml b/aether-apps/google-phylo/values.yaml
new file mode 100644
index 0000000..8caeb28
--- /dev/null
+++ b/aether-apps/google-phylo/values.yaml
@@ -0,0 +1,87 @@
+# Copyright 2020-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.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+images:
+ tags:
+ cameraIngestion: registry.central.aetherproject.net/google/phylo-camera-ingestion-client:latest
+ videoAnalyticsServer: registry.central.aetherproject.net/google/phylo-video-analytics-server:latest
+ phyloRabbitmq: registry.central.aetherproject.net/google/phylo-rabbitmq:latest
+ phyloRabbitmqPubsub: registry.central.aetherproject.net/google/phylo-rmq-pubsub:latest
+ rtspServer: registry.central.aetherproject.net/google/phylo_rmq-rtsp-server:0.2.0
+ rmqRestream: registry.central.aetherproject.net/google/phylo-rmq-restream:latest
+ wowza: registry.central.aetherproject.net/google/wowza:latest
+ depCheck: registry.central.aetherproject.net/kubernetes-entrypoint:v0.3.1
+ pullPolicy: "Always"
+
+nodeSelectors:
+ enabled: true
+ phylo:
+ label: google-phylo
+ value: enabled
+ wowza:
+ label: google-phylo
+ value: enabled
+
+resources:
+ enabled: false
+ rtspServer:
+ requests:
+ cpu: 2
+ memory: 2048Mi
+ limits:
+ cpu: 2
+ memory: 2048Mi
+ phyloRabbitmq:
+ requests:
+ cpu: 2
+ memory: 2048Mi
+ limits:
+ cpu: 2
+ memory: 2048Mi
+ phyloRabbitmqPubsub:
+ requests:
+ cpu: 2
+ memory: 2048Mi
+ limits:
+ cpu: 2
+ memory: 2048Mi
+ videoAnalyticsServer:
+ requests:
+ cpu: 5
+ memory: 2048Mi
+ limits:
+ cpu: 5
+ memory: 2048Mi
+ cameraIngestion:
+ requests:
+ cpu: 2
+ memory: 2048Mi
+ limits:
+ cpu: 2
+ memory: 2048Mi
+ wowza:
+ requests:
+ cpu: 2
+ memory: 2048Mi
+ limits:
+ cpu: 2
+ memory: 2048Mi
+
+config:
+ phylo:
+ sources:
+ - key: mystream
+ uri: rtmp://10.93.1.30:31935/live/myStream
+ wowza:
+ replica: 1