aboutsummaryrefslogtreecommitdiffstats
path: root/vnfs/DAaaS/applications/charts/sample-horovod-app/templates/config.yaml
diff options
context:
space:
mode:
authorRajamohan Raj <rajamohan.raj@intel.com>2019-04-11 00:36:20 +0000
committerRajamohan Raj <rajamohan.raj@intel.com>2019-04-11 00:36:20 +0000
commit9d98267fe7046c304a71f98e89de6774d09f094e (patch)
tree7e93353e9eff19a11e01a73ff5c176ec78513237 /vnfs/DAaaS/applications/charts/sample-horovod-app/templates/config.yaml
parent6fca0bf437c0917096a0105292514633c0ec3db3 (diff)
Add helm charts for horovod based app
Tasks in this patch: Create sample Tensorflow MNIST application using horovod: https://jira.onap.org/browse/ONAPARC-450 Change-Id: I50827a47f7c48574944cde28fca32f265b649b59 Issue-ID: ONAPARC-450 Signed-off-by: Rajamohan Raj <rajamohan.raj@intel.com>
Diffstat (limited to 'vnfs/DAaaS/applications/charts/sample-horovod-app/templates/config.yaml')
-rw-r--r--vnfs/DAaaS/applications/charts/sample-horovod-app/templates/config.yaml130
1 files changed, 130 insertions, 0 deletions
diff --git a/vnfs/DAaaS/applications/charts/sample-horovod-app/templates/config.yaml b/vnfs/DAaaS/applications/charts/sample-horovod-app/templates/config.yaml
new file mode 100644
index 00000000..ae93c445
--- /dev/null
+++ b/vnfs/DAaaS/applications/charts/sample-horovod-app/templates/config.yaml
@@ -0,0 +1,130 @@
+{{- $workerNum := .Values.worker.number -}}
+{{- $name := include "horovod.fullname" . }}
+{{- $slots := 1 }}
+{{- if index .Values.resources "nvidia.com/gpu" }}
+{{- $slots := index .Values.resources "nvidia.com/gpu" }}
+{{- end }}
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: {{ template "horovod.fullname" . }}
+ labels:
+ heritage: {{ .Release.Service | quote }}
+ release: {{ .Release.Name | quote }}
+ chart: {{ template "horovod.chart" . }}
+ app: {{ template "horovod.fullname" . }}
+data:
+ hostfile.config: |
+ {{ $name }}-master slots={{ $slots }}
+ {{- range $i, $none := until (int $workerNum) }}
+ {{ $name }}-{{ $i }}.{{ $name }} slots={{ $slots }}
+ {{- end }}
+ ssh.readiness: |
+ #!/bin/bash
+ set -xev
+ ssh localhost ls
+ master.run: |
+ #!/bin/bash
+ set -x
+ sleep 5
+
+ mkdir -p /root/.ssh
+ rm -f /root/.ssh/config
+ touch /root/.ssh/config
+
+ if [ "$USESECRETS" == "true" ];then
+ set +e
+ yes | cp /etc/secret-volume/id_rsa /root/.ssh/id_rsa
+ yes | cp /etc/secret-volume/authorized_keys /root/.ssh/authorized_keys
+ set -e
+ fi
+
+ if [ -n "$SSHPORT" ]; then
+ echo "Port $SSHPORT" > /root/.ssh/config
+ sed -i "s/^Port.*/Port $SSHPORT /g" /etc/ssh/sshd_config
+ fi
+ echo "StrictHostKeyChecking no" >> /root/.ssh/config
+ /usr/sbin/sshd
+
+ if [ $# -eq 0 ]; then
+ sleep infinity
+ else
+ bash -c "$*"
+ fi
+ sleep 300
+ master.waitWorkerReady: |
+ #!/bin/bash
+ set -xev
+ function updateSSHPort() {
+ mkdir -p /root/.ssh
+ rm -f /root/.ssh/config
+ touch /root/.ssh/config
+
+ if [ -n "$SSHPORT" ]; then
+ echo "Port $SSHPORT" > /root/.ssh/config
+ echo "StrictHostKeyChecking no" >> /root/.ssh/config
+ fi
+ }
+
+ function runCheckSSH() {
+ if [[ "$USESECRETS" == "true" ]];then
+ set +e
+ yes | cp /etc/secret-volume/id_rsa /root/.ssh/id_rsa
+ yes | cp /etc/secret-volume/authorized_keys /root/.ssh/authorized_keys
+ set -e
+ fi
+
+ for i in `cat $1 | awk '{print $(1)}'`;do
+ if [[ "$i" != *"master" ]];then
+ retry 30 ssh -o ConnectTimeout=2 -q $i exit
+ fi
+ done
+ }
+
+ function retry()
+ {
+ local n=0;local try=$1
+ local cmd="${@: 2}"
+ [[ $# -le 1 ]] && {
+ echo "Usage $0 <retry_number> <Command>";
+ }
+ set +e
+ until [[ $n -ge $try ]]
+ do
+ $cmd && break || {
+ echo "Command Fail.."
+ ((n++))
+ echo "retry $n :: [$cmd]"
+ sleep 1;
+ }
+ done
+ $cmd
+ if [ $? -ne 0 ]; then
+ exit 1
+ fi
+ set -e
+ }
+ updateSSHPort
+ runCheckSSH $1
+ worker.run: |
+ #!/bin/bash
+ set -x
+
+ mkdir -p /root/.ssh
+ rm -f /root/.ssh/config
+ touch /root/.ssh/config
+
+ if [[ "$USESECRETS" == "true" ]];then
+ set +e
+ yes | cp /etc/secret-volume/id_rsa /root/.ssh/id_rsa
+ yes | cp /etc/secret-volume/authorized_keys /root/.ssh/authorized_keys
+ set -e
+ fi
+
+ if [ -n "$SSHPORT" ]; then
+ echo "Port $SSHPORT" > /root/.ssh/config
+ sed -i "s/^Port.*/Port $SSHPORT /g" /etc/ssh/sshd_config
+ fi
+ echo "StrictHostKeyChecking no" >> /root/.ssh/config
+
+ /usr/sbin/sshd -D