-
Notifications
You must be signed in to change notification settings - Fork 4
/
gcp.yaml
26 lines (26 loc) · 2.81 KB
/
gcp.yaml
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
create_service_account: "gcloud iam service-accounts create {g_service_account_name}+ " --display-name {g_service_account_name}
create_key: "gcloud iam service-accounts keys create "+cwd+"/gcp/{g_authorization_file} +" --iam-account {g_service_account_name}+"@{g_project}+".iam.gserviceaccount.com"
get_policy: "gcloud iam service-accounts get-iam-policy {g_service_account_name}+"@{g_project}+".iam.gserviceaccount.com --format json > "+cwd+"gcp/policy.json"
set_policy: "gcloud iam service-accounts set-iam-policy {g_service_account_name}+"@{g_project}+".iam.gserviceaccount.com "+cwd+"/gcp/policy.json"
login: "gcloud auth login"
login_sa: "gcloud auth activate-service-account --key-file "+cwd+"/gcp/{g_authorization_file}
helm: "kubectl --namespace kube-system create sa tiller && kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller && helm init --service-account tiller"
create_project: "gcloud projects create {g_project}+" --set-as-default"
set_project: "gcloud config set project {g_project}
set_zone: "gcloud config set compute/zone {g_zone}
create: "gcloud container clusters create {g_cluster_name}+" --num-nodes="+str({g_num_nodes})+" --machine-type={g_machine_type}+" --zone={g_zone}+ " --cluster-version={g_cluster_version}
#create_gpu: "gcloud container clusters create {g_cluster_name}+" --num-nodes="+str({g_num_nodes})+" --machine-type={g_machine_type}+" --zone={g_zone}+ " --cluster-version={g_cluster_version} +
get_credentials: "gcloud container clusters get-credentials {g_cluster_name}
stop: "gcloud container clusters resize {g_cluster_name}+" --size=0 --quiet"
normal_size: "gcloud container clusters resize {g_cluster_name}+" --size="+str({g_num_nodes})+" --quiet"
class_size: "gcloud container clusters resize {g_cluster_name}+" --size="+str({g_num_nodes_class})+" --quiet"
delete: "gcloud container clusters delete {g_cluster_name}+" --zone={g_zone}+" --quiet"
autoscale: "gcloud alpha container clusters update {g_cluster_name}+" --enable-autoscaling --min-nodes="+str({g_num_nodes})+" --max-nodes="+str({g_max_nodes})+" --zone={g_zone}+" --node-pool=default-pool"
create_fixedip: "gcloud compute addresses create {g_fixedip_namespace}+" --region={g_region}
describe_fixedip: "gcloud compute addresses describe {g_fixedip_namespace}+" --region={g_region}
delete_forwarding_rule: "gcloud compute forwarding-rules delete forwarding_rule --quiet"
delete_fixedip: "gcloud compute addresses delete {g_fixedip_namespace}+" --region={g_region}+" --quiet"
describe_cluster: "gcloud container clusters describe {g_cluster_name}
rbac: "kubectl create clusterrolebinding cluster-admin-binding --clusterrole=cluster-admin --user={email}
#backup_ssh: "mkdir "+cwd+"/.ssh &&"+ "cp ~/.ssh/id_rsa "+cwd+"/.ssh/id_rsa_{cluster_name}+"&& cp ~/.ssh/id_rsa.pub "+cwd+"/.ssh/id_rsa_{cluster_name}+".pub"
return commands