Skip to content

Commit

Permalink
Update kubeapply (#180)
Browse files Browse the repository at this point in the history
* Add pointer to Kubernetes setup instructions

* Update kubeapply.sh to do deployments and not fetch the SA

Co-authored-by: Martin Petkov <mpetkov@google.com>
  • Loading branch information
MartinPetkov and MartinPetkov authored Apr 20, 2020
1 parent 91cd517 commit 161b9df
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
5 changes: 4 additions & 1 deletion Terraform/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
These directories define the entire GCP infrastructure app to run the FDA
MyStudies application.

## Pre-Requisites
## Prerequisites

1. Install the following dependencies and add them to your PATH:

Expand Down Expand Up @@ -155,5 +155,8 @@ To see what resources each deployment provisions, check out the comments in each
1. Follow `$ROOT/cicd/README.md` to set up CICD pipelines for Terraform
configs.

1. Follow `$ROOT/kubernetes/README.md` to deploy the Kubernetes resources in
the GKE cluster.

1. Revoke your super admin access by running `gcloud auth revoke` and
authenticate as a normal user for daily activities.
File renamed without changes.
19 changes: 12 additions & 7 deletions kubernetes/kubeapply.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
# Short helper script to run repetitive commands for Kubernetes deployments.
# Args:
# kubeapply.sh <project> <region> <cluster>
#
#
# It does the following:
# * Activate sthe cluster for kubectl via `gcloud container clusters get-credentials`.
# * Activates the cluster for kubectl via `gcloud container clusters get-credentials`.
# * Applies the pod security policies.
# * Applies the heroes-hat cert configuration.
# * Applies the cert configuration.
# * Applies all deployments from children of the parent folder.
# * Applies all services from children of the parent folder.
# * Applies the ingress configuration
#
Expand All @@ -29,8 +30,6 @@ shift 1

set -e

serviceaccount="$(gcloud container clusters describe "${cluster}" --region="us-east1" --project="heroes-hat-dev-apps" --format='value(nodeConfig.serviceAccount)')"

echo "=== Switching kubectl to cluster ${cluster} ==="
read -p "Press enter to continue"
gcloud container clusters get-credentials "${cluster}" --region="us-east1" --project="heroes-hat-dev-apps"
Expand All @@ -41,9 +40,15 @@ for policy in $(find . -name "pod_security_policy*.yaml"); do
kubectl apply -f ${policy}
done

echo '=== Applying heroes-hat-cert.yaml ==='
echo '=== Applying cert.yaml ==='
read -p "Press enter to continue"
kubectl apply -f ./heroes-hat-cert.yaml
kubectl apply -f ./cert.yaml

for deployment in $(find .. -name "deployment.yaml"); do
echo "=== Applying deployment ${deployment} ==="
read -p "Press enter to continue"
kubectl apply -f ${deployment}
done

for service in $(find .. -name "service.yaml"); do
echo "=== Applying service ${service} ==="
Expand Down

0 comments on commit 161b9df

Please sign in to comment.