Skip to content

Commit

Permalink
Update deps, fix linter errors (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
majst01 authored Jan 20, 2023
1 parent 38a90fa commit baf8fcb
Show file tree
Hide file tree
Showing 10 changed files with 170 additions and 816 deletions.
18 changes: 14 additions & 4 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Go 1.18
- name: Set up Go 1.19
uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: 1.19

- name: Lint
uses: golangci/golangci-lint-action@v3
Expand All @@ -43,8 +43,13 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Go 1.19
uses: actions/setup-go@v3
with:
go-version: 1.19

- name: Create k8s Kind Cluster
uses: helm/kind-action@v1.3.0
uses: helm/kind-action@v1.5.0
with:
install_only: true

Expand All @@ -63,7 +68,7 @@ jobs:

steps:
- name: Log in to the container registry
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKER_REGISTRY_USER }}
Expand All @@ -72,6 +77,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Go 1.19
uses: actions/setup-go@v3
with:
go-version: 1.19

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.18-alpine as builder
FROM golang:1.19-alpine as builder
RUN apk add make binutils git
COPY / /work
WORKDIR /work
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,7 @@ test: build-plugin build-provisioner
--network host \
csi-bats \
--verbose-run --trace --timing bats/test.bats

.PHONY: test-cleanup
test-cleanup:
@kind delete cluster --name csi-driver-lvm
61 changes: 21 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,64 +38,45 @@ If you want to migrate your existing PVC to / from csi-driver-lvm, you can use [

* implement CreateSnapshot(), ListSnapshots(), DeleteSnapshot()

## Development ###

TL;DR:
### Test ###

```bash
./start-minikube-on-linux.sh
helm install --repo https://helm.metal-stack.io mytest helm/csi-driver-lvm --set lvm.devicePattern='/dev/loop[0-1]'
```
kubectl apply -f examples/csi-pvc-raw.yaml
kubectl apply -f examples/csi-pod-raw.yaml

### Start minikube and create dummy volumes ###

```bash
minikube start --memory 4g
minikube ssh 'for i in 0 1; do fallocate -l 1G loop${i} ; sudo losetup -f loop${i}; sudo losetup -a ; done'
```
kubectl apply -f examples/csi-pvc.yaml
kubectl apply -f examples/csi-app.yaml

On minikube we have to copy a "real" losetup:
kubectl delete -f examples/csi-pod-raw.yaml
kubectl delete -f examples/csi-pvc-raw.yaml

In minikube losetup is a symlink to busybox.
kubectl delete -f examples/csi-app.yaml
kubectl delete -f examples/csi-pvc.yaml
```

The busybox implentation of losetup lacks some flags on which the kubernetes currently depends on.
(see <https://github.com/kubernetes/kubernetes/issues/83265> )
## Development ###

```bash
minikube ssh 'sudo rm /sbin/losetup'
scp -o 'StrictHostKeyChecking=no' -i $(minikube ssh-key) /usr/sbin/losetup docker@$(minikube ip):/tmp/losetup
minikube ssh 'sudo mv /tmp/losetup /sbin/losetup'
```
In order to run the integration tests locally, you need to create to loop devices on your host machine. Make sure the loop device mount paths are not used on your system (default path is `/dev/loop10{1,2}`).

### Build ###
You can create these loop devices like this:

```bash
make
docker build
docker push
for i in 100 101; do fallocate -l 1G loop${i}.img ; sudo losetup /dev/loop${i} loop${i}.img; done
sudo losetup -a
# use this for recreation or cleanup
# for i in 100 101; do sudo losetup -d /dev/loop${i}; rm -f loop${i}.img; done
```

Replace metalstack/lvmplugin:latest image in helm/csi-driver-lvm/values.yaml

### Deploy ###
You can then run the tests against a kind cluster, running:

```bash
helm install --repo https://helm.metal-stack.io mytest helm/csi-driver-lvm
make test
```

### Test ###
To recreate or cleanup the kind cluster:

```bash
kubectl apply -f examples/csi-pvc-raw.yaml
kubectl apply -f examples/csi-pod-raw.yaml


kubectl apply -f examples/csi-pvc.yaml
kubectl apply -f examples/csi-app.yaml

kubectl delete -f examples/csi-pod-raw.yaml
kubectl delete -f examples/csi-pvc-raw.yaml

kubectl delete -f examples/csi-app.yaml
kubectl delete -f examples/csi-pvc.yaml
make test-cleanup
```
4 changes: 2 additions & 2 deletions cmd/provisioner/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM golang:1.18-alpine as builder
FROM golang:1.19-alpine as builder
RUN apk add make binutils
COPY / /work
WORKDIR /work
RUN make provisioner

FROM alpine:3.14
FROM alpine:3.16
LABEL maintainers="Metal Authors"
LABEL description="LVM Driver"

Expand Down
64 changes: 36 additions & 28 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,47 +1,55 @@
module github.com/metal-stack/csi-driver-lvm

go 1.18
go 1.19

require (
github.com/container-storage-interface/spec v1.6.0
github.com/docker/go-units v0.4.0
github.com/kubernetes-csi/csi-lib-utils v0.11.0
github.com/urfave/cli/v2 v2.6.0
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6
google.golang.org/grpc v1.46.0
k8s.io/api v0.23.6
k8s.io/apimachinery v0.23.6
k8s.io/client-go v0.23.6
k8s.io/klog/v2 v2.30.0
github.com/container-storage-interface/spec v1.7.0
github.com/docker/go-units v0.5.0
github.com/kubernetes-csi/csi-lib-utils v0.12.0
github.com/urfave/cli/v2 v2.23.7
golang.org/x/net v0.5.0
golang.org/x/sys v0.4.0
google.golang.org/grpc v1.52.0
k8s.io/api v0.26.0
k8s.io/apimachinery v0.26.0
k8s.io/client-go v0.26.0
k8s.io/klog/v2 v2.80.1
)

require (
github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-logr/logr v1.2.0 // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.1 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.6 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/googleapis/gnostic v0.5.5 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
golang.org/x/oauth2 v0.4.0 // indirect
golang.org/x/term v0.4.0 // indirect
golang.org/x/text v0.6.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4 // indirect
google.golang.org/protobuf v1.27.1 // indirect
google.golang.org/genproto v0.0.0-20230119192704-9d59e20e5cd1 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 // indirect
sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/kube-openapi v0.0.0-20230118215034-64b6bb138190 // indirect
k8s.io/utils v0.0.0-20230115233650-391b47cb4029 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
Loading

0 comments on commit baf8fcb

Please sign in to comment.