blob: bea130bbf57beae1499b577e10d479149f1ff834 [file] [log] [blame]
Hyunsun Mooncbc41f12020-02-27 11:23:05 -08001{{- /*
2# Copyright 2020-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15*/ -}}
16
17{{ tuple "phylo" . | include "phylo.service_account" }}
18
19{{ $context := . }}
20{{ range .Values.config.phylo.sources }}
21{{- $name := printf "%s-%s" "phylo" .key -}}
22---
23apiVersion: apps/v1
24kind: Deployment
25metadata:
26 name: {{ $name }}
27 labels:
28{{ tuple $name $context | include "phylo.metadata_labels" | indent 4 }}
29spec:
30 selector:
31 matchLabels:
32{{ tuple $name $context | include "phylo.metadata_labels" | indent 6 }}
33 template:
34 metadata:
35 labels:
36{{ tuple $name $context | include "phylo.metadata_labels" | indent 8 }}
37 spec:
38 {{- if $context.Values.nodeSelectors.enabled }}
39 nodeSelector:
40 {{ $context.Values.nodeSelectors.phylo.label }}: {{ $context.Values.nodeSelectors.phylo.value }}
41 {{- end }}
42 serviceAccountName: phylo
43 initContainers:
44 - name: phylo-dep-check
45 image: {{ $context.Values.images.tags.depCheck | quote }}
46 imagePullPolicy: {{ $context.Values.images.pullPolicy }}
47 securityContext:
48 allowPrivilegeEscalation: false
49 readOnlyRootFilesystem: false
50 runAsUser: 0
51 env:
52 - name: POD_NAME
53 valueFrom:
54 fieldRef:
55 apiVersion: v1
56 fieldPath: metadata.name
57 - name: NAMESPACE
58 valueFrom:
59 fieldRef:
60 apiVersion: v1
61 fieldPath: metadata.namespace
62 - name: PATH
63 value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/
64 - name: COMMAND
65 value: "echo done"
66 - name: DEPENDENCY_POD_JSON
67 value: '[{"labels": {"app": "wowza"}, "requireSameNode": false}]'
68 # add dependency job for make_certs.sh
69 command:
70 - kubernetes-entrypoint
71 volumeMounts:
72 []
73 containers:
74 - name: rabbitmq
75 image: {{ $context.Values.images.tags.phyloRabbitmq }}
76 imagePullPolicy: {{ $context.Values.images.pullPolicy }}
77 {{- if $context.Values.resources.enabled }}
78 resources:
79{{ toYaml $context.Values.resources.phyloRabbitmq | indent 10 }}
80 {{- end }}
81 - name: video-analytics-server
82 image: {{ $context.Values.images.tags.videoAnalyticsServer | quote }}
83 imagePullPolicy: {{ $context.Values.images.pullPolicy }}
84 env:
85 - name: GLOG_logtostderr
86 value: "1"
87 command: ["/bin/bash","-xc","sleep 60 && /bin/run-video-analytics-server.sh"]
88 resources:
89 {{- if $context.Values.resources.enabled }}
90{{ toYaml $context.Values.resources.videoAnalyticsServer | indent 10 }}
91 {{- end }}
92 volumeMounts:
93 - name: script
94 mountPath: /bin/run-video-analytics-server.sh
95 readOnly: true
96 subPath: run-video-analytics-server.sh
97 - name: camera-ingestion
98 image: {{ $context.Values.images.tags.cameraIngestion | quote }}
99 imagePullPolicy: {{ $context.Values.images.pullPolicy }}
100 env:
101 - name: GLOG_logtostderr
102 value: "1"
103 - name: SOURCE_URI
104 value: {{ .uri }}
105 command: ["/bin/bash","-xc","sleep 90 && /google/run.sh"]
106 {{- if $context.Values.resources.enabled }}
107 resources:
108{{ toYaml $context.Values.resources.cameraIngestion | indent 10 }}
109 {{- end }}
110 - name: phylo-rabbitmq-pubsub
111 image: {{ $context.Values.images.tags.phyloRabbitmqPubsub }}
112 imagePullPolicy: {{ $context.Values.images.pullPolicy }}
113 {{- if $context.Values.resources.enabled }}
114 resources:
115{{ toYaml $context.Values.resources.phyloRabbitmqPubsub | indent 10 }}
116 {{- end }}
117 env:
118 - name: SOURCE_URI
119 value: {{ .uri }}
120 - name: RMQ_HOST_NAME
121 value: "0.0.0.0"
122 command: ["/bin/bash","-xc","sleep 120 && /google/run.sh"]
123 - name: phylo-rtsp-server
124 image: {{ $context.Values.images.tags.rtspServer }}
125 imagePullPolicy: {{ $context.Values.images.pullPolicy }}
126 {{- if $context.Values.resources.enabled }}
127 resources:
128{{ toYaml $context.Values.resources.rtspServer | indent 10 }}
129 {{- end }}
130 command: ["/bin/bash","-xc","sleep 150 && \
131 /google/rmq_rtsp_server_main \
132 --rmq_broker_address=localhost:5672 \
133 --rmq_exchange_name=phylo.bbox_decoded_video_frame \
134 --resize_width=640 \
135 --resize_height=480 \
136 --rtsp_port=8554 \
137 --rtsp_url_suffix=/live"]
138 volumes:
139 - name: script
140 configMap:
141 defaultMode: 0700
142 name: phylo
143{{ end }}