Change directory name cdn-services to ott-services
Change-Id: I868d1370c25051c01cf94b7696e68a8099dccc09
diff --git a/ott-services/cdn-remote/Chart.yaml b/ott-services/cdn-remote/Chart.yaml
new file mode 100644
index 0000000..b98a185
--- /dev/null
+++ b/ott-services/cdn-remote/Chart.yaml
@@ -0,0 +1,20 @@
+---
+# 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.
+
+apiVersion: v1
+appVersion: "1.0"
+description: A Helm chart for M-CORD CDN Services in Remote Edge
+name: cdn-remote
+version: 0.2.2
diff --git a/ott-services/cdn-remote/templates/_helpers.tpl b/ott-services/cdn-remote/templates/_helpers.tpl
new file mode 100644
index 0000000..13c5543
--- /dev/null
+++ b/ott-services/cdn-remote/templates/_helpers.tpl
@@ -0,0 +1,104 @@
+{{- /*
+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.
+*/ -}}
+
+{{/*
+Renders a set of standardised labels
+*/}}
+{{- define "cdn-remote.metadata_labels" -}}
+{{- $application := index . 0 -}}
+{{- $context := index . 1 -}}
+release: {{ $context.Release.Name }}
+app: {{ $application }}
+{{- end -}}
+
+{{/*
+Render the given template.
+*/}}
+{{- define "cdn-remote.template" -}}
+{{- $name := index . 0 -}}
+{{- $context := index . 1 -}}
+{{- $last := base $context.Template.Name }}
+{{- $wtf := $context.Template.Name | replace $last $name -}}
+{{ include $wtf $context }}
+{{- end -}}
+
+{{/*
+Get Domain name
+*/}}
+{{- define "cdn-remote.get_domain" -}}
+{{- $service := index . 0 -}}
+{{- $context := index . 1 -}}
+{{- printf "%s-0.%s.%s.%s" $service $service $context.Release.Namespace "svc.cluster.local" -}}
+{{- end -}}
+
+{{/*
+Render ServiceAccount, Role, and RoleBinding required for kubernetes-entrypoint.
+*/}}
+{{- define "cdn-remote.service_account" -}}
+{{- $saName := index . 0 -}}
+{{- $context := index . 1 -}}
+{{- $saNamespace := $context.Release.Namespace }}
+---
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: {{ $saName }}
+ namespace: {{ $saNamespace }}
+ labels:
+{{ tuple $saName $context | include "cdn-remote.metadata_labels" | indent 4 }}
+---
+apiVersion: rbac.authorization.k8s.io/v1beta1
+kind: RoleBinding
+metadata:
+ name: {{ $saName }}
+ namespace: {{ $saNamespace }}
+ labels:
+{{ tuple $saName $context | include "cdn-remote.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 "cdn-remote.metadata_labels" | indent 4 }}
+rules:
+ - apiGroups:
+ - ""
+ - extensions
+ - batch
+ - apps
+ verbs:
+ - get
+ - list
+ - patch
+ resources:
+ - statefulsets
+ - daemonsets
+ - jobs
+ - pods
+ - services
+ - endpoints
+ - configmaps
+{{- end -}}
\ No newline at end of file
diff --git a/ott-services/cdn-remote/templates/bin/_start-stream.sh.tpl b/ott-services/cdn-remote/templates/bin/_start-stream.sh.tpl
new file mode 100644
index 0000000..2d928b3
--- /dev/null
+++ b/ott-services/cdn-remote/templates/bin/_start-stream.sh.tpl
@@ -0,0 +1,21 @@
+#!/bin/bash
+#
+# 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.
+
+QUALITY=$1
+
+while true; do
+ ffmpeg -re -i /opt/cdn/movies/$QUALITY.mp4 -c copy -f flv rtmp://{{ tuple "ant-media" . | include "cdn-remote.get_domain" }}:1935/LiveApp/$QUALITY;
+done
\ No newline at end of file
diff --git a/ott-services/cdn-remote/templates/configmap-video-archive.yaml b/ott-services/cdn-remote/templates/configmap-video-archive.yaml
new file mode 100644
index 0000000..ce73787
--- /dev/null
+++ b/ott-services/cdn-remote/templates/configmap-video-archive.yaml
@@ -0,0 +1,26 @@
+{{/*
+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.
+*/}}
+
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: start-stream
+ labels:
+{{ tuple "ant-media" . | include "cdn-remote.metadata_labels" | indent 4 }}
+data:
+ start-stream.sh: |
+{{ tuple "bin/_start-stream.sh.tpl" . | include "cdn-remote.template" | indent 4 }}
diff --git a/ott-services/cdn-remote/templates/service-ant-media.yaml b/ott-services/cdn-remote/templates/service-ant-media.yaml
new file mode 100644
index 0000000..ba31e53
--- /dev/null
+++ b/ott-services/cdn-remote/templates/service-ant-media.yaml
@@ -0,0 +1,54 @@
+{{/*
+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.
+*/}}
+
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: ant-media
+ labels:
+{{ tuple "ant-media" . | include "cdn-remote.metadata_labels" | indent 4 }}
+spec:
+ selector:
+{{ tuple "ant-media" . | include "cdn-remote.metadata_labels" | indent 4 }}
+ ports:
+ - name: httpui
+ port: {{ .Values.config.antMedia.ports.httpui }}
+ protocol: TCP
+ - name: rtmp
+ port: {{ .Values.config.antMedia.ports.rtmp }}
+ protocol: TCP
+
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: ant-media-external
+ labels:
+{{ tuple "ant-media" . | include "cdn-remote.metadata_labels" | indent 4 }}
+spec:
+ selector:
+{{ tuple "ant-media" . | include "cdn-remote.metadata_labels" | indent 4 }}
+ type: NodePort
+ ports:
+ - name: httpui
+ port: {{ .Values.config.antMedia.ports.httpui }}
+ protocol: TCP
+ nodePort: {{ .Values.config.antMedia.ports.nodePorts.httpui }}
+ - name: rtmp
+ port: {{ .Values.config.antMedia.ports.rtmp }}
+ protocol: TCP
+ nodePort: {{ .Values.config.antMedia.ports.nodePorts.rtmp }}
diff --git a/ott-services/cdn-remote/templates/statefulset-ant-media.yaml b/ott-services/cdn-remote/templates/statefulset-ant-media.yaml
new file mode 100644
index 0000000..1e9778a
--- /dev/null
+++ b/ott-services/cdn-remote/templates/statefulset-ant-media.yaml
@@ -0,0 +1,57 @@
+{{/*
+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.
+*/}}
+
+{{ tuple "ant-media" . | include "cdn-remote.service_account" }}
+---
+apiVersion: apps/v1
+kind: StatefulSet
+metadata:
+ name: ant-media
+ labels:
+{{ tuple "ant-media" . | include "cdn-remote.metadata_labels" | indent 4 }}
+spec:
+ replicas: {{ .Values.config.antMedia.replicas }}
+ selector:
+ matchLabels:
+{{ tuple "ant-media" . | include "cdn-remote.metadata_labels" | indent 6 }}
+ serviceName: "ant-media"
+ template:
+ metadata:
+ labels:
+{{ tuple "ant-media" . | include "cdn-remote.metadata_labels" | indent 8 }}
+ spec:
+ {{- if .Values.nodeSelectors.enabled }}
+ nodeSelector:
+ {{ .Values.nodeSelectors.antMedia.label }}: {{ .Values.nodeSelectors.antMedia.value }}
+ {{- end }}
+ serviceAccountName: ant-media
+ containers:
+ - name: ant-media
+ image: {{ .Values.images.tags.antMedia | quote }}
+ imagePullPolicy: {{ .Values.images.pullPolicy }}
+ securityContext:
+ allowPrivilegeEscalation: false
+ readOnlyRootFilesystem: false
+ runAsUser: 0
+ stdin: true
+ tty: true
+ command: [ "bash", "-xc"]
+ args:
+ - cd /usr/local/antmedia && ./start.sh | tee /opt/start.log
+ {{- if .Values.resources.enabled }}
+ resources:
+{{ toYaml .Values.resources.antMedia | indent 10 }}
+ {{- end }}
\ No newline at end of file
diff --git a/ott-services/cdn-remote/templates/statefulset-video-archive.yaml b/ott-services/cdn-remote/templates/statefulset-video-archive.yaml
new file mode 100644
index 0000000..4f515d1
--- /dev/null
+++ b/ott-services/cdn-remote/templates/statefulset-video-archive.yaml
@@ -0,0 +1,135 @@
+{{/*
+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.
+*/}}
+
+{{ tuple "video-archive" . | include "cdn-remote.service_account" }}
+---
+apiVersion: apps/v1
+kind: StatefulSet
+metadata:
+ name: video-archive
+ labels:
+{{ tuple "video-archive" . | include "cdn-remote.metadata_labels" | indent 4 }}
+spec:
+ replicas: {{ .Values.config.videoArchive.replicas }}
+ selector:
+ matchLabels:
+{{ tuple "video-archive" . | include "cdn-remote.metadata_labels" | indent 6 }}
+ serviceName: "video-archive"
+ template:
+ metadata:
+ labels:
+{{ tuple "video-archive" . | include "cdn-remote.metadata_labels" | indent 8 }}
+ spec:
+ {{- if .Values.nodeSelectors.enabled }}
+ nodeSelector:
+ {{ .Values.nodeSelectors.videoArchive.label }}: {{ .Values.nodeSelectors.videoArchive.value }}
+ {{- end }}
+ serviceAccountName: video-archive
+ initContainers:
+ - name: video-archive-dep-check
+ image: {{ .Values.images.tags.depCheck | quote }}
+ imagePullPolicy: {{ .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": "ant-media"}, "requireSameNode": false}]'
+ command:
+ - kubernetes-entrypoint
+ volumeMounts:
+ []
+ containers:
+ - name: streaming-720
+ image: {{ .Values.images.tags.videoArchive | quote }}
+ imagePullPolicy: {{ .Values.images.pullPolicy }}
+ securityContext:
+ allowPrivilegeEscalation: false
+ readOnlyRootFilesystem: false
+ runAsUser: 0
+ stdin: true
+ tty: true
+ command: [ "bash", "-xc"]
+ args:
+ - /opt/start-stream.sh 720
+ {{- if .Values.resources.enabled }}
+ resources:
+{{ toYaml .Values.resources.videoArchive | indent 10 }}
+ {{- end }}
+ volumeMounts:
+ - name: start-script
+ mountPath: /opt/start-stream.sh
+ subPath: start-stream.sh
+ - name: streaming-480
+ image: {{ .Values.images.tags.videoArchive | quote }}
+ imagePullPolicy: {{ .Values.images.pullPolicy }}
+ securityContext:
+ allowPrivilegeEscalation: false
+ readOnlyRootFilesystem: false
+ runAsUser: 0
+ stdin: true
+ tty: true
+ command: [ "bash", "-xc"]
+ args:
+ - /opt/start-stream.sh 480
+ {{- if .Values.resources.enabled }}
+ resources:
+{{ toYaml .Values.resources.videoArchive | indent 10 }}
+ {{- end }}
+ volumeMounts:
+ - name: start-script
+ mountPath: /opt/start-stream.sh
+ subPath: start-stream.sh
+ - name: streaming-360
+ image: {{ .Values.images.tags.videoArchive | quote }}
+ imagePullPolicy: {{ .Values.images.pullPolicy }}
+ securityContext:
+ allowPrivilegeEscalation: false
+ readOnlyRootFilesystem: false
+ runAsUser: 0
+ stdin: true
+ tty: true
+ command: [ "bash", "-xc"]
+ args:
+ - /opt/start-stream.sh 360
+ {{- if .Values.resources.enabled }}
+ resources:
+{{ toYaml .Values.resources.videoArchive | indent 10 }}
+ {{- end }}
+ volumeMounts:
+ - name: start-script
+ mountPath: /opt/start-stream.sh
+ subPath: start-stream.sh
+ volumes:
+ - name: start-script
+ configMap:
+ name: start-stream
+ defaultMode: 493
\ No newline at end of file
diff --git a/ott-services/cdn-remote/values.yaml b/ott-services/cdn-remote/values.yaml
new file mode 100644
index 0000000..3cc4542
--- /dev/null
+++ b/ott-services/cdn-remote/values.yaml
@@ -0,0 +1,59 @@
+---
+# 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.
+
+images:
+ tags:
+ videoArchive: docker.io/omecproject/cdn-video-repo:1.0.0
+ antMedia: docker.io/omecproject/cdn-antmedia:1.0.0
+ depCheck: quay.io/stackanetes/kubernetes-entrypoint:v0.3.1
+ pullPolicy: IfNotPresent
+
+nodeSelectors:
+ enabled: false
+ videoArchive:
+ label: videoArchive
+ value: enabled
+ antMedia:
+ label: antMedia
+ value: enabled
+
+resources:
+ enabled: true
+ videoArchive:
+ requests:
+ cpu: 3
+ memory: 1Gi
+ limits:
+ cpu: 3
+ memory: 1Gi
+ antMedia:
+ requests:
+ cpu: 3
+ memory: 1Gi
+ limits:
+ cpu: 3
+ memory: 1Gi
+
+config:
+ videoArchive:
+ replicas: 1
+ antMedia:
+ ports:
+ httpui: 5080
+ rtmp: 1935
+ nodePorts:
+ httpui: 32080
+ rtmp: 30935
+ replicas: 1