forked from GoogleCloudPlatform/ai-on-gke
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
84 lines (71 loc) · 2.77 KB
/
Makefile
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
current-project:= gcloud config get-value project 2> /dev/null
init:
gcloud init \
&& cd ./ray-on-gke/platform/ && terraform init \
&& cd ../user/ && terraform init \
&& cd ./jupyterhub/ && terraform init
gcloud-auth-cluster:
gcloud container clusters get-credentials $(NAME) --location $(LOCATION)
plan: PROJECT ?= $(shell $(current-project))
plan: LOCATION ?= us-central1-b
plan: NAME ?= ml-cluster
plan: AUTOPILOT ?= false
plan: TF-DIR ?= platform
plan:
cd ./ray-on-gke/$(TF-DIR)/ && terraform plan \
-var project_id=$(PROJECT) \
-var region=$(LOCATION) \
-var cluster_name=$(NAME) \
-var enable_autopilot=$(AUTOPILOT) \
create-cluster: PROJECT ?= $(shell $(current-project))
create-cluster: LOCATION ?= us-central1-b
create-cluster: NAME ?= ml-cluster
create-cluster: AUTOPILOT ?= false
create-cluster:
cd ./ray-on-gke/platform/ && \
terraform apply -auto-approve \
-var project_id=$(PROJECT) \
-var region=$(LOCATION) \
-var cluster_name=$(NAME) \
-var enable_autopilot=$(AUTOPILOT) \
&& cd ../../ && $(MAKE) gcloud-auth-cluster NAME=$(NAME) LOCATION=$(LOCATION)
build-user: PROJECT ?= $(shell $(current-project))
build-user: SA-ACCOUNT-NAME ?= ray
build-user: NAMESPACE ?= ray
build-user:
cd ./ray-on-gke/user/ && \
terraform apply -auto-approve \
-var project_id=$(PROJECT) \
-var service_account=$(SA-ACCOUNT-NAME) \
-var namespace=$(NAMESPACE)
build-jupyterhub: CREATE_NAMESPACE ?= false
build-jupyterhub: NAMESPACE ?= ray
build-jupyterhub:
cd ./ray-on-gke/user/jupyterhub/ \
&& terraform apply -auto-approve \
-var namespace=$(NAMESPACE) \
-var enable_create_namespace=$(CREATE_NAMESPACE) \
&& echo "IP of JupyterHub Ednpoint" \
&& cd ../../../ && $(MAKE) get-jupyter-ip NAMESAPCE=$(NAMESPACE)
get-jupyter-ip: NAMESPACE ?= ray
get-jupyter-ip:
kubectl get svc proxy-public --namespace=$(NAMESPACE) -o jsonpath="{.status.loadBalancer.ingress[0].ip}" && echo "\n"
destroy-everything: SA-ACCOUNT-NAME ?= ray
destroy-everything: NAMESPACE ?= ray
destroy-everything:
$(MAKE) delete-jupyterhub \
&& $(MAKE) delete-user-resource NAMESPACE=$(NAMESPACE) SA-ACCOUNT-NAME=$(SA-ACCOUNT-NAME) \
&& $(MAKE) delete-cluster
delete-cluster:
cd ./ray-on-gke/platform/ && terraform destroy -auto-approve
delete-user-resource: SA-ACCOUNT-NAME ?= ray
delete-user-resource: NAMESPACE ?= ray
delete-user-resource:
cd ./ray-on-gke/user/ && terraform destroy -auto-approve -var namespace=$(NAMESPACE) -var service_account=$(SA-ACCOUNT-NAME)
delete-jupyterhub:
cd ./ray-on-gke/user/jupyterhub && terraform destroy -auto-approve
clean-tfstate: TF-DIR ?= platform
clean-tfstate:
cd ./ray-on-gke/$(TF-DIR)/ && rm terraform.tfstate terraform.tfstate.backup
test-stuff:
echo "testing 123" && echo "here" && kubectl get svc proxy-public -o jsonpath="{.status.loadBalancer.ingress[0].ip}" && echo