Skip to content

Commit 8dc5223

Browse files
authored
Merge pull request #10 from davidz627/fix/projectSetup
Fixed project setup scripts
2 parents 95bf743 + f148d7a commit 8dc5223

File tree

5 files changed

+42
-12
lines changed

5 files changed

+42
-12
lines changed

deploy/kubernetes/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ $ ./deploy/kubernetes/deploy_driver.sh
1414
```
1515
3. Create example PVC and Pod
1616
```
17-
$ kubectl create -f ./examples/demo-pod.yaml
17+
$ kubectl apply -f ./examples/demo-pod.yaml
1818
```

deploy/kubernetes/delete-driver.sh

100644100755
+6-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
#!/bin/bash
22

3-
kubectl delete -f node.yaml
4-
kubectl delete -f controller.yaml
3+
set -o nounset
4+
set -o errexit
5+
6+
kubectl delete -f node.yaml --ignore-not-found
7+
kubectl delete -f controller.yaml --ignore-not-found
8+
kubectl delete -f setup-cluster.yaml --ignore-not-found

deploy/kubernetes/deploy-driver.sh

100644100755
+11-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
#!/bin/bash
2-
source ./common.sh
3-
kubectl create secret generic cloud-sa --from-file=$SA_FILE
4-
kubectl create -f setup-cluster.yaml
5-
kubectl create -f node.yaml
6-
kubectl create -f controller.yaml
2+
3+
set -o nounset
4+
set -o errexit
5+
6+
if ! kubectl get secret cloud-sa;
7+
then
8+
kubectl create secret generic cloud-sa --from-file="${SA_FILE}"
9+
fi
10+
kubectl apply -f setup-cluster.yaml
11+
kubectl apply -f node.yaml
12+
kubectl apply -f controller.yaml

deploy/setup-project.sh

100644100755
+15-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
#!/bin/bash
22

3-
IAM_NAME="$GCEPD_SA_NAME@$PROJECT.iam.gserviceaccount.com"
4-
gcloud iam service-accounts create $GCEPD_SA_NAME
5-
gcloud iam service-accounts keys create $SA_FILE --iam-account $IAM_NAME
6-
gcloud projects add-iam-policy-binding $PROJECT --member serviceAccount:$IAM_NAME --role roles/compute.storageAdmin roles/compute.admin
3+
set -o nounset
4+
set -o errexit
5+
6+
IAM_NAME="${GCEPD_SA_NAME}@${PROJECT}.iam.gserviceaccount.com"
7+
8+
# Cleanup old Service Account and Key
9+
rm -f "${SA_FILE}"
10+
gcloud iam service-accounts delete "${IAM_NAME}" --quiet
11+
# TODO: Delete ALL policy bindings
12+
13+
# Create new Service Account and Keys
14+
gcloud iam service-accounts create "${GCEPD_SA_NAME}"
15+
gcloud iam service-accounts keys create "${SA_FILE}" --iam-account "${IAM_NAME}"
16+
# TODO: Reduce scope of role to only what it necessary when cloud IAM fixes bugs.
17+
gcloud projects add-iam-policy-binding "${PROJECT}" --member serviceAccount:"${IAM_NAME}" --role roles/owner

test/run-tests.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
set -e
4+
set -x
5+
6+
readonly PKGDIR=github.com/kubernetes-sigs/gcp-compute-persistent-disk-csi-driver
7+
8+
go test -timeout 30s "${PKGDIR}/test/sanity/" -run ^TestSanity$
9+
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

0 commit comments

Comments
 (0)