diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 66d039c4..d16814e9 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -38,9 +38,9 @@ jobs: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - name: Set go environment - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.22' - name: Build Go binary run: GOOS=${{ env.GOOS }} GOARCH=${{ env.GOARCH }} CGO_ENABLED=0 go build -ldflags "-w -s" -o cmd/upcloud-csi-plugin/${{ env.NAME }} ${{ env.PKG }} diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index fb250960..e21f2694 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -12,13 +12,13 @@ jobs: uses: actions/checkout@v4 - name: Setup go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.22' cache: false - name: Run golangci-lint-action - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v5 with: version: v1.54 args: --timeout 5m diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3b89bb96..ff5c5538 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -16,9 +16,9 @@ jobs: uses: actions/checkout@v4 - name: Set go environment - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: '1.22' - name: Get release notes run: make release-notes > .release_notes diff --git a/.github/workflows/test-integration.yaml b/.github/workflows/test-integration.yaml index 87f871aa..7d3c411b 100644 --- a/.github/workflows/test-integration.yaml +++ b/.github/workflows/test-integration.yaml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 - name: Test Driver Integration env: UPCLOUD_TEST_USERNAME: ${{ secrets.UPCLOUD_TEST_USERNAME }} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 17177abe..c326db45 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -19,7 +19,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 - name: Test Driver run: sudo make test diff --git a/DEVELOPING.md b/DEVELOPING.md index b90c75d1..302984c3 100644 --- a/DEVELOPING.md +++ b/DEVELOPING.md @@ -4,7 +4,7 @@ CSI driver's primary goal is to conform to [Container Storage Interface (CSI)](h Depending on [CO](https://www.vmware.com/topics/glossary/content/container-orchestration.html), endpoints are called directly or by [sidecar containers](deploy/kubernetes/README.md#sidecars). ## Requirements -- [Go](https://golang.org/doc/install) >= 1.20 +- [Go](https://golang.org/doc/install) >= 1.22 Get the source code: diff --git a/Makefile b/Makefile index b0a89f5b..2bde6159 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ PLUGIN_NAME=upcloud-csi-plugin PLUGIN_PKG ?= github.com/UpCloudLtd/upcloud-csi PLUGIN_CMD ?= ${PLUGIN_PKG}/cmd/upcloud-csi-plugin OS ?= linux -GO_VERSION := 1.20 +GO_VERSION := 1.22 ARCH := amd64 CGO_ENABLED := 1 TAG ?= $(shell git describe --tags) diff --git a/cmd/upcloud-csi-plugin/Dockerfile b/cmd/upcloud-csi-plugin/Dockerfile index 5cd7ec35..62693d41 100644 --- a/cmd/upcloud-csi-plugin/Dockerfile +++ b/cmd/upcloud-csi-plugin/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.17 +FROM alpine:3.20 RUN apk add ca-certificates \ e2fsprogs \ diff --git a/deploy/kubernetes/setup-upcloud-csi.yaml b/deploy/kubernetes/setup-upcloud-csi.yaml index 6860cde2..98a49e22 100644 --- a/deploy/kubernetes/setup-upcloud-csi.yaml +++ b/deploy/kubernetes/setup-upcloud-csi.yaml @@ -41,6 +41,20 @@ provisioner: storage.csi.upcloud.com allowVolumeExpansion: true reclaimPolicy: Retain +--- +kind: StorageClass +apiVersion: storage.k8s.io/v1 +metadata: + name: upcloud-block-storage-standard + namespace: kube-system + annotations: + storageclass.kubernetes.io/is-default-class: "false" +parameters: + tier: standard +provisioner: storage.csi.upcloud.com +allowVolumeExpansion: true +reclaimPolicy: Retain + --- ####################### # Controller plugin diff --git a/go.mod b/go.mod index deb0dc5f..a9128c09 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/UpCloudLtd/upcloud-csi -go 1.20 +go 1.22 require ( github.com/container-storage-interface/spec v1.6.0 @@ -22,7 +22,7 @@ require ( require github.com/kubernetes-csi/csi-test/v5 v5.0.0 -require github.com/UpCloudLtd/upcloud-go-api/v6 v6.12.0 +require github.com/UpCloudLtd/upcloud-go-api/v8 v8.6.1 require ( github.com/emicklei/go-restful/v3 v3.9.0 // indirect diff --git a/go.sum b/go.sum index a13a95fa..8fe4d82b 100644 --- a/go.sum +++ b/go.sum @@ -2,8 +2,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/UpCloudLtd/upcloud-go-api/v6 v6.12.0 h1:Qol8WuStmqWTXO8Hfel6FjCgLOZ98MGVCvg3ExcEs68= -github.com/UpCloudLtd/upcloud-go-api/v6 v6.12.0/go.mod h1:I8rWmBBl+OhiY3AGzKbrobiE5TsLCLNYkCQxE4eJcTg= +github.com/UpCloudLtd/upcloud-go-api/v8 v8.6.1 h1:8GEUDjMastRQDHLG4/tBN31Rd2UxdEhkjwkXwe8XyUc= +github.com/UpCloudLtd/upcloud-go-api/v8 v8.6.1/go.mod h1:/BL9bYxio0GCdotzBvZjkpm1fSDtD0+0z6PtNMew9HU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -27,6 +27,7 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= +github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/emicklei/go-restful/v3 v3.9.0 h1:XwGDlfxEnQZzuopoqxwSEllNcCOM9DhhFyhFIIGKwxE= github.com/emicklei/go-restful/v3 v3.9.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= @@ -324,6 +325,7 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= diff --git a/internal/controller/controller.go b/internal/controller/controller.go index 9260655a..82e80c50 100644 --- a/internal/controller/controller.go +++ b/internal/controller/controller.go @@ -10,8 +10,8 @@ import ( "github.com/UpCloudLtd/upcloud-csi/internal/logger" "github.com/UpCloudLtd/upcloud-csi/internal/service" - "github.com/UpCloudLtd/upcloud-go-api/v6/upcloud" - "github.com/UpCloudLtd/upcloud-go-api/v6/upcloud/request" + "github.com/UpCloudLtd/upcloud-go-api/v8/upcloud" + "github.com/UpCloudLtd/upcloud-go-api/v8/upcloud/request" "github.com/container-storage-interface/spec/lib/go/csi" "github.com/sirupsen/logrus" "google.golang.org/grpc/codes" @@ -743,7 +743,11 @@ func listSnapshotsErrorResponse(err error) (*csi.ListSnapshotsResponse, error) { } func createVolumeRequestTier(r *csi.CreateVolumeRequest) (string, error) { - tierMapper := map[string]string{"maxiops": upcloud.StorageTierMaxIOPS, "hdd": upcloud.StorageTierHDD} + tierMapper := map[string]string{ + "maxiops": upcloud.StorageTierMaxIOPS, + "hdd": upcloud.StorageTierHDD, + "standard": upcloud.StorageTierStandard, + } p, ok := r.Parameters["tier"] if !ok { // tier parameter is not required diff --git a/internal/controller/controller_internal_test.go b/internal/controller/controller_internal_test.go index 23b02764..b98bb21a 100644 --- a/internal/controller/controller_internal_test.go +++ b/internal/controller/controller_internal_test.go @@ -3,7 +3,7 @@ package controller import ( "testing" - "github.com/UpCloudLtd/upcloud-go-api/v6/upcloud" + "github.com/UpCloudLtd/upcloud-go-api/v8/upcloud" "github.com/container-storage-interface/spec/lib/go/csi" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/internal/controller/utils.go b/internal/controller/utils.go index c8348c1e..eb02ffb8 100644 --- a/internal/controller/utils.go +++ b/internal/controller/utils.go @@ -3,7 +3,7 @@ package controller import ( "strings" - "github.com/UpCloudLtd/upcloud-go-api/v6/upcloud" + "github.com/UpCloudLtd/upcloud-go-api/v8/upcloud" ) func upcloudLabels(labels []string) []upcloud.Label { diff --git a/internal/service/mock/service.go b/internal/service/mock/service.go index 3528b923..c6174b17 100644 --- a/internal/service/mock/service.go +++ b/internal/service/mock/service.go @@ -4,8 +4,8 @@ import ( "context" "github.com/UpCloudLtd/upcloud-csi/internal/service" - "github.com/UpCloudLtd/upcloud-go-api/v6/upcloud" - "github.com/UpCloudLtd/upcloud-go-api/v6/upcloud/request" + "github.com/UpCloudLtd/upcloud-go-api/v8/upcloud" + "github.com/UpCloudLtd/upcloud-go-api/v8/upcloud/request" "github.com/google/uuid" ) diff --git a/internal/service/mock/upcloud_client.go b/internal/service/mock/upcloud_client.go index 7b1d6f0a..0b875cb6 100644 --- a/internal/service/mock/upcloud_client.go +++ b/internal/service/mock/upcloud_client.go @@ -8,9 +8,9 @@ import ( "sync" "time" - "github.com/UpCloudLtd/upcloud-go-api/v6/upcloud" - "github.com/UpCloudLtd/upcloud-go-api/v6/upcloud/request" - upsvc "github.com/UpCloudLtd/upcloud-go-api/v6/upcloud/service" + "github.com/UpCloudLtd/upcloud-go-api/v8/upcloud" + "github.com/UpCloudLtd/upcloud-go-api/v8/upcloud/request" + upsvc "github.com/UpCloudLtd/upcloud-go-api/v8/upcloud/service" ) type UpCloudClient struct { diff --git a/internal/service/service.go b/internal/service/service.go index 0c1a39d6..48326520 100644 --- a/internal/service/service.go +++ b/internal/service/service.go @@ -4,8 +4,8 @@ import ( "context" "errors" - "github.com/UpCloudLtd/upcloud-go-api/v6/upcloud" - "github.com/UpCloudLtd/upcloud-go-api/v6/upcloud/request" + "github.com/UpCloudLtd/upcloud-go-api/v8/upcloud" + "github.com/UpCloudLtd/upcloud-go-api/v8/upcloud/request" ) var ( diff --git a/internal/service/service_test.go b/internal/service/service_test.go index f43cfe5a..3930bbef 100644 --- a/internal/service/service_test.go +++ b/internal/service/service_test.go @@ -11,10 +11,10 @@ import ( "github.com/UpCloudLtd/upcloud-csi/internal/service" "github.com/UpCloudLtd/upcloud-csi/internal/service/mock" - "github.com/UpCloudLtd/upcloud-go-api/v6/upcloud" - "github.com/UpCloudLtd/upcloud-go-api/v6/upcloud/client" - "github.com/UpCloudLtd/upcloud-go-api/v6/upcloud/request" - upsvc "github.com/UpCloudLtd/upcloud-go-api/v6/upcloud/service" + "github.com/UpCloudLtd/upcloud-go-api/v8/upcloud" + "github.com/UpCloudLtd/upcloud-go-api/v8/upcloud/client" + "github.com/UpCloudLtd/upcloud-go-api/v8/upcloud/request" + upsvc "github.com/UpCloudLtd/upcloud-go-api/v8/upcloud/service" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/internal/service/upcloud_service.go b/internal/service/upcloud_service.go index 9fe755e6..89de2957 100644 --- a/internal/service/upcloud_service.go +++ b/internal/service/upcloud_service.go @@ -7,10 +7,10 @@ import ( "sync" "time" - "github.com/UpCloudLtd/upcloud-go-api/v6/upcloud" - "github.com/UpCloudLtd/upcloud-go-api/v6/upcloud/client" - "github.com/UpCloudLtd/upcloud-go-api/v6/upcloud/request" - upsvc "github.com/UpCloudLtd/upcloud-go-api/v6/upcloud/service" + "github.com/UpCloudLtd/upcloud-go-api/v8/upcloud" + "github.com/UpCloudLtd/upcloud-go-api/v8/upcloud/client" + "github.com/UpCloudLtd/upcloud-go-api/v8/upcloud/request" + upsvc "github.com/UpCloudLtd/upcloud-go-api/v8/upcloud/service" ) const ( @@ -322,18 +322,20 @@ func (u *UpCloudService) RequireStorageOnline(ctx context.Context, s *upcloud.St } func (u *UpCloudService) waitForStorageOnline(ctx context.Context, uuid string) (*upcloud.StorageDetails, error) { + ctx, cancel := context.WithTimeout(ctx, storageStateTimeout) + defer cancel() return u.client.WaitForStorageState(ctx, &request.WaitForStorageStateRequest{ UUID: uuid, DesiredState: upcloud.StorageStateOnline, - Timeout: storageStateTimeout, }) } func (u *UpCloudService) waitForServerOnline(ctx context.Context, uuid string) error { + ctx, cancel := context.WithTimeout(ctx, serverStateTimeout) + defer cancel() _, err := u.client.WaitForServerState(ctx, &request.WaitForServerStateRequest{ UUID: uuid, DesiredState: upcloud.ServerStateStarted, - Timeout: serverStateTimeout, }) return err }