Skip to content

Commit

Permalink
simplify gke-start.sh
Browse files Browse the repository at this point in the history
Signed-off-by: denis-tingaikin <denis.tingajkin@xored.com>
  • Loading branch information
denis-tingaikin committed May 4, 2023
1 parent 535e3e7 commit 5b45d9d
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions scripts/gke/gke-start.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
#!/bin/bash

if ! gcloud container clusters list --project="${GKE_PROJECT_ID}" | grep -q ^"${GKE_CLUSTER_NAME}"; then \
gcloud components install gke-gcloud-auth-plugin
gcloud components update
time gcloud container clusters create "${GKE_CLUSTER_NAME}" --project="${GKE_PROJECT_ID}" --machine-type="${GKE_CLUSTER_TYPE}" --num-nodes=1 --zone="${GKE_CLUSTER_ZONE}" -q; \
echo "Writing config to ${KUBECONFIG}"; \
gcloud container clusters get-credentials "${GKE_CLUSTER_NAME}" --project="${GKE_PROJECT_ID}" --zone="${GKE_CLUSTER_ZONE}" ; \
kubectl create clusterrolebinding cluster-admin-binding \
--clusterrole cluster-admin \
--user "$(gcloud config get-value account)"; \
git clone https://github.com/coredns/deployment.git; \
./deployment/kubernetes/deploy.sh | kubectl apply -f -; \
kubectl scale --replicas=0 deployment/kube-dns-autoscaler --namespace=kube-system; \
kubectl scale --replicas=0 deployment/kube-dns --namespace=kube-system; \
rm -rf deployment; \
fi
gcloud components install gke-gcloud-auth-plugin
gcloud components update
time gcloud container clusters create "${GKE_CLUSTER_NAME}" --project="${GKE_PROJECT_ID}" --machine-type="${GKE_CLUSTER_TYPE}" --num-nodes=1 --zone="${GKE_CLUSTER_ZONE}" -q
echo "Writing config to ${KUBECONFIG}"
gcloud container clusters get-credentials "${GKE_CLUSTER_NAME}" --project="${GKE_PROJECT_ID}" --zone="${GKE_CLUSTER_ZONE}"
kubectl create clusterrolebinding cluster-admin-binding --clusterrole cluster-admin --user "$(gcloud config get-value account)"
git clone https://github.com/coredns/deployment.git
./deployment/kubernetes/deploy.sh | kubectl apply -f -
kubectl scale --replicas=0 deployment/kube-dns-autoscaler --namespace=kube-system
kubectl scale --replicas=0 deployment/kube-dns --namespace=kube-system
rm -rf deployment

0 comments on commit 5b45d9d

Please sign in to comment.