Skip to content

Commit

Permalink
Update deployment scripts and README's. Remove references to personal
Browse files Browse the repository at this point in the history
development project
  • Loading branch information
davidz627 committed Jun 18, 2018
1 parent e0fdcf1 commit 41060b3
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 29 deletions.
12 changes: 7 additions & 5 deletions deploy/docker/Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM fedora:26
FROM golang:1.10.1-alpine3.7 as builder
WORKDIR /go/src/github.com/kubernetes-sigs/gcp-compute-persistent-disk-csi-driver
ADD . .
RUN CGO_ENABLED=0 go build -a -ldflags '-extldflags "-static"' -o bin/gce-pd-csi-driver ./cmd/

COPY gce-csi-driver /gce-csi-driver
FROM alpine:3.7
COPY --from=builder /go/src/github.com/kubernetes-sigs/gcp-compute-persistent-disk-csi-driver/bin/gce-pd-csi-driver /gce-pd-csi-driver

RUN yum -y install "*/mkfs.ext4"

ENTRYPOINT ["/gce-csi-driver"]
ENTRYPOINT ["/gce-pd-csi-driver"]
10 changes: 4 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

STAGINGIMAGE=gcr.io/dyzz-csi-staging/csi/gce-pd-driver
STAGINGIMAGE=${GCE_PD_CSI_STAGING_IMAGE}
STAGINGVERSION=latest

PRODIMAGE=gcr.io/google-containers/volume-csi/compute-persistent-disk-csi-driver
Expand All @@ -25,18 +25,16 @@ gce-pd-driver:
go build -o bin/gce-pd-csi-driver-test ./test/e2e/

build-container: gce-pd-driver
cp bin/gce-pd-csi-driver deploy/docker
docker build -t $(STAGINGIMAGE):$(STAGINGVERSION) deploy/docker
docker build -t $(STAGINGIMAGE):$(STAGINGVERSION) .

push-container: build-container
gcloud docker -- push $(STAGINGIMAGE):$(STAGINGVERSION)

prod-build-container: gce-pd-driver
cp bin/gce-pd-csi-driver deploy/docker
docker build -t $(PRODIMAGE):$(PRODVERSION) deploy/docker
docker build -t $(PRODIMAGE):$(PRODVERSION)

prod-push-container: prod-build-container
gcloud docker -- push $(PRODIMAGE):$(PRODVERSION)

test-sanity: gce-pd-driver
go test -timeout 30s github.com/kubernetes-sigs/gcp-compute-persistent-disk-csi-driver/pkg/test -run ^TestSanity$
go test -timeout 30s github.com/kubernetes-sigs/gcp-compute-persistent-disk-csi-driver/pkg/test -run ^TestSanity$
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,40 @@ Specification compliant driver used by Container Orchestrators to manage the
lifecycle of Google Compute Engine Persistent Disks.

## Installing
### Kubernetes
Templates and further information for installing this driver on Kubernetes are
in deploy/kubernetes/
in [`./deploy/kubernetes/README.md`](deployREADME)

## Development

###Manual

Setup [GCP service account first](deployREADME) (one time step)

To bring up developed drivers:
```
$ make push-container
$ ./deploy/kubernetes/deploy-driver.sh
```

To bring down drivers:
```
$ ./deploy/kubernetes/delete-driver.sh
```

## Testing
Unit tests in `_test` files in the same package as the functions tested.

Sanity and E2E tests can be found in `./test/` and more detailed testing
information is in [`./test/README.md`](testREADME)

## Dependency Management
Use [dep](https://github.com/golang/dep)
```
$ dep ensure
```

To modify dependencies or versions change `./Gopkg.toml`

[deployREADME]: deploy/kubernetes/README.md
[testREADME]: test/README.md
33 changes: 18 additions & 15 deletions deploy/kubernetes/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
Step 1 (Create Credentials):
Create Service Account Credential JSON on GCP:
- TODO: Add detailed steps on how to do this
- Requires both Compute Owner and Cloud Project Owner permissions
Create Kubernetes secret:
-kubectl create secret generic cloud-sa --from-file=cloud-sa.json
Modify "controller.yaml" to use your secret

Step 2 (Set up Driver):
kubectl create -f setup.yaml
kubectl create -f node.yaml
kubectl create -f controller.yaml

Step 3 (Run demo [optional]):
kubectl create -f demo-pod.yaml
1. One-time per project: Create GCP service account for CSI driver
1. Export environment variables for location for service account private key file and name of the service account
```
$ export SA_FILE=~/.../cloud-sa.json
$ export GCEPD_SA_NAME=sample-service-account
```
2. Setup project with script
```
$ ./deploy/setup_project.sh
```
2. Deploy driver to Kubernetes cluster
```
$ ./deploy/kubernetes/deploy_driver.sh
```
3. Create example PVC and Pod
```
$ kubectl create -f ./examples/demo-pod.yaml
```
4 changes: 4 additions & 0 deletions deploy/kubernetes/delete-driver.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

kubectl delete -f node.yaml
kubectl delete -f controller.yaml
6 changes: 6 additions & 0 deletions deploy/kubernetes/deploy-driver.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/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
File renamed without changes.
6 changes: 6 additions & 0 deletions deploy/setup-project.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/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
2 changes: 2 additions & 0 deletions test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
How to run Dev tests:
go run test/remote/run_remote/run_remote.go --logtostderr --v 2 --project test-project --zone us-central1-c --ssh-env gce --delete-instances=false --cleanup=false --results-dir=my_test
2 changes: 0 additions & 2 deletions test/remote/run_remote/README

This file was deleted.

0 comments on commit 41060b3

Please sign in to comment.