Skip to content

Commit

Permalink
remove maxStorageCapacity restriction (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwennrich committed May 12, 2021
1 parent 1f79e43 commit 8700605
Show file tree
Hide file tree
Showing 10 changed files with 150 additions and 179 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM golang:1.15-alpine as builder
FROM golang:1.16-alpine as builder
RUN apk add make binutils
COPY / /work
WORKDIR /work
RUN make lvmplugin

FROM alpine:3.12
FROM alpine:3.13
LABEL maintainers="Metal Authors"
LABEL description="LVM Driver"

Expand Down
38 changes: 0 additions & 38 deletions TODO.md

This file was deleted.

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.15-alpine as builder
FROM golang:1.16-alpine as builder
RUN apk add make binutils
COPY / /work
WORKDIR /work
RUN make provisioner

FROM alpine:3.12
FROM alpine:3.13
LABEL maintainers="Metal Authors"
LABEL description="LVM Driver"

Expand Down
39 changes: 20 additions & 19 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
module github.com/metal-stack/csi-driver-lvm

go 1.15
go 1.16

require (
github.com/container-storage-interface/spec v1.3.0
github.com/container-storage-interface/spec v1.4.0
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
github.com/docker/go-units v0.4.0
github.com/golang/protobuf v1.4.3 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/kr/pretty v0.2.1 // indirect
github.com/kubernetes-csi/csi-lib-utils v0.9.0
github.com/stretchr/testify v1.6.1 // indirect
github.com/googleapis/gnostic v0.5.5 // indirect
github.com/json-iterator/go v1.1.11 // indirect
github.com/kubernetes-csi/csi-lib-utils v0.9.1
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/urfave/cli/v2 v2.3.0
golang.org/x/crypto v0.0.0-20201124201722-c8d3bf9c5392 // indirect
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b
golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58 // indirect
golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e // indirect
google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e // indirect
google.golang.org/grpc v1.33.2
gopkg.in/yaml.v2 v2.4.0 // indirect
k8s.io/api v0.19.4
k8s.io/apimachinery v0.19.4
k8s.io/client-go v0.19.4
k8s.io/klog/v2 v2.4.0
k8s.io/utils v0.0.0-20201110183641-67b214c5f920 // indirect
golang.org/x/net v0.0.0-20210510120150-4163338589ed
golang.org/x/oauth2 v0.0.0-20210427180440-81ed05c6b58c // indirect
golang.org/x/sys v0.0.0-20210511113859-b0526f3d8744
golang.org/x/term v0.0.0-20210503060354-a79de5458b56 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20210510173355-fb37daa5cd7a // indirect
google.golang.org/grpc v1.37.1
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
k8s.io/api v0.21.0
k8s.io/apimachinery v0.21.0
k8s.io/client-go v0.21.0
k8s.io/klog/v2 v2.8.0
k8s.io/utils v0.0.0-20210305010621-2afb4311ab10 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.1.1 // indirect
)
215 changes: 123 additions & 92 deletions go.sum

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions helm/csi-driver-lvm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ lvm:

pluginImage:
repository: metalstack/lvmplugin
tag: v0.4.0
tag: v0.4.1
pullPolicy: IfNotPresent

provisionerImage:
repository: metalstack/csi-lvmplugin-provisioner
tag: v0.4.0
tag: v0.4.1
pullPolicy: IfNotPresent

rbac:
Expand Down
13 changes: 0 additions & 13 deletions pkg/lvm/controllerserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ import (
"k8s.io/klog/v2"
)

const (
maxStorageCapacity = tib
)

type controllerServer struct {
caps []*csi.ControllerServiceCapability
nodeID string
Expand Down Expand Up @@ -112,15 +108,6 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
return nil, status.Error(codes.InvalidArgument, "cannot have both block and mount access type")
}

// TODO
// this check must bei implemented in createlvs executed by the provisioner pod on the node

// Check for maximum available capacity
capacity := int64(req.GetCapacityRange().GetRequiredBytes())
if capacity >= maxStorageCapacity {
return nil, status.Errorf(codes.OutOfRange, "Requested capacity %d exceeds maximum allowed %d", capacity, maxStorageCapacity)
}

lvmType := req.GetParameters()["type"]
if !(lvmType == "linear" || lvmType == "mirror" || lvmType == "striped") {
return nil, status.Errorf(codes.Internal, "lvmType is incorrect: %s", lvmType)
Expand Down
7 changes: 0 additions & 7 deletions pkg/lvm/lvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,6 @@ import (
"k8s.io/klog/v2"
)

const (
kib int64 = 1024
mib int64 = kib * 1024
gib int64 = mib * 1024
tib int64 = gib * 1024
)

// Lvm contains the main parameters
type Lvm struct {
name string
Expand Down
3 changes: 0 additions & 3 deletions pkg/lvm/nodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,6 @@ func (ns *nodeServer) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandV
return nil, status.Error(codes.InvalidArgument, "Volume ID missing in request")
}
capacity := int64(req.GetCapacityRange().GetRequiredBytes())
if capacity >= maxStorageCapacity {
return nil, status.Errorf(codes.OutOfRange, "Requested capacity %d exceeds maximum allowed %d", capacity, maxStorageCapacity)
}

volID := req.GetVolumeId()
volPath := req.GetVolumePath()
Expand Down
2 changes: 1 addition & 1 deletion start-minikube-on-linux.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

minikube start --memory 5g --driver kvm2
minikube start --memory 5g --driver kvm2 --kubernetes-version v1.16.15
minikube ssh 'for i in 0 1; do fallocate -l 1G loop${i} ; sudo losetup -f loop${i}; sudo losetup -a ; done'
minikube ssh 'sudo rm /sbin/losetup'
scp -o 'StrictHostKeyChecking=no' -i $(minikube ssh-key) $(which losetup) docker@$(minikube ip):/tmp/losetup
Expand Down

0 comments on commit 8700605

Please sign in to comment.