Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update kubeapply #180

Merged
merged 5 commits into from
Apr 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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