forked from kubeflow/kubeflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create deploy job * move job to examples and remove options * make job a statefulset * move app to pvc * add TODOs * address review
- Loading branch information
1 parent
85a3283
commit 108313a
Showing
7 changed files
with
122 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ vendor/ | |
flymd.* | ||
|
||
# vim .swp files | ||
.swp | ||
*.swp | ||
|
||
# Files created by Gogland IDE | ||
.idea/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Shortcut script to run ks apply from within cluster | ||
ks apply default --token=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Deploy kubeflow to namespace "kubeflow" | ||
|
||
# TODO(inc0): Create rbac role bindings | ||
# Headless service because StatefulSet requires it | ||
--- | ||
kind: Service | ||
apiVersion: v1 | ||
metadata: | ||
name: kubeflow-toolbox | ||
spec: | ||
clusterIP: "None" | ||
|
||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: kubeflow-toolbox-pvc | ||
labels: | ||
app: kubeflow-toolbox | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 5Gi | ||
|
||
--- | ||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
name: kubeflow-toolbox | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: kubeflow-toolbox | ||
serviceName: kubeflow-toolbox | ||
template: | ||
metadata: | ||
name: kubeflow-toolbox | ||
labels: | ||
app: kubeflow-toolbox | ||
spec: | ||
containers: | ||
- name: kubeflow-toolbox | ||
image: gcr.io/kubeflow-images-public/bootstrapper | ||
env: | ||
- name: NAMESPACE | ||
value: "kubeflow" | ||
- name: DEPLOY_JOB | ||
value: "TRUE" | ||
volumeMounts: | ||
- name: kubeflow-toolbox-pvc | ||
mountPath: /opt/kubeflow/app | ||
volumes: | ||
- name: kubeflow-toolbox-pvc | ||
persistentVolumeClaim: | ||
claimName: kubeflow-toolbox-pvc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
# Fake kubeconfig file to embed into bootstrap image - tricks ksonnet to allow | ||
# running prefetch ops | ||
|
||
apiVersion: v1 | ||
clusters: | ||
- cluster: | ||
server: http://localhost | ||
name: fake | ||
contexts: | ||
- context: | ||
cluster: fake | ||
user: "" | ||
name: fake | ||
current-context: fake | ||
kind: Config | ||
preferences: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,33 @@ | ||
#!/bin/bash | ||
# | ||
# Startup script. | ||
# 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. | ||
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} | ||
su ${USER} |