forked from kubeflow/kubeflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
38 lines (35 loc) · 1.25 KB
/
start.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
#
# Startup script.
# The purpose of this script is to create a unix user
# with the same id as the user on the host system to
# that we can read the user's home directory on the host
# so that we can uss kubeconfig, gcloud config and other things.
#
# TODO(jlewi): Do we still need this script? I think
# switching the user to match the host system is a remnant
# of the original idea of running it on the host system.
# That's no longer a supported approach.
set -x
# If it's run by deployment job, don't switch users
if [ -v "DEPLOY_JOB" ]; then
cd /kubeflow
# Remove fake kubeconfig and start k8s proxy
rm ~/.kube/config
kubectl proxy --port=8111 &
# Recreate env since we have proper k8s creds
# TODO (inc0): Replace this with bootstrapper when we confirm that it works inside cluster
ks env rm default
ks env add default --server=http://127.0.0.1:8111
ks env set default --namespace ${NAMESPACE}
if [ ! -d /opt/kubeflow/app/kubeflow ]; then
ks generate kubeflow-core kubeflow-core
cp -R /kubeflow /opt/kubeflow/app
fi
cd /opt/kubeflow/app/kubeflow
tail -f /dev/null
fi
groupadd -g ${GROUP_ID} ${GROUP}
useradd -r -u ${USER_ID} -g ${GROUP} --shell=/bin/bash ${USER}
cd /home/${USER}
su ${USER}