-
Notifications
You must be signed in to change notification settings - Fork 89
/
Copy pathupgrade_app.sh
executable file
·128 lines (111 loc) · 4.16 KB
/
upgrade_app.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/bin/bash
#
# A simple script to recreate the Kubeflow app for kubeflow-dev.
# The purpose of this script is to make it easy to pull in the latest
# release.
#
# By design this script doesn't actually modify the current deployment
# (e.g. delete the current namespace or apply the deployment)
#
# Usage:
# upgrade_app.sh [latest|stable]
# - latest points to the master branch
# - stable points to the last stable release branch
set -ex
API_VERSION=v1.7.0
# Configure parameters for latest and stable environments
if [ "$1" = "latest" ]
then
VERSION="master"
NAMESPACE=kubeflow-latest
APP_NAME=kubeflow-latest_ks_app
FQDN=dev-latest.kubeflow.org
IP_NAME="kubeflow-latest-ip"
USAGE_ID=a9cfe6c1-0e75-44aa-8fc0-a44db63611dc
elif [ "$1" = "stable" ]
then
# Which version of Kubeflow to use
# For a list of releases refer to:
# https://github.com/kubeflow/kubeflow/releases
VERSION="v0.2.2"
NAMESPACE=kubeflow
APP_NAME=ks-app
FQDN=dev.kubeflow.org
IP_NAME="kubeflow-tf-hub"
USAGE_ID=f85740a3-5f60-4146-91b6-2ab7089cf01c
else
echo "Must specify either 'latest' or 'stable'"
exit -1
fi
KUBEFLOW_CLOUD="gke"
ZONE=${ZONE:-$(gcloud config get-value compute/zone 2>/dev/null)}
ZONE=${ZONE:-"us-central1-a"}
GCFS_INSTANCE=${GCFS_INSTANCE:-"${DEPLOYMENT_NAME}"}
GCFS_STORAGE=${GCFS_STORAGE:-"1T"}
GCFS_INSTANCE_IP_ADDRESS=$(gcloud beta filestore instances describe \
${GCFS_INSTANCE} --location ${ZONE} | \
grep --after-context=1 ipAddresses | \
tail -1 | \
awk '{print $2}')
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
GIT_ROOT="$(git rev-parse --show-toplevel)"
cd ${DIR}
APP_DIR=${DIR}/${APP_NAME}
cd ${APP_NAME}
REGISTRY=github.com/kubeflow/kubeflow/tree/${VERSION}/kubeflow
python <(curl -s https://raw.githubusercontent.com/kubeflow/kubeflow/${VERSION}/scripts/upgrade_ks_app.py) \
--app_dir=${APP_DIR} \
--registry=${REGISTRY}
# Remove components so we can regenerate them from the updated
# prototypes
ks component rm google-cloud-filestore-pv
ks component rm pytorch-operator
ks component rm jupyterhub
ks component rm ambassador
ks component rm centraldashboard
ks component rm tf-job-operator
ks component rm spartakus
ks component rm cert-manager
ks component rm iap-ingress
# Install all required packages
set +e
ks pkg install kubeflow/argo
ks pkg install kubeflow/core
ks pkg install kubeflow/examples
ks pkg install kubeflow/katib
ks pkg install kubeflow/mpi-job
ks pkg install kubeflow/pytorch-job
ks pkg install kubeflow/seldon
ks pkg install kubeflow/tf-serving
set -e
# Create templates for core components
ks generate google-cloud-filestore-pv google-cloud-filestore-pv --name="kubeflow-gcfs" --storageCapacity="${GCFS_STORAGE}" --serverIP="${GCFS_INSTANCE_IP_ADDRESS}"
ks generate pytorch-operator pytorch-operator
ks generate ambassador ambassador --ambassadorImage="gcr.io/kubeflow-images-public/ambassador:0.30.1" --statsdImage="gcr.io/kubeflow-images-public/statsd:0.30.1" --cloud=${KUBEFLOW_CLOUD}
ks generate jupyterhub jupyterhub --cloud=${KUBEFLOW_CLOUD} --disks="kubeflow-gcfs"
ks generate centraldashboard centraldashboard
ks generate tf-job-operator tf-job-operator
ks generate spartakus spartakus
# Setup ingress
ACCOUNT=google-kubeflow-team@google.com
ks generate cert-manager cert-manager --acmeEmail=${ACCOUNT}
ks generate iap-ingress iap-ingress --namespace=${NAMESPACE} \
--ipName=${IP_NAME} \
--hostname="${FQDN}" \
--oauthSecretName="kubeflow-oauth"
ks param set jupyterhub jupyterHubAuthenticator iap
# Set the name of the PD for backing a NFS to hold github issue
# summarization model data
ks param set jupyterhub disks github-issues-data --env=default
# Enable a PVC backed by the default StorageClass
ks param set jupyterhub jupyterNotebookPVCMount /home/jovyan --env=default
# Enable collection of anonymous usage metrics
# Skip this step if you don't want to enable collection.
#
# We use the same usage id on redeployments so we won't conflate
# redeployments with unique clusters.
ks param set spartakus reportUsage true
ks param set spartakus usageId ${USAGE_ID}
# Run autoformat from the git root
cd ${GIT_ROOT}
bash <(curl -s https://raw.githubusercontent.com/kubeflow/kubeflow/${VERSION}/scripts/autoformat_jsonnet.sh)