Skip to content

Commit b75f474

Browse files
authored
Merge branch 'main' into attacher-update
2 parents 27b205c + d228f4a commit b75f474

File tree

34 files changed

+935
-109
lines changed

34 files changed

+935
-109
lines changed

.github/workflows/ci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ jobs:
6262
runs-on: ubuntu-latest
6363
needs: changes
6464
if: ${{ contains(fromJSON(needs.changes.outputs.paths), 'src') }}
65+
environment: ${{ github.event.pull_request.head.repo.fork == true && 'prod-external' || 'prod' }}
6566
env:
6667
GITHUB_TOKEN: ${{ secrets.github_token }}
6768
LINODE_TOKEN: ${{ secrets.LINODE_TOKEN }}

.golangci.yml

+3
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,9 @@ issues:
156156
linters:
157157
- gosec
158158
- gas
159+
160+
- text: 'shadow: declaration of "(err|ctx)" shadows declaration at'
161+
linters: [govet]
159162

160163
exclude-use-default: false
161164
new: false

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ FROM alpine:3.20.3
2020
LABEL maintainers="Linode"
2121
LABEL description="Linode CSI Driver"
2222

23-
RUN apk add --no-cache e2fsprogs findmnt blkid cryptsetup
24-
RUN apk add --no-cache xfsprogs=6.2.0-r2 --repository=http://dl-cdn.alpinelinux.org/alpine/v3.18/main
23+
RUN apk add --no-cache e2fsprogs e2fsprogs-extra findmnt blkid cryptsetup
24+
RUN apk add --no-cache xfsprogs=6.2.0-r2 xfsprogs-extra=6.2.0-r2 --repository=http://dl-cdn.alpinelinux.org/alpine/v3.18/main
2525

2626
COPY --from=builder /bin/linode-blockstorage-csi-driver /linode
2727

Dockerfile.dev

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ RUN apk add \
1313
cryptsetup-dev \
1414
curl \
1515
e2fsprogs \
16+
e2fsprogs-extra \
1617
findmnt \
1718
gcc \
1819
lsblk \
1920
make \
2021
musl-dev \
2122
pkgconfig \
22-
xfsprogs
23+
xfsprogs \
24+
xfsprogs-extra
2325

2426
COPY go.mod go.sum ./
2527
RUN go mod tidy

docs/deployment.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,10 @@ kubectl apply -f https://raw.githubusercontent.com/linode/linode-blockstorage-cs
159159
160160
**Note:** To support this change, block storage volume attachments are no longer persisted across reboots.
161161
162-
<!-- Add note about volume resizing limitations -->
162+
4. **Offline Volume Resizing**
163+
164+
- The CSI driver supports offline volume resizing. This means that the volume must be unmounted from all nodes before resizing.
165+
- To resize a volume, update the `spec.resources.requests.storage` field in the PersistentVolumeClaim (PVC) manifest and apply the changes.
166+
- The CSI driver will automatically resize the underlying Linode Block Storage Volume to match the new size specified in the PVC.
167+
- The volume must be unmounted from all nodes before resizing.
168+
It could be unmounted by deleting the pod using the volume or by using the `kubectl delete pod <pod-name>` command.

go.mod

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ require (
99
github.com/google/uuid v1.6.0
1010
github.com/ianschenck/envflag v0.0.0-20140720210342-9111d830d133
1111
github.com/linode/go-metadata v0.2.1
12-
github.com/linode/linodego v1.47.0
12+
github.com/linode/linodego v1.48.1
1313
github.com/martinjungblut/go-cryptsetup v0.0.0-20220520180014-fd0874fd07a6
14-
github.com/prometheus/client_golang v1.21.0
14+
github.com/prometheus/client_golang v1.21.1
1515
github.com/stretchr/testify v1.10.0
1616
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0
1717
go.opentelemetry.io/otel v1.35.0
@@ -43,7 +43,7 @@ require (
4343
github.com/go-openapi/jsonpointer v0.21.0 // indirect
4444
github.com/go-openapi/jsonreference v0.20.2 // indirect
4545
github.com/go-openapi/swag v0.23.0 // indirect
46-
github.com/go-resty/resty/v2 v2.16.3 // indirect
46+
github.com/go-resty/resty/v2 v2.16.5 // indirect
4747
github.com/gogo/protobuf v1.3.2 // indirect
4848
github.com/golang/protobuf v1.5.4 // indirect
4949
github.com/google/gnostic-models v0.6.8 // indirect
@@ -70,7 +70,7 @@ require (
7070
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0 // indirect
7171
go.opentelemetry.io/otel/metric v1.35.0 // indirect
7272
go.opentelemetry.io/proto/otlp v1.5.0 // indirect
73-
golang.org/x/oauth2 v0.26.0 // indirect
73+
golang.org/x/oauth2 v0.27.0 // indirect
7474
golang.org/x/term v0.30.0 // indirect
7575
golang.org/x/text v0.23.0 // indirect
7676
golang.org/x/time v0.7.0 // indirect

go.sum

+8-8
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En
2828
github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
2929
github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE=
3030
github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ=
31-
github.com/go-resty/resty/v2 v2.16.3 h1:zacNT7lt4b8M/io2Ahj6yPypL7bqx9n1iprfQuodV+E=
32-
github.com/go-resty/resty/v2 v2.16.3/go.mod h1:hkJtXbA2iKHzJheXYvQ8snQES5ZLGKMwQ07xAwp/fiA=
31+
github.com/go-resty/resty/v2 v2.16.5 h1:hBKqmWrr7uRc3euHVqmh1HTHcKn99Smr7o5spptdhTM=
32+
github.com/go-resty/resty/v2 v2.16.5/go.mod h1:hkJtXbA2iKHzJheXYvQ8snQES5ZLGKMwQ07xAwp/fiA=
3333
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
3434
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
3535
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
@@ -78,8 +78,8 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0
7878
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
7979
github.com/linode/go-metadata v0.2.1 h1:fioxMUqvN6RGLthKINr/XAKsKvg6qdff1dTwoucfpJc=
8080
github.com/linode/go-metadata v0.2.1/go.mod h1:6DcmVDcRTMWa+jYAP7R82GWfHE3cNP7tNbWoRwcD3lE=
81-
github.com/linode/linodego v1.47.0 h1:6MFNCyzWbr8Rhl4r7d5DwZLwxvFIsM4ARH6W0KS/R0U=
82-
github.com/linode/linodego v1.47.0/go.mod h1:vyklQRzZUWhFVBZdYx4dcYJU/gG9yKB9VUcUs6ub0Lk=
81+
github.com/linode/linodego v1.48.1 h1:Ojw1S+K5jJr1dggO8/H6r4FINxXnJbOU5GkbpaTfmhU=
82+
github.com/linode/linodego v1.48.1/go.mod h1:fc3t60If8X+yZTFAebhCnNDFrhwQhq9HDU92WnBousQ=
8383
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
8484
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
8585
github.com/martinjungblut/go-cryptsetup v0.0.0-20220520180014-fd0874fd07a6 h1:YDjLk3wsL5ZLhLC4TIwIvT2NkSCAdAV6pzzZaRfj4jk=
@@ -106,8 +106,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRI
106106
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
107107
github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g=
108108
github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U=
109-
github.com/prometheus/client_golang v1.21.0 h1:DIsaGmiaBkSangBgMtWdNfxbMNdku5IK6iNhrEqWvdA=
110-
github.com/prometheus/client_golang v1.21.0/go.mod h1:U9NM32ykUErtVBxdvD3zfi+EuFkkaBvMb09mIfe0Zgg=
109+
github.com/prometheus/client_golang v1.21.1 h1:DOvXXTqVzvkIewV/CDPFdejpMCGeMcbGCQ8YOmu+Ibk=
110+
github.com/prometheus/client_golang v1.21.1/go.mod h1:U9NM32ykUErtVBxdvD3zfi+EuFkkaBvMb09mIfe0Zgg=
111111
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
112112
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
113113
github.com/prometheus/common v0.62.0 h1:xasJaQlnWAeyHdUBeGjXmutelfJHWMRr+Fg4QszZ2Io=
@@ -173,8 +173,8 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY
173173
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
174174
golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c=
175175
golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
176-
golang.org/x/oauth2 v0.26.0 h1:afQXWNNaeC4nvZ0Ed9XvCCzXM6UHJG7iCg0W4fPqSBE=
177-
golang.org/x/oauth2 v0.26.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
176+
golang.org/x/oauth2 v0.27.0 h1:da9Vo7/tDv5RH/7nZDz1eMGS/q1Vv1N/7FCrBhI9I3M=
177+
golang.org/x/oauth2 v0.27.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8=
178178
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
179179
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
180180
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=

internal/driver/driver.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ import (
2525
"github.com/container-storage-interface/spec/lib/go/csi"
2626
"google.golang.org/grpc/codes"
2727
"google.golang.org/grpc/status"
28-
"k8s.io/mount-utils"
2928

3029
devicemanager "github.com/linode/linode-blockstorage-csi-driver/pkg/device-manager"
3130
linodeclient "github.com/linode/linode-blockstorage-csi-driver/pkg/linode-client"
3231
"github.com/linode/linode-blockstorage-csi-driver/pkg/logger"
32+
mountmanager "github.com/linode/linode-blockstorage-csi-driver/pkg/mount-manager"
3333
"github.com/linode/linode-blockstorage-csi-driver/pkg/observability"
3434
)
3535

@@ -80,8 +80,9 @@ func GetLinodeDriver(ctx context.Context) *LinodeDriver {
8080
func (linodeDriver *LinodeDriver) SetupLinodeDriver(
8181
ctx context.Context,
8282
linodeClient linodeclient.LinodeClient,
83-
mounter *mount.SafeFormatAndMount,
83+
mounter *mountmanager.SafeFormatAndMount,
8484
deviceUtils devicemanager.DeviceUtils,
85+
resizeFs mountmanager.ResizeFSer,
8586
metadata Metadata,
8687
name,
8788
vendorVersion,
@@ -118,7 +119,7 @@ func (linodeDriver *LinodeDriver) SetupLinodeDriver(
118119
linodeDriver.volumeLabelPrefix = volumeLabelPrefix
119120

120121
log.V(2).Info("Setting up RPC Servers")
121-
linodeDriver.ns, err = NewNodeServer(ctx, linodeDriver, mounter, deviceUtils, linodeClient, metadata, encrypt)
122+
linodeDriver.ns, err = NewNodeServer(ctx, linodeDriver, mounter, deviceUtils, linodeClient, metadata, encrypt, resizeFs)
122123
if err != nil {
123124
return fmt.Errorf("new node server: %w", err)
124125
}

internal/driver/driver_test.go

+8-4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111

1212
"github.com/linode/linode-blockstorage-csi-driver/mocks"
1313
linodeclient "github.com/linode/linode-blockstorage-csi-driver/pkg/linode-client"
14+
mountmanager "github.com/linode/linode-blockstorage-csi-driver/pkg/mount-manager"
1415
)
1516

1617
var (
@@ -30,14 +31,17 @@ func TestDriverSuite(t *testing.T) {
3031
mockCtrl := gomock.NewController(t)
3132
defer mockCtrl.Finish()
3233

33-
mounter := &mount.SafeFormatAndMount{
34-
Interface: mocks.NewMockMounter(mockCtrl),
35-
Exec: mocks.NewMockExecutor(mockCtrl),
34+
mounter := &mountmanager.SafeFormatAndMount{
35+
SafeFormatAndMount: &mount.SafeFormatAndMount{
36+
Interface: mocks.NewMockMounter(mockCtrl),
37+
Exec: mocks.NewMockExecutor(mockCtrl),
38+
},
3639
}
3740
deviceUtils := mocks.NewMockDeviceUtils(mockCtrl)
3841
fileSystem := mocks.NewMockFileSystem(mockCtrl)
3942
cryptSetup := mocks.NewMockCryptSetupClient(mockCtrl)
4043
encrypt := NewLuksEncryption(mounter.Exec, fileSystem, cryptSetup)
44+
resizeFs := mocks.NewMockResizeFSer(mockCtrl)
4145

4246
fakeCloudProvider, err := linodeclient.NewLinodeClient("dummy", fmt.Sprintf("LinodeCSI/%s", vendorVersion), "")
4347
if err != nil {
@@ -57,7 +61,7 @@ func TestDriverSuite(t *testing.T) {
5761
metricsPort := "10251"
5862
enableTracing := "true"
5963
tracingPort := "4318"
60-
if err := linodeDriver.SetupLinodeDriver(context.Background(), fakeCloudProvider, mounter, deviceUtils, md, driver, vendorVersion, bsPrefix, encrypt, enableMetrics, metricsPort, enableTracing, tracingPort); err != nil {
64+
if err := linodeDriver.SetupLinodeDriver(context.Background(), fakeCloudProvider, mounter, deviceUtils, resizeFs, md, driver, vendorVersion, bsPrefix, encrypt, enableMetrics, metricsPort, enableTracing, tracingPort); err != nil {
6165
t.Fatalf("Failed to setup Linode Driver: %v", err)
6266
}
6367

internal/driver/errors.go

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package driver
22

33
import (
4+
"errors"
5+
46
"github.com/container-storage-interface/spec/lib/go/csi"
57
"google.golang.org/grpc/codes"
68
"google.golang.org/grpc/status"
@@ -53,6 +55,9 @@ var (
5355
// operation was not specified, despite indicating a new volume should be
5456
// created by cloning an existing one.
5557
errNoSourceVolume = status.Error(codes.InvalidArgument, "no volume content source specified")
58+
59+
ErrNoVolumeCapability = errors.New("volume capability is required")
60+
ErrNoAccessMode = errors.New("access mode is nil")
5661
)
5762

5863
// errRegionMismatch returns an error indicating a volume is in gotRegion, but

internal/driver/identityserver.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func (linodeIdentity *IdentityServer) GetPluginCapabilities(ctx context.Context,
105105
// 2. Delete and recreate the pod that is using the PVC(or scale replicas accordingly)
106106
// 3. This operation should detach and re-attach the volume to the newly created pod allowing you to use the updated size
107107
VolumeExpansion: &csi.PluginCapability_VolumeExpansion{
108-
Type: csi.PluginCapability_VolumeExpansion_ONLINE,
108+
Type: csi.PluginCapability_VolumeExpansion_OFFLINE,
109109
},
110110
},
111111
},

internal/driver/identityserver_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func TestIdentityServer_GetPluginCapabilities(t *testing.T) {
127127
{
128128
Type: &csi.PluginCapability_VolumeExpansion_{
129129
VolumeExpansion: &csi.PluginCapability_VolumeExpansion{
130-
Type: csi.PluginCapability_VolumeExpansion_ONLINE,
130+
Type: csi.PluginCapability_VolumeExpansion_OFFLINE,
131131
},
132132
},
133133
},

0 commit comments

Comments
 (0)