Skip to content

Fixed project setup scripts #10

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

Merged
merged 1 commit into from
Jun 20, 2018
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
2 changes: 1 addition & 1 deletion deploy/kubernetes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ $ ./deploy/kubernetes/deploy_driver.sh
```
3. Create example PVC and Pod
```
$ kubectl create -f ./examples/demo-pod.yaml
$ kubectl apply -f ./examples/demo-pod.yaml
```
8 changes: 6 additions & 2 deletions deploy/kubernetes/delete-driver.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/bash

kubectl delete -f node.yaml
kubectl delete -f controller.yaml
set -o nounset
set -o errexit

kubectl delete -f node.yaml --ignore-not-found
kubectl delete -f controller.yaml --ignore-not-found
kubectl delete -f setup-cluster.yaml --ignore-not-found
16 changes: 11 additions & 5 deletions deploy/kubernetes/deploy-driver.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#!/bin/bash
source ./common.sh
kubectl create secret generic cloud-sa --from-file=$SA_FILE
kubectl create -f setup-cluster.yaml
kubectl create -f node.yaml
kubectl create -f controller.yaml

set -o nounset
set -o errexit

if ! kubectl get secret cloud-sa;
then
kubectl create secret generic cloud-sa --from-file="${SA_FILE}"
fi
kubectl apply -f setup-cluster.yaml
kubectl apply -f node.yaml
kubectl apply -f controller.yaml
19 changes: 15 additions & 4 deletions deploy/setup-project.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
#!/bin/bash

IAM_NAME="$GCEPD_SA_NAME@$PROJECT.iam.gserviceaccount.com"
gcloud iam service-accounts create $GCEPD_SA_NAME
gcloud iam service-accounts keys create $SA_FILE --iam-account $IAM_NAME
gcloud projects add-iam-policy-binding $PROJECT --member serviceAccount:$IAM_NAME --role roles/compute.storageAdmin roles/compute.admin
set -o nounset
set -o errexit

IAM_NAME="${GCEPD_SA_NAME}@${PROJECT}.iam.gserviceaccount.com"

# Cleanup old Service Account and Key
rm -f "${SA_FILE}"
gcloud iam service-accounts delete "${IAM_NAME}" --quiet
# TODO: Delete ALL policy bindings

# Create new Service Account and Keys
gcloud iam service-accounts create "${GCEPD_SA_NAME}"
gcloud iam service-accounts keys create "${SA_FILE}" --iam-account "${IAM_NAME}"
# TODO: Reduce scope of role to only what it necessary when cloud IAM fixes bugs.
gcloud projects add-iam-policy-binding "${PROJECT}" --member serviceAccount:"${IAM_NAME}" --role roles/owner
9 changes: 9 additions & 0 deletions test/run-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

set -e
set -x

readonly PKGDIR=github.com/kubernetes-sigs/gcp-compute-persistent-disk-csi-driver

go test -timeout 30s "${PKGDIR}/test/sanity/" -run ^TestSanity$
go run "$GOPATH/src/${PKGDIR}/test/remote/run_remote/run_remote.go" --logtostderr --v 2 --project "${PROJECT}" --zone "${ZONE}" --ssh-env gce --delete-instances=false --cleanup=false --results-dir=my_test