Skip to content

Commit dd8a88b

Browse files
committed
Update deployment scripts and README's
1 parent e0fdcf1 commit dd8a88b

File tree

9 files changed

+81
-26
lines changed

9 files changed

+81
-26
lines changed

deploy/docker/Dockerfile renamed to Dockerfile

+7-5
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

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

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

19-
RUN yum -y install "*/mkfs.ext4"
20-
21-
ENTRYPOINT ["/gce-csi-driver"]
23+
ENTRYPOINT ["/gce-pd-csi-driver"]

Makefile

+3-5
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,16 @@ gce-pd-driver:
2525
go build -o bin/gce-pd-csi-driver-test ./test/e2e/
2626

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

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

3433
prod-build-container: gce-pd-driver
35-
cp bin/gce-pd-csi-driver deploy/docker
36-
docker build -t $(PRODIMAGE):$(PRODVERSION) deploy/docker
34+
docker build -t $(PRODIMAGE):$(PRODVERSION)
3735

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

4139
test-sanity: gce-pd-driver
42-
go test -timeout 30s github.com/kubernetes-sigs/gcp-compute-persistent-disk-csi-driver/pkg/test -run ^TestSanity$
40+
go test -timeout 30s github.com/kubernetes-sigs/gcp-compute-persistent-disk-csi-driver/pkg/test -run ^TestSanity$

README.md

+36-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,40 @@ Specification compliant driver used by Container Orchestrators to manage the
1010
lifecycle of Google Compute Engine Persistent Disks.
1111

1212
## Installing
13+
### Kubernetes
1314
Templates and further information for installing this driver on Kubernetes are
14-
in deploy/kubernetes/
15+
in [`./deploy/kubernetes/README.md`](deployREADME)
16+
17+
## Development
18+
19+
###Manual
20+
21+
Setup [GCP service account first](deployREADME) (one time step)
22+
23+
To bring up developed drivers:
24+
```
25+
$ make push-container
26+
$ ./deploy/kubernetes/deploy-driver.sh
27+
```
28+
29+
To bring down drivers:
30+
```
31+
$ ./deploy/kubernetes/delete-driver.sh
32+
```
33+
34+
## Testing
35+
Unit tests in `_test` files in the same package as the functions tested.
36+
37+
Sanity and E2E tests can be found in `./test/` and more detailed testing
38+
information is in [`./test/README.md`](testREADME)
39+
40+
## Dependency Management
41+
Use [dep](https://github.com/golang/dep)
42+
```
43+
$ dep ensure
44+
```
45+
46+
To modify dependencies or versions change `./Gopkg.toml`
47+
48+
[deployREADME]: github.com/kubernetes-sigs/gcp-compute-persistent-disk-csi-driver/deploy/kubernetes/README.md
49+
[testREADME]: github.com/kubernetes-sigs/gcp-compute-persistent-disk-csi-driver/test/README.md

deploy/kubernetes/README.md

+18-15
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
Step 1 (Create Credentials):
2-
Create Service Account Credential JSON on GCP:
3-
- TODO: Add detailed steps on how to do this
4-
- Requires both Compute Owner and Cloud Project Owner permissions
5-
Create Kubernetes secret:
6-
-kubectl create secret generic cloud-sa --from-file=cloud-sa.json
7-
Modify "controller.yaml" to use your secret
8-
9-
Step 2 (Set up Driver):
10-
kubectl create -f setup.yaml
11-
kubectl create -f node.yaml
12-
kubectl create -f controller.yaml
13-
14-
Step 3 (Run demo [optional]):
15-
kubectl create -f demo-pod.yaml
1+
1. One-time per project: Create GCP service account for CSI driver
2+
1. Export environment variables for location for service account private key file and name of the service account
3+
```
4+
$ export SA_FILE=~/.../cloud-sa.json
5+
$ export GCEPD_SA_NAME=sample-service-account
6+
```
7+
2. Setup project with script
8+
```
9+
$ ./deploy/setup_project.sh
10+
```
11+
2. Deploy driver to Kubernetes cluster
12+
```
13+
$ ./deploy/kubernetes/deploy_driver.sh
14+
```
15+
3. Create example PVC and Pod
16+
```
17+
$ kubectl create -f ./examples/demo-pod.yaml
18+
```

deploy/kubernetes/delete-driver.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
kubectl delete -f node.yaml
4+
kubectl delete -f controller.yaml

deploy/kubernetes/deploy-driver.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/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
File renamed without changes.

deploy/setup-project.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
source ./common.sh
4+
IAM_NAME="$GCEPD_SA_NAME@$PROJECT.iam.gserviceaccount.com"
5+
gcloud iam service-accounts create $GCEPD_SA_NAME
6+
gcloud iam service-accounts keys create $SA_FILE --iam-account $IAM_NAME
7+
gcloud projects add-iam-policy-binding $PROJECT --member serviceAccount:$IAM_NAME --role roles/compute.storageAdmin roles/compute.admin
File renamed without changes.

0 commit comments

Comments
 (0)