From a6dde6c61782c925fb95173e7ef77085e6dd90a3 Mon Sep 17 00:00:00 2001 From: Tomy GUICHARD Date: Fri, 19 Apr 2024 14:30:25 +0200 Subject: [PATCH] chore: bump dependencies --- .github/workflows/merge.yaml | 2 +- .github/workflows/pull-request.yaml | 12 ++-- .github/workflows/release.yml | 2 +- Dockerfile | 2 +- go.mod | 44 ++++++------ go.sum | 101 ++++++++++++++-------------- pkg/driver/controller.go | 7 +- pkg/driver/helpers.go | 6 +- pkg/scaleway/block.go | 34 +++++++--- pkg/scaleway/fake.go | 32 +++------ pkg/scaleway/helpers.go | 18 ----- pkg/scaleway/interface.go | 12 ++-- test/sanity/sanity_suite_test.go | 2 +- test/sanity/sanity_test.go | 6 +- 14 files changed, 134 insertions(+), 146 deletions(-) diff --git a/.github/workflows/merge.yaml b/.github/workflows/merge.yaml index 5c73a70..96057b6 100644 --- a/.github/workflows/merge.yaml +++ b/.github/workflows/merge.yaml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Unshallow run: git fetch --prune --unshallow - name: Extract branch name diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml index 54573f2..045231e 100644 --- a/.github/workflows/pull-request.yaml +++ b/.github/workflows/pull-request.yaml @@ -7,16 +7,16 @@ jobs: unit-test: strategy: matrix: - go-version: [1.20.x] + go-version: [1.22.x] platform: [ubuntu-latest] runs-on: ${{ matrix.platform }} steps: - name: Install Go - uses: actions/setup-go@v1 + uses: actions/setup-go@v5 with: go-version: ${{ matrix.go-version }} - name: checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 1 - name: Run unit tests @@ -24,17 +24,17 @@ jobs: build-test: strategy: matrix: - go-version: [1.20.x] + go-version: [1.22.x] platform: [ubuntu-latest] arch: [386, amd64, arm, arm64] runs-on: ${{ matrix.platform }} steps: - name: Install Go - uses: actions/setup-go@v1 + uses: actions/setup-go@v5 with: go-version: ${{ matrix.go-version }} - name: checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 1 - name: Building binary diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 491b2de..aa1b26b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Unshallow run: git fetch --prune --unshallow - name: Highest tag diff --git a/Dockerfile b/Dockerfile index 9aec446..c4d48e4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.20-alpine as builder +FROM golang:1.22-alpine as builder RUN apk update && apk add --no-cache git ca-certificates && update-ca-certificates diff --git a/go.mod b/go.mod index 72078f2..c76955f 100644 --- a/go.mod +++ b/go.mod @@ -1,39 +1,39 @@ module github.com/scaleway/scaleway-csi -go 1.20 +go 1.22.2 require ( - github.com/container-storage-interface/spec v1.8.0 - github.com/golang/protobuf v1.5.3 - github.com/google/uuid v1.3.1 - github.com/kubernetes-csi/csi-test/v5 v5.1.0 - github.com/onsi/ginkgo/v2 v2.13.0 - github.com/onsi/gomega v1.28.0 + github.com/container-storage-interface/spec v1.9.0 + github.com/golang/protobuf v1.5.4 + github.com/google/uuid v1.6.0 + github.com/kubernetes-csi/csi-test/v5 v5.2.0 + github.com/onsi/ginkgo/v2 v2.17.1 + github.com/onsi/gomega v1.32.0 github.com/pkg/sftp v1.13.6 - github.com/scaleway/scaleway-sdk-go v1.0.0-beta.21.0.20231010165413-fd6263b48233 - golang.org/x/crypto v0.14.0 - golang.org/x/exp v0.0.0-20231006140011-7918f672742d - golang.org/x/sys v0.13.0 - google.golang.org/grpc v1.58.3 - google.golang.org/protobuf v1.31.0 - k8s.io/klog/v2 v2.100.1 - k8s.io/mount-utils v0.28.2 - k8s.io/utils v0.0.0-20230726121419-3b25d923346b + github.com/scaleway/scaleway-sdk-go v1.0.0-beta.26 + golang.org/x/crypto v0.22.0 + golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f + golang.org/x/sys v0.19.0 + google.golang.org/grpc v1.63.2 + google.golang.org/protobuf v1.33.0 + k8s.io/klog/v2 v2.120.1 + k8s.io/mount-utils v0.30.0 + k8s.io/utils v0.0.0-20240310230437-4693a0247e57 oya.to/namedlocker v1.0.0 ) require ( - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.4.1 // indirect github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect - github.com/google/go-cmp v0.5.9 // indirect + github.com/google/go-cmp v0.6.0 // indirect github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect github.com/kr/fs v0.1.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/moby/sys/mountinfo v0.6.2 // indirect - golang.org/x/net v0.16.0 // indirect - golang.org/x/text v0.13.0 // indirect - golang.org/x/tools v0.14.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect + golang.org/x/net v0.24.0 // indirect + golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.20.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 6db53fc..d59b2c4 100644 --- a/go.sum +++ b/go.sum @@ -1,71 +1,71 @@ github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/container-storage-interface/spec v1.8.0 h1:D0vhF3PLIZwlwZEf2eNbpujGCNwspwTYf2idJRJx4xI= -github.com/container-storage-interface/spec v1.8.0/go.mod h1:ROLik+GhPslwwWRNFF1KasPzroNARibH2rfz1rkg4H0= +github.com/container-storage-interface/spec v1.9.0 h1:zKtX4STsq31Knz3gciCYCi1SXtO2HJDecIjDVboYavY= +github.com/container-storage-interface/spec v1.9.0/go.mod h1:ZfDu+3ZRyeVqxZM0Ds19MVLkN2d1XJ5MAfi1L3VjlT0= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= -github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/kr/fs v0.1.0 h1:Jskdu9ieNAYnjxsi0LbQp1ulIKZV1LAFgK1tWhpZgl8= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/kubernetes-csi/csi-test/v5 v5.1.0 h1:8UxFRH0W8C4RbppKYYJeOJ506C7ybngKZA5GabGgJec= -github.com/kubernetes-csi/csi-test/v5 v5.1.0/go.mod h1:LoAh2XHbXcKnCoM1WgEyviUXiLmTeCmFTsjzaNloL3k= +github.com/kubernetes-csi/csi-test/v5 v5.2.0 h1:Z+sdARWC6VrONrxB24clCLCmnqCnZF7dzXtzx8eM35o= +github.com/kubernetes-csi/csi-test/v5 v5.2.0/go.mod h1:o/c5w+NU3RUNE+DbVRhEUTmkQVBGk+tFOB2yPXT8teo= github.com/moby/sys/mountinfo v0.6.2 h1:BzJjoreD5BMFNmD9Rus6gdd1pLuecOFPt8wC+Vygl78= github.com/moby/sys/mountinfo v0.6.2/go.mod h1:IJb6JQeOklcdMU9F5xQ8ZALD+CUr5VlGpwtX+VE0rpI= -github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4= -github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= -github.com/onsi/gomega v1.28.0 h1:i2rg/p9n/UqIDAMFUJ6qIUUMcsqOuUHgbpbu235Vr1c= -github.com/onsi/gomega v1.28.0/go.mod h1:A1H2JE76sI14WIP57LMKj7FVfCHx3g3BcZVjJG8bjX8= +github.com/onsi/ginkgo/v2 v2.17.1 h1:V++EzdbhI4ZV4ev0UTIj0PzhzOcReJFyJaLjtSF55M8= +github.com/onsi/ginkgo/v2 v2.17.1/go.mod h1:llBI3WDLL9Z6taip6f33H76YcWtJv+7R3HigUjbIBOs= +github.com/onsi/gomega v1.32.0 h1:JRYU78fJ1LPxlckP6Txi/EYqJvjtMrDC04/MM5XRHPk= +github.com/onsi/gomega v1.32.0/go.mod h1:a4x4gW6Pz2yK1MAmvluYme5lvYTn61afQ2ETw/8n4Lg= github.com/pkg/sftp v1.13.6 h1:JFZT4XbOU7l77xGSpOdW+pwIMqP044IyjXX6FGyEKFo= github.com/pkg/sftp v1.13.6/go.mod h1:tz1ryNURKu77RL+GuCzmoJYxQczL3wLNNpPWagdg4Qk= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/scaleway/scaleway-sdk-go v1.0.0-beta.21.0.20231010165413-fd6263b48233 h1:1y6zYYJ6q0G3UlWTnaTVu3LN3y2kLBOgIr05QtNic5Q= -github.com/scaleway/scaleway-sdk-go v1.0.0-beta.21.0.20231010165413-fd6263b48233/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/scaleway/scaleway-sdk-go v1.0.0-beta.26 h1:F+GIVtGqCFxPxO46ujf8cEOP574MBoRm3gNbPXECbxs= +github.com/scaleway/scaleway-sdk-go v1.0.0-beta.26/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= -golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= -golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= -golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= +golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= +golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= +golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f h1:99ci1mjWVBWwJiEKYY6jWa4d2nTQVIEhZIptnrVb1XY= +golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.16.0 h1:7eBu7KsSvFDtSXUIDbh3aqlK4DPsZ1rByC8PFfBThos= -golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -75,45 +75,44 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= +golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q= +golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= -golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= +golang.org/x/tools v0.20.0 h1:hz/CVckiOxybQvFw6h7b/q80NTr9IUQb4s1IIzW7KNY= +golang.org/x/tools v0.20.0/go.mod h1:WvitBU7JJf6A4jOdg4S1tviW9bhUxkgeCui/0JHctQg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= -google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= -google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de h1:cZGRis4/ot9uVm639a+rHCUaG0JJHEsdyzSQTMX+suY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY= +google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= +google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/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/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/klog/v2 v2.100.1 h1:7WCHKK6K8fNhTqfBhISHQ97KrnJNFZMcQvKp7gP/tmg= -k8s.io/klog/v2 v2.100.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= -k8s.io/mount-utils v0.28.2 h1:sIdMH7fRhcU48V1oYJ9cLmLm/TG+2jLhhe8eS3I+FWg= -k8s.io/mount-utils v0.28.2/go.mod h1:AyP8LmZSLgpGdFQr+vzHTerlPiGvXUdP99n98Er47jw= -k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI= -k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw= +k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= +k8s.io/mount-utils v0.30.0 h1:EceYTNYVabfpdtIAHC4KgMzoZkm1B8ovZ1J666mYZQI= +k8s.io/mount-utils v0.30.0/go.mod h1:9sCVmwGLcV1MPvbZ+rToMDnl1QcGozy+jBPd0MsQLIo= +k8s.io/utils v0.0.0-20240310230437-4693a0247e57 h1:gbqbevonBh57eILzModw6mrkbwM0gQBEuevE/AaBsHY= +k8s.io/utils v0.0.0-20240310230437-4693a0247e57/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= oya.to/namedlocker v1.0.0 h1:+HKiEvhKSzBtboeqiT8vK10aVUTASnneKpw+j79FQwA= oya.to/namedlocker v1.0.0/go.mod h1:+eBYtjcKHBxsdm/HAofHTTnSq6H96THcxHYG1A6WKX0= diff --git a/pkg/driver/controller.go b/pkg/driver/controller.go index 5786465..a686746 100644 --- a/pkg/driver/controller.go +++ b/pkg/driver/controller.go @@ -426,7 +426,7 @@ func (d *controllerService) ListSnapshots(ctx context.Context, req *csi.ListSnap return nil, status.Errorf(codes.Aborted, "invalid startingToken: %s", err) } - var snapshots []*block.SnapshotSummary + var snapshots []*block.Snapshot var next string switch { @@ -548,3 +548,8 @@ func (d *controllerService) ControllerGetVolume(ctx context.Context, req *csi.Co }, }, nil } + +// ControllerModifyVolume is not supported yet. +func (d *controllerService) ControllerModifyVolume(context.Context, *csi.ControllerModifyVolumeRequest) (*csi.ControllerModifyVolumeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ControllerModifyVolume not implemented") +} diff --git a/pkg/driver/helpers.go b/pkg/driver/helpers.go index 9c41ba7..bb42dce 100644 --- a/pkg/driver/helpers.go +++ b/pkg/driver/helpers.go @@ -312,7 +312,7 @@ func (d *controllerService) getOrCreateVolume(ctx context.Context, name, snapsho } // getOrCreateSnapshot gets a snapshot by name or creates it if it does not exist. -func (d *controllerService) getOrCreateSnapshot(ctx context.Context, name, sourceVolumeID string, zone scw.Zone) (*block.SnapshotSummary, error) { +func (d *controllerService) getOrCreateSnapshot(ctx context.Context, name, sourceVolumeID string, zone scw.Zone) (*block.Snapshot, error) { snapshot, err := d.scaleway.GetSnapshotByName(ctx, name, sourceVolumeID, zone) if err != nil && !errors.Is(err, scaleway.ErrSnapshotNotFound) { return nil, fmt.Errorf("failed to try to get existing snapshot: %w", err) @@ -424,8 +424,8 @@ func publishedNodeIDs(volume *block.Volume) []string { return ids } -// csiSnapshot returns a CSI Snapshot from a SnapshotSummary. -func csiSnapshot(snapshot *block.SnapshotSummary) *csi.Snapshot { +// csiSnapshot returns a CSI Snapshot from a Snapshot. +func csiSnapshot(snapshot *block.Snapshot) *csi.Snapshot { snap := &csi.Snapshot{ SizeBytes: int64(snapshot.Size), SnapshotId: expandZonalID(snapshot.ID, snapshot.Zone), diff --git a/pkg/scaleway/block.go b/pkg/scaleway/block.go index b692830..b38a22a 100644 --- a/pkg/scaleway/block.go +++ b/pkg/scaleway/block.go @@ -37,7 +37,7 @@ func (s *Scaleway) GetVolumeByName(ctx context.Context, name string, size scw.Si } // GetSnapshotByName is a helper to find a snapshot by its name, its sourceVolumeID and zone. -func (s *Scaleway) GetSnapshotByName(ctx context.Context, name string, sourceVolumeID string, zone scw.Zone) (*block.SnapshotSummary, error) { +func (s *Scaleway) GetSnapshotByName(ctx context.Context, name string, sourceVolumeID string, zone scw.Zone) (*block.Snapshot, error) { snapshotsResp, err := s.block.ListSnapshots(&block.ListSnapshotsRequest{ Name: scw.StringPtr(name), Zone: zone, @@ -77,8 +77,8 @@ func (s *Scaleway) ListVolumes(ctx context.Context, start, max uint32) ([]*block // ListVolumes lists all snapshots in all zones of the region where the driver is // deployed. Results are paginated, use the returned token to fetch the next results. -func (s *Scaleway) ListSnapshots(ctx context.Context, start, max uint32) ([]*block.SnapshotSummary, string, error) { - return paginatedList(func(page int32, pageSize uint32) ([]*block.SnapshotSummary, error) { +func (s *Scaleway) ListSnapshots(ctx context.Context, start, max uint32) ([]*block.Snapshot, string, error) { + return paginatedList(func(page int32, pageSize uint32) ([]*block.Snapshot, error) { snapshotsResp, err := s.block.ListSnapshots(&block.ListSnapshotsRequest{ Page: scw.Int32Ptr(page), PageSize: scw.Uint32Ptr(pageSize), @@ -100,13 +100,13 @@ func (s *Scaleway) ListSnapshotsBySourceVolume( start, max uint32, sourceVolumeID string, sourceVolumeZone scw.Zone, -) ([]*block.SnapshotSummary, string, error) { +) ([]*block.Snapshot, string, error) { // Return nothing if sourceVolumeID is not a valid UUID. if !isValidUUID(sourceVolumeID) { return nil, "", nil } - return paginatedList(func(page int32, pageSize uint32) ([]*block.SnapshotSummary, error) { + return paginatedList(func(page int32, pageSize uint32) ([]*block.Snapshot, error) { snapshotsResp, err := s.block.ListSnapshots(&block.ListSnapshotsRequest{ Page: scw.Int32Ptr(page), PageSize: scw.Uint32Ptr(pageSize), @@ -174,7 +174,7 @@ func (s *Scaleway) DeleteSnapshot(ctx context.Context, snapshotID string, zone s } // GetSnapshot returns the snapshot that has the provided ID and zone. -func (s *Scaleway) GetSnapshot(ctx context.Context, snapshotID string, zone scw.Zone) (*block.SnapshotSummary, error) { +func (s *Scaleway) GetSnapshot(ctx context.Context, snapshotID string, zone scw.Zone) (*block.Snapshot, error) { // Return not found if snapshotID is not a valid UUID. if !isValidUUID(snapshotID) { return nil, &scw.ResourceNotFoundError{Resource: snapshotResource, ResourceID: snapshotID} @@ -188,7 +188,7 @@ func (s *Scaleway) GetSnapshot(ctx context.Context, snapshotID string, zone scw. return nil, fmt.Errorf("failed to get snapshot: %w", err) } - return snapshotToSnapshotSummary(snapshot), nil + return snapshot, nil } // ResizeVolume updates the size of a volume. It waits until the volume is successfully @@ -252,11 +252,23 @@ func (s *Scaleway) CreateVolume(ctx context.Context, name, snapshotID string, si return nil, fmt.Errorf("failed to create volume: %w", err) } + vol, err := s.block.WaitForVolume(&block.WaitForVolumeRequest{ + VolumeID: volume.ID, + Zone: zone, + }, scw.WithContext(ctx)) + if err != nil { + return nil, fmt.Errorf("wait for volume ended with an error: %w", err) + } + + if vol.Status != block.VolumeStatusAvailable { + return nil, fmt.Errorf("volume %s is in state %s", volume.ID, vol.Status) + } + return volume, nil } // CreateSnapshot creates a snapshot with the given parameters. -func (s *Scaleway) CreateSnapshot(ctx context.Context, name, volumeID string, zone scw.Zone) (*block.SnapshotSummary, error) { +func (s *Scaleway) CreateSnapshot(ctx context.Context, name, volumeID string, zone scw.Zone) (*block.Snapshot, error) { // Return not found if volumeID is not a valid UUID. if !isValidUUID(volumeID) { return nil, &scw.ResourceNotFoundError{Resource: volumeResource, ResourceID: volumeID} @@ -271,11 +283,11 @@ func (s *Scaleway) CreateSnapshot(ctx context.Context, name, volumeID string, zo return nil, fmt.Errorf("failed to create snapshot: %w", err) } - return snapshotToSnapshotSummary(snapshot), nil + return snapshot, nil } // WaitForSnapshot waits for a snapshot to be in a terminal state. -func (s *Scaleway) WaitForSnapshot(ctx context.Context, snapshotID string, zone scw.Zone) (*block.SnapshotSummary, error) { +func (s *Scaleway) WaitForSnapshot(ctx context.Context, snapshotID string, zone scw.Zone) (*block.Snapshot, error) { // Return not found if volumeID is not a valid UUID. if !isValidUUID(snapshotID) { return nil, &scw.ResourceNotFoundError{Resource: snapshotResource, ResourceID: snapshotID} @@ -289,5 +301,5 @@ func (s *Scaleway) WaitForSnapshot(ctx context.Context, snapshotID string, zone return nil, fmt.Errorf("wait for snapshot error: %w", err) } - return snapshotToSnapshotSummary(snap), nil + return snap, nil } diff --git a/pkg/scaleway/fake.go b/pkg/scaleway/fake.go index 9aecf55..4a952b6 100644 --- a/pkg/scaleway/fake.go +++ b/pkg/scaleway/fake.go @@ -123,7 +123,7 @@ func (f *Fake) AttachVolume(ctx context.Context, serverID string, volumeID strin return nil } -func (f *Fake) CreateSnapshot(ctx context.Context, name string, volumeID string, zone scw.Zone) (*block.SnapshotSummary, error) { +func (f *Fake) CreateSnapshot(ctx context.Context, name string, volumeID string, zone scw.Zone) (*block.Snapshot, error) { f.mux.Lock() defer f.mux.Unlock() @@ -153,7 +153,7 @@ func (f *Fake) CreateSnapshot(ctx context.Context, name string, volumeID string, f.snapshots[snapshot.ID] = snapshot - return snapshotToSnapshotSummary(snapshot), nil + return snapshot, nil } func (f *Fake) CreateVolume(ctx context.Context, name string, snapshotID string, size int64, perfIOPS *uint32, zone scw.Zone) (*block.Volume, error) { @@ -278,7 +278,7 @@ func (f *Fake) GetServer(ctx context.Context, serverID string, zone scw.Zone) (* return nil, &scw.ResourceNotFoundError{Resource: serverResource, ResourceID: serverID} } -func (f *Fake) GetSnapshot(ctx context.Context, snapshotID string, zone scw.Zone) (*block.SnapshotSummary, error) { +func (f *Fake) GetSnapshot(ctx context.Context, snapshotID string, zone scw.Zone) (*block.Snapshot, error) { f.mux.Lock() defer f.mux.Unlock() @@ -287,13 +287,13 @@ func (f *Fake) GetSnapshot(ctx context.Context, snapshotID string, zone scw.Zone } if s, ok := f.snapshots[snapshotID]; ok && s.Zone == zone { - return snapshotToSnapshotSummary(f.snapshots[snapshotID]), nil + return s, nil } return nil, &scw.ResourceNotFoundError{Resource: snapshotResource, ResourceID: snapshotID} } -func (f *Fake) GetSnapshotByName(ctx context.Context, name string, sourceVolumeID string, zone scw.Zone) (*block.SnapshotSummary, error) { +func (f *Fake) GetSnapshotByName(ctx context.Context, name string, sourceVolumeID string, zone scw.Zone) (*block.Snapshot, error) { f.mux.Lock() defer f.mux.Unlock() @@ -307,7 +307,7 @@ func (f *Fake) GetSnapshotByName(ctx context.Context, name string, sourceVolumeI return nil, ErrSnapshotExists } - return snapshotToSnapshotSummary(s), nil + return s, nil } } @@ -350,21 +350,16 @@ func (f *Fake) GetVolumeByName(ctx context.Context, name string, size scw.Size, return nil, ErrVolumeNotFound } -func (f *Fake) ListSnapshots(ctx context.Context, start uint32, max uint32) ([]*block.SnapshotSummary, string, error) { +func (f *Fake) ListSnapshots(ctx context.Context, start uint32, max uint32) ([]*block.Snapshot, string, error) { f.mux.Lock() defer f.mux.Unlock() results, next := mapPaginatedRange(f.snapshots, func(_ *block.Snapshot) bool { return true }, start, max) - snapshots := make([]*block.SnapshotSummary, 0, len(results)) - for _, r := range results { - snapshots = append(snapshots, snapshotToSnapshotSummary(r)) - } - - return snapshots, next, nil + return results, next, nil } -func (f *Fake) ListSnapshotsBySourceVolume(ctx context.Context, start uint32, max uint32, sourceVolumeID string, sourceVolumeZone scw.Zone) ([]*block.SnapshotSummary, string, error) { +func (f *Fake) ListSnapshotsBySourceVolume(ctx context.Context, start uint32, max uint32, sourceVolumeID string, sourceVolumeZone scw.Zone) ([]*block.Snapshot, string, error) { f.mux.Lock() defer f.mux.Unlock() @@ -372,12 +367,7 @@ func (f *Fake) ListSnapshotsBySourceVolume(ctx context.Context, start uint32, ma return s.ParentVolume != nil && s.ParentVolume.ID == sourceVolumeID && s.Zone == sourceVolumeZone }, start, max) - snapshots := make([]*block.SnapshotSummary, 0, len(results)) - for _, r := range results { - snapshots = append(snapshots, snapshotToSnapshotSummary(r)) - } - - return snapshots, next, nil + return results, next, nil } func (f *Fake) ListVolumes(ctx context.Context, start uint32, max uint32) ([]*block.Volume, string, error) { @@ -410,6 +400,6 @@ func (f *Fake) ResizeVolume(ctx context.Context, volumeID string, zone scw.Zone, return &scw.ResourceNotFoundError{Resource: volumeResource, ResourceID: volumeID} } -func (f *Fake) WaitForSnapshot(ctx context.Context, snapshotID string, zone scw.Zone) (*block.SnapshotSummary, error) { +func (f *Fake) WaitForSnapshot(ctx context.Context, snapshotID string, zone scw.Zone) (*block.Snapshot, error) { return f.GetSnapshot(ctx, snapshotID, zone) } diff --git a/pkg/scaleway/helpers.go b/pkg/scaleway/helpers.go index e7ef3ed..c52bee9 100644 --- a/pkg/scaleway/helpers.go +++ b/pkg/scaleway/helpers.go @@ -6,7 +6,6 @@ import ( "strconv" "github.com/google/uuid" - block "github.com/scaleway/scaleway-sdk-go/api/block/v1alpha1" "github.com/scaleway/scaleway-sdk-go/scw" ) @@ -95,23 +94,6 @@ func clientZones(client *scw.Client) ([]scw.Zone, error) { return nil, fmt.Errorf("no zone/region was provided, please set the SCW_DEFAULT_ZONE environment variable") } -// snapshotToSnapshotSummary converts a Snapshot to a SnapshotSummary. -func snapshotToSnapshotSummary(snapshot *block.Snapshot) *block.SnapshotSummary { - return &block.SnapshotSummary{ - ID: snapshot.ID, - Name: snapshot.Name, - ParentVolume: snapshot.ParentVolume, - Size: snapshot.Size, - ProjectID: snapshot.ProjectID, - CreatedAt: snapshot.CreatedAt, - UpdatedAt: snapshot.UpdatedAt, - Status: snapshot.Status, - Tags: snapshot.Tags, - Zone: snapshot.Zone, - Class: snapshot.Class, - } -} - // isValidUUID returns true if the provided value is a valid UUID. func isValidUUID(u string) bool { _, err := uuid.Parse(u) diff --git a/pkg/scaleway/interface.go b/pkg/scaleway/interface.go index 35c429a..f3975a7 100644 --- a/pkg/scaleway/interface.go +++ b/pkg/scaleway/interface.go @@ -11,19 +11,19 @@ import ( // Interface is the Scaleway wrapper interface. type Interface interface { AttachVolume(ctx context.Context, serverID string, volumeID string, zone scw.Zone) error - CreateSnapshot(ctx context.Context, name string, volumeID string, zone scw.Zone) (*block.SnapshotSummary, error) + CreateSnapshot(ctx context.Context, name string, volumeID string, zone scw.Zone) (*block.Snapshot, error) CreateVolume(ctx context.Context, name string, snapshotID string, size int64, perfIOPS *uint32, zone scw.Zone) (*block.Volume, error) DeleteSnapshot(ctx context.Context, snapshotID string, zone scw.Zone) error DeleteVolume(ctx context.Context, volumeID string, zone scw.Zone) error DetachVolume(ctx context.Context, volumeID string, zone scw.Zone) error GetServer(ctx context.Context, serverID string, zone scw.Zone) (*instance.Server, error) - GetSnapshot(ctx context.Context, snapshotID string, zone scw.Zone) (*block.SnapshotSummary, error) - GetSnapshotByName(ctx context.Context, name string, sourceVolumeID string, zone scw.Zone) (*block.SnapshotSummary, error) + GetSnapshot(ctx context.Context, snapshotID string, zone scw.Zone) (*block.Snapshot, error) + GetSnapshotByName(ctx context.Context, name string, sourceVolumeID string, zone scw.Zone) (*block.Snapshot, error) GetVolume(ctx context.Context, volumeID string, zone scw.Zone) (*block.Volume, error) GetVolumeByName(ctx context.Context, name string, size scw.Size, zone scw.Zone) (*block.Volume, error) - ListSnapshots(ctx context.Context, start uint32, max uint32) ([]*block.SnapshotSummary, string, error) - ListSnapshotsBySourceVolume(ctx context.Context, start uint32, max uint32, sourceVolumeID string, sourceVolumeZone scw.Zone) ([]*block.SnapshotSummary, string, error) + ListSnapshots(ctx context.Context, start uint32, max uint32) ([]*block.Snapshot, string, error) + ListSnapshotsBySourceVolume(ctx context.Context, start uint32, max uint32, sourceVolumeID string, sourceVolumeZone scw.Zone) ([]*block.Snapshot, string, error) ListVolumes(ctx context.Context, start uint32, max uint32) ([]*block.Volume, string, error) ResizeVolume(ctx context.Context, volumeID string, zone scw.Zone, size int64) error - WaitForSnapshot(ctx context.Context, snapshotID string, zone scw.Zone) (*block.SnapshotSummary, error) + WaitForSnapshot(ctx context.Context, snapshotID string, zone scw.Zone) (*block.Snapshot, error) } diff --git a/test/sanity/sanity_suite_test.go b/test/sanity/sanity_suite_test.go index 3b9a4c4..0b181ff 100644 --- a/test/sanity/sanity_suite_test.go +++ b/test/sanity/sanity_suite_test.go @@ -13,7 +13,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/scaleway/scaleway-sdk-go/api/instance/v1" - "github.com/scaleway/scaleway-sdk-go/api/marketplace/v1" + "github.com/scaleway/scaleway-sdk-go/api/marketplace/v2" "github.com/scaleway/scaleway-sdk-go/scw" "golang.org/x/crypto/ssh" diff --git a/test/sanity/sanity_test.go b/test/sanity/sanity_test.go index 74afd7c..f7ad007 100644 --- a/test/sanity/sanity_test.go +++ b/test/sanity/sanity_test.go @@ -18,7 +18,7 @@ import ( . "github.com/onsi/gomega" "github.com/pkg/sftp" "github.com/scaleway/scaleway-sdk-go/api/instance/v1" - "github.com/scaleway/scaleway-sdk-go/api/marketplace/v1" + "github.com/scaleway/scaleway-sdk-go/api/marketplace/v2" "github.com/scaleway/scaleway-sdk-go/scw" "golang.org/x/crypto/ssh" ) @@ -33,7 +33,7 @@ const ( var _ = Describe("Sanity", func() { It("should run sanity test successfully", func(ctx SpecContext) { By("Creating instance") - imageID, err := marketplaceAPI.GetLocalImageIDByLabel(&marketplace.GetLocalImageIDByLabelRequest{ + image, err := marketplaceAPI.GetLocalImageByLabel(&marketplace.GetLocalImageByLabelRequest{ ImageLabel: "ubuntu_jammy", CommercialType: instanceCommercialType, }, scw.WithContext(ctx)) @@ -42,7 +42,7 @@ var _ = Describe("Sanity", func() { server, err := instanceAPI.CreateServer(&instance.CreateServerRequest{ Name: "csi-sanity", DynamicIPRequired: scw.BoolPtr(true), - Image: imageID, + Image: image.ID, CommercialType: instanceCommercialType, RoutedIPEnabled: scw.BoolPtr(true), Tags: []string{"AUTHORIZED_KEY=" + strings.ReplaceAll(sshPublicKey, " ", "_")},