diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index 24b3669..48217e1 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -32,7 +32,7 @@ jobs: - name: Lint uses: golangci/golangci-lint-action@v6 with: - version: v1.59.1 + version: v1.60.2 args: --timeout=5m --config=.golangci.yml - name: Unit run: make unit diff --git a/.golangci.yml b/.golangci.yml index 1abefb8..b14d75e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -167,6 +167,7 @@ linters: - varnamelen # too annoying - wrapcheck - perfsprint + - exportloopref # temporarily disabled linters - copyloopvar diff --git a/Dockerfile b/Dockerfile index 62a8d4d..944ec62 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ RUN go mod download ######################################## -FROM --platform=${BUILDPLATFORM} golang:1.22.5-alpine3.20 AS builder +FROM --platform=${BUILDPLATFORM} golang:1.22.6-alpine3.20 AS builder RUN apk update && apk add --no-cache make ENV GO111MODULE on WORKDIR /src diff --git a/Makefile b/Makefile index d5de2ba..17e6bf9 100644 --- a/Makefile +++ b/Makefile @@ -69,7 +69,7 @@ build: build-controller build-node build-pvecsictl ## Build .PHONY: run run: build-controller ## Run - ./bin/proxmox-csi-controller-$(ARCH) --cloud-config=hack/cloud-config.yaml -v=4 + ./bin/proxmox-csi-controller-$(ARCH) --cloud-config=hack/cloud-config.yaml -v=5 .PHONY: lint lint: ## Lint Code diff --git a/docker-compose.yml b/docker-compose.yml index 882765c..704e4ad 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,6 +9,7 @@ services: environment: # NODE_NAME: worker-11 KUBECONFIG: /etc/kubernetes/kubeconfig + # UNSAFEMOUNT: "true" command: - "make" - "run" @@ -39,7 +40,7 @@ services: source: ./hack target: /etc/kubernetes csi-resizer: - image: registry.k8s.io/sig-storage/csi-resizer:v1.11.1 + image: registry.k8s.io/sig-storage/csi-resizer:v1.11.2 network_mode: "service:base" command: - "--v=5" @@ -55,7 +56,7 @@ services: source: ./hack target: /etc/kubernetes csi-provisioner: - image: registry.k8s.io/sig-storage/csi-provisioner:v5.0.1 + image: registry.k8s.io/sig-storage/csi-provisioner:v5.0.2 network_mode: "service:base" command: - "--v=5" @@ -81,7 +82,7 @@ services: source: ./hack target: /etc/kubernetes # csi-node-driver-registrar: - # image: registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.9.3 + # image: registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.11.1 # network_mode: "service:base" # command: # - "--v=5" diff --git a/go.mod b/go.mod index db8f76b..6ba123b 100644 --- a/go.mod +++ b/go.mod @@ -1,13 +1,13 @@ module github.com/sergelogvinov/proxmox-csi-plugin -go 1.22.5 +go 1.22.6 require ( - github.com/Telmate/proxmox-api-go v0.0.0-20240727211724-bdb805f525a0 - github.com/container-storage-interface/spec v1.9.0 + github.com/Telmate/proxmox-api-go v0.0.0-20240820050914-b6deb236b502 + github.com/container-storage-interface/spec v1.10.0 github.com/golang/protobuf v1.5.4 github.com/jarcoal/httpmock v1.3.1 - github.com/kubernetes-csi/csi-lib-utils v0.18.1 + github.com/kubernetes-csi/csi-lib-utils v0.19.0 github.com/sergelogvinov/proxmox-cloud-controller-manager v0.4.2 github.com/siderolabs/go-blockdevice v0.4.7 github.com/siderolabs/go-retry v0.3.3 @@ -15,26 +15,29 @@ require ( github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 google.golang.org/grpc v1.65.0 - k8s.io/api v0.30.3 - k8s.io/apimachinery v0.30.3 - k8s.io/client-go v0.30.3 + k8s.io/api v0.31.0 + k8s.io/apimachinery v0.31.0 + k8s.io/client-go v0.31.0 k8s.io/cloud-provider-openstack v1.30.0 k8s.io/klog/v2 v2.130.1 - k8s.io/mount-utils v0.30.3 + k8s.io/mount-utils v0.31.0 k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 ) require ( github.com/armon/circbuf v0.0.0-20190214190532-5111143e8da2 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect + github.com/coreos/go-systemd/v22 v22.5.0 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/emicklei/go-restful/v3 v3.12.1 // indirect - github.com/evanphx/json-patch v5.9.0+incompatible // indirect + github.com/fxamacker/cbor/v2 v2.7.0 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-openapi/jsonpointer v0.21.0 // indirect github.com/go-openapi/jsonreference v0.21.0 // indirect github.com/go-openapi/swag v0.23.0 // indirect + github.com/godbus/dbus/v5 v5.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/google/gnostic-models v0.6.8 // indirect + github.com/google/go-cmp v0.6.0 // indirect github.com/google/gofuzz v1.2.0 // indirect github.com/google/uuid v1.6.0 // indirect github.com/imdario/mergo v0.3.16 // indirect @@ -46,19 +49,23 @@ require ( 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/opencontainers/runc v1.1.13 // indirect + github.com/opencontainers/runtime-spec v1.0.3-0.20220909204839-494a5a6aca78 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/siderolabs/go-cmd v0.1.1 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/stretchr/objx v0.5.2 // indirect + github.com/x448/float16 v0.8.4 // indirect golang.org/x/net v0.26.0 // indirect golang.org/x/oauth2 v0.21.0 // indirect golang.org/x/sys v0.21.0 // indirect golang.org/x/term v0.21.0 // indirect golang.org/x/text v0.16.0 // indirect golang.org/x/time v0.5.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240820151423-278611b39280 // indirect google.golang.org/protobuf v1.34.2 // indirect + gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/inf.v0 v0.9.1 // 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 2b45fde..5ac725e 100644 --- a/go.sum +++ b/go.sum @@ -1,17 +1,20 @@ -github.com/Telmate/proxmox-api-go v0.0.0-20240727211724-bdb805f525a0 h1:mPpJzWJBvxyqePn7lxxb7j3F3Q+IazGUiPv0OStlgmY= -github.com/Telmate/proxmox-api-go v0.0.0-20240727211724-bdb805f525a0/go.mod h1:O6yNUi0hG9GQLMBgpikSvbnuek1OMweFtbac1sfGuUs= +github.com/Telmate/proxmox-api-go v0.0.0-20240820050914-b6deb236b502 h1:Y78eKZnVsHBFMyyxqIF0cgN6/71AyDbtpfm3R53RlDE= +github.com/Telmate/proxmox-api-go v0.0.0-20240820050914-b6deb236b502/go.mod h1:Gu6n6vEn1hlyFUkjrvU+X1fdgaSXLoM9HKYYJqy1fsY= github.com/armon/circbuf v0.0.0-20190214190532-5111143e8da2 h1:7Ip0wMmLHLRJdrloDxZfhMm0xrLXZS8+COSu2bXmEQs= github.com/armon/circbuf v0.0.0-20190214190532-5111143e8da2/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -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/container-storage-interface/spec v1.10.0 h1:YkzWPV39x+ZMTa6Ax2czJLLwpryrQ+dPesB34mrRMXA= +github.com/container-storage-interface/spec v1.10.0/go.mod h1:DtUvaQszPml1YJfIK7c00mlv6/g4wNMLanLgiUbKFRI= +github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= +github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= 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/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/emicklei/go-restful/v3 v3.12.1 h1:PJMDIM/ak7btuL8Ex0iYET9hxM3CI2sjZtzpL63nKAU= github.com/emicklei/go-restful/v3 v3.12.1/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= -github.com/evanphx/json-patch v5.9.0+incompatible h1:fBXyNpNMuTTDdquAq/uisOr2lShz4oaXpDTX2bLe7ls= -github.com/evanphx/json-patch v5.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= +github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= @@ -23,6 +26,9 @@ github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= +github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= @@ -35,8 +41,8 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 h1:k7nVchz72niMH6YLQNvHSdIE7iqsQxK1P41mySCvssg= -github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw= +github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af h1:kmjWCqn2qkEml422C2Rrd27c3VGxi6a/6HNq8QmHRKM= +github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo= 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/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= @@ -55,8 +61,8 @@ 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-lib-utils v0.18.1 h1:vpg1kbQ6lFVCz7mY71zcqVE7W0GAQXXBoFfHvbW3gdw= -github.com/kubernetes-csi/csi-lib-utils v0.18.1/go.mod h1:PIcn27zmbY0KBue4JDdZVfDF56tjcS3jKroZPi+pMoY= +github.com/kubernetes-csi/csi-lib-utils v0.19.0 h1:3sT8mL9+St2acyrEtuR7CQ5L78GR4lgsb+sfon9tGfA= +github.com/kubernetes-csi/csi-lib-utils v0.19.0/go.mod h1:lBuMKvoyd8c3EG+itmnVWApLDHnLkU7ibxxZSPuOw0M= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/maxatome/go-testdeep v1.12.0 h1:Ql7Go8Tg0C1D/uMMX59LAoYK7LffeJQ6X2T04nTH68g= @@ -70,16 +76,21 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/onsi/ginkgo/v2 v2.17.2 h1:7eMhcy3GimbsA3hEnVKdw/PQM9XN9krpKVXsZdph0/g= -github.com/onsi/ginkgo/v2 v2.17.2/go.mod h1:nP2DPOQoNsQmsVyv5rDA8JkXQoCs6goXIvr/PRJ1eCc= +github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA= +github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To= github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk= github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0= +github.com/opencontainers/runc v1.1.13 h1:98S2srgG9vw0zWcDpFMn5TRrh8kLxa/5OFUstuUhmRs= +github.com/opencontainers/runc v1.1.13/go.mod h1:R016aXacfp/gwQBYw2FDGa9m+n6atbLWrYY8hNMT/sA= +github.com/opencontainers/runtime-spec v1.0.3-0.20220909204839-494a5a6aca78 h1:R5M2qXZiK/mWPMT4VldCOiSL9HIAMuxQZWdG0CSM5+4= +github.com/opencontainers/runtime-spec v1.0.3-0.20220909204839-494a5a6aca78/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -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.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= -github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sergelogvinov/proxmox-cloud-controller-manager v0.4.2 h1:0UuuPKvxLq5iozpGvwyuWNA4tysUEyyHW2fGEK7RvJQ= github.com/sergelogvinov/proxmox-cloud-controller-manager v0.4.2/go.mod h1:Zgf4OsxW8E06wDy6CQKq7xbQl2ytfXwkxfqgCApH/lY= @@ -102,11 +113,15 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= +github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +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.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -145,8 +160,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 h1:BwIjyKYGsK9dMCBOorzRri8MQwmi7mT9rGHsCEinZkA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240820151423-278611b39280 h1:XQMA2e105XNlEZ8NRF0HqnUOZzP14sUSsgL09kpdNnU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240820151423-278611b39280/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= @@ -154,6 +169,8 @@ google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWn 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/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSPG+6V4= +gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -162,20 +179,20 @@ 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/api v0.30.3 h1:ImHwK9DCsPA9uoU3rVh4QHAHHK5dTSv1nxJUapx8hoQ= -k8s.io/api v0.30.3/go.mod h1:GPc8jlzoe5JG3pb0KJCSLX5oAFIW3/qNJITlDj8BH04= -k8s.io/apimachinery v0.30.3 h1:q1laaWCmrszyQuSQCfNB8cFgCuDAoPszKY4ucAjDwHc= -k8s.io/apimachinery v0.30.3/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc= -k8s.io/client-go v0.30.3 h1:bHrJu3xQZNXIi8/MoxYtZBBWQQXwy16zqJwloXXfD3k= -k8s.io/client-go v0.30.3/go.mod h1:8d4pf8vYu665/kUbsxWAQ/JDBNWqfFeZnvFiVdmx89U= +k8s.io/api v0.31.0 h1:b9LiSjR2ym/SzTOlfMHm1tr7/21aD7fSkqgD/CVJBCo= +k8s.io/api v0.31.0/go.mod h1:0YiFF+JfFxMM6+1hQei8FY8M7s1Mth+z/q7eF1aJkTE= +k8s.io/apimachinery v0.31.0 h1:m9jOiSr3FoSSL5WO9bjm1n6B9KROYYgNZOb4tyZ1lBc= +k8s.io/apimachinery v0.31.0/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= +k8s.io/client-go v0.31.0 h1:QqEJzNjbN2Yv1H79SsS+SWnXkBgVu4Pj3CJQgbx0gI8= +k8s.io/client-go v0.31.0/go.mod h1:Y9wvC76g4fLjmU0BA+rV+h2cncoadjvjjkkIGoTLcGU= k8s.io/cloud-provider-openstack v1.30.0 h1:SfITCugKt4VYOZSyDnggwRyuqox2DRXjU7AaUCMmPAY= k8s.io/cloud-provider-openstack v1.30.0/go.mod h1:sUW6cZzIyODbVIw9fj/JFYAAOfhoCxeohfw3fnGQYN0= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/kube-openapi v0.0.0-20240620174524-b456828f718b h1:Q9xmGWBvOGd8UJyccgpYlLosk/JlfP3xQLNkQlHJeXw= k8s.io/kube-openapi v0.0.0-20240620174524-b456828f718b/go.mod h1:UxDHUPsUwTOOxSU+oXURfFBcAS6JwiRXTYqYwfuGowc= -k8s.io/mount-utils v0.30.3 h1:8Z3wSW5+GSvGNtlDhtoZrBCKLMIf5z/9tf8pie+G06s= -k8s.io/mount-utils v0.30.3/go.mod h1:9sCVmwGLcV1MPvbZ+rToMDnl1QcGozy+jBPd0MsQLIo= +k8s.io/mount-utils v0.31.0 h1:o+a+n6gyZ7MGc6bIERU3LeFTHbLDBiVReaDpWlJotUE= +k8s.io/mount-utils v0.31.0/go.mod h1:HV/VYBUGqYUj4vt82YltzpWvgv8FPg0G9ItyInT3NPU= k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A= k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= diff --git a/pkg/csi/controller.go b/pkg/csi/controller.go index 742aed1..f837f0d 100644 --- a/pkg/csi/controller.go +++ b/pkg/csi/controller.go @@ -19,6 +19,7 @@ package csi import ( "context" "fmt" + "os" "strconv" "strings" "sync" @@ -60,6 +61,8 @@ type ControllerService struct { Kclient clientkubernetes.Interface volumeLocks sync.Mutex + + csi.UnimplementedControllerServer } // NewControllerService returns a new controller service @@ -84,7 +87,7 @@ func NewControllerService(kclient *clientkubernetes.Clientset, cloudConfig strin // //nolint:gocyclo,cyclop func (d *ControllerService) CreateVolume(_ context.Context, request *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error) { - klog.V(4).InfoS("CreateVolume: called", "args", protosanitizer.StripSecrets(*request)) + klog.V(4).InfoS("CreateVolume: called", "args", protosanitizer.StripSecrets(request)) pvc := request.GetName() if len(pvc) == 0 { @@ -232,7 +235,7 @@ func (d *ControllerService) CreateVolume(_ context.Context, request *csi.CreateV // DeleteVolume deletes a volume. func (d *ControllerService) DeleteVolume(_ context.Context, request *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) { - klog.V(4).InfoS("DeleteVolume: called", "args", protosanitizer.StripSecrets(*request)) + klog.V(4).InfoS("DeleteVolume: called", "args", protosanitizer.StripSecrets(request)) volumeID := request.GetVolumeId() if len(volumeID) == 0 { @@ -304,7 +307,7 @@ func (d *ControllerService) ControllerGetCapabilities(_ context.Context, _ *csi. // ControllerPublishVolume publish a volume func (d *ControllerService) ControllerPublishVolume(ctx context.Context, request *csi.ControllerPublishVolumeRequest) (*csi.ControllerPublishVolumeResponse, error) { - klog.V(4).InfoS("ControllerPublishVolume: called", "args", protosanitizer.StripSecrets(*request)) + klog.V(4).InfoS("ControllerPublishVolume: called", "args", protosanitizer.StripSecrets(request)) volumeID := request.GetVolumeId() if volumeID == "" { @@ -364,6 +367,14 @@ func (d *ControllerService) ControllerPublishVolume(ctx context.Context, request "iothread": "1", } + // Temporary workaround for unsafe mount, better to use a VolumeAttributesClass resource + unsafeEnv := os.Getenv("UNSAFEMOUNT") + if unsafeEnv == "true" { // nolint: goconst + options = map[string]string{ + "iothread": "1", + } + } + if request.GetReadonly() { options["ro"] = "1" } @@ -427,7 +438,7 @@ func (d *ControllerService) ControllerPublishVolume(ctx context.Context, request // ControllerUnpublishVolume unpublish a volume func (d *ControllerService) ControllerUnpublishVolume(ctx context.Context, request *csi.ControllerUnpublishVolumeRequest) (*csi.ControllerUnpublishVolumeResponse, error) { - klog.V(4).InfoS("ControllerUnpublishVolume: called", "args", protosanitizer.StripSecrets(*request)) + klog.V(4).InfoS("ControllerUnpublishVolume: called", "args", protosanitizer.StripSecrets(request)) volumeID := request.GetVolumeId() if volumeID == "" { @@ -482,21 +493,21 @@ func (d *ControllerService) ControllerUnpublishVolume(ctx context.Context, reque // ValidateVolumeCapabilities validate volume capabilities func (d *ControllerService) ValidateVolumeCapabilities(_ context.Context, request *csi.ValidateVolumeCapabilitiesRequest) (*csi.ValidateVolumeCapabilitiesResponse, error) { - klog.V(4).InfoS("ValidateVolumeCapabilities: called", "args", protosanitizer.StripSecrets(*request)) + klog.V(4).InfoS("ValidateVolumeCapabilities: called", "args", protosanitizer.StripSecrets(request)) return nil, status.Error(codes.Unimplemented, "") } // ListVolumes list volumes func (d *ControllerService) ListVolumes(_ context.Context, request *csi.ListVolumesRequest) (*csi.ListVolumesResponse, error) { - klog.V(4).InfoS("ListVolumes: called", "args", protosanitizer.StripSecrets(*request)) + klog.V(4).InfoS("ListVolumes: called", "args", protosanitizer.StripSecrets(request)) return nil, status.Error(codes.Unimplemented, "") } // GetCapacity get capacity func (d *ControllerService) GetCapacity(_ context.Context, request *csi.GetCapacityRequest) (*csi.GetCapacityResponse, error) { - klog.V(5).InfoS("GetCapacity: called", "args", protosanitizer.StripSecrets(*request)) + klog.V(5).InfoS("GetCapacity: called", "args", protosanitizer.StripSecrets(request)) topology := request.GetAccessibleTopology() if topology != nil { @@ -545,28 +556,28 @@ func (d *ControllerService) GetCapacity(_ context.Context, request *csi.GetCapac // CreateSnapshot create a snapshot func (d *ControllerService) CreateSnapshot(_ context.Context, request *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error) { - klog.V(4).InfoS("CreateSnapshot: called", "args", protosanitizer.StripSecrets(*request)) + klog.V(4).InfoS("CreateSnapshot: called", "args", protosanitizer.StripSecrets(request)) return nil, status.Error(codes.Unimplemented, "") } // DeleteSnapshot delete a snapshot func (d *ControllerService) DeleteSnapshot(_ context.Context, request *csi.DeleteSnapshotRequest) (*csi.DeleteSnapshotResponse, error) { - klog.V(4).InfoS("DeleteSnapshot: called", "args", protosanitizer.StripSecrets(*request)) + klog.V(4).InfoS("DeleteSnapshot: called", "args", protosanitizer.StripSecrets(request)) return nil, status.Error(codes.Unimplemented, "") } // ListSnapshots list snapshots func (d *ControllerService) ListSnapshots(_ context.Context, request *csi.ListSnapshotsRequest) (*csi.ListSnapshotsResponse, error) { - klog.V(4).InfoS("ListSnapshots: called", "args", protosanitizer.StripSecrets(*request)) + klog.V(4).InfoS("ListSnapshots: called", "args", protosanitizer.StripSecrets(request)) return nil, status.Error(codes.Unimplemented, "") } // ControllerExpandVolume expand a volume func (d *ControllerService) ControllerExpandVolume(_ context.Context, request *csi.ControllerExpandVolumeRequest) (*csi.ControllerExpandVolumeResponse, error) { - klog.V(4).InfoS("ControllerExpandVolume: called", "args", protosanitizer.StripSecrets(*request)) + klog.V(4).InfoS("ControllerExpandVolume: called", "args", protosanitizer.StripSecrets(request)) volumeID := request.GetVolumeId() if volumeID == "" { @@ -687,14 +698,14 @@ func (d *ControllerService) ControllerExpandVolume(_ context.Context, request *c // ControllerGetVolume get a volume func (d *ControllerService) ControllerGetVolume(_ context.Context, request *csi.ControllerGetVolumeRequest) (*csi.ControllerGetVolumeResponse, error) { - klog.V(4).InfoS("ControllerGetVolume: called", "args", protosanitizer.StripSecrets(*request)) + klog.V(4).InfoS("ControllerGetVolume: called", "args", protosanitizer.StripSecrets(request)) return nil, status.Error(codes.Unimplemented, "") } // ControllerModifyVolume modify a volume func (d *ControllerService) ControllerModifyVolume(_ context.Context, request *csi.ControllerModifyVolumeRequest) (*csi.ControllerModifyVolumeResponse, error) { - klog.V(4).InfoS("ControllerModifyVolume: called", "args", protosanitizer.StripSecrets(*request)) + klog.V(4).InfoS("ControllerModifyVolume: called", "args", protosanitizer.StripSecrets(request)) return nil, status.Error(codes.Unimplemented, "") } diff --git a/pkg/csi/helper.go b/pkg/csi/helper.go index 270876d..902ffdd 100644 --- a/pkg/csi/helper.go +++ b/pkg/csi/helper.go @@ -94,7 +94,7 @@ func locationFromTopologyRequirement(tr *proto.TopologyRequirement) (region, zon } func stripSecrets(msg interface{}) string { - reqValue := reflect.ValueOf(msg) + reqValue := reflect.ValueOf(&msg) reqType := reqValue.Type() if reqType.Kind() == reflect.Struct { diff --git a/pkg/csi/identity.go b/pkg/csi/identity.go index a531754..0cbd8d5 100644 --- a/pkg/csi/identity.go +++ b/pkg/csi/identity.go @@ -26,7 +26,9 @@ import ( ) // IdentityService is the identity service for the CSI driver -type IdentityService struct{} +type IdentityService struct { + csi.UnimplementedIdentityServer +} // NewIdentityService returns a new identity service func NewIdentityService() *IdentityService { diff --git a/pkg/csi/node.go b/pkg/csi/node.go index 673fa2b..defdff6 100644 --- a/pkg/csi/node.go +++ b/pkg/csi/node.go @@ -71,6 +71,8 @@ type NodeService struct { Mount mount.IMount volumeLocks sync.Mutex + + csi.UnimplementedNodeServer } // NewNodeService returns a new NodeService @@ -86,7 +88,7 @@ func NewNodeService(nodeID string, clientSet kubernetes.Interface) *NodeService // //nolint:cyclop,gocyclo func (n *NodeService) NodeStageVolume(_ context.Context, request *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error) { - klog.V(4).InfoS("NodeStageVolume: called", "args", stripSecrets(*request)) + klog.V(4).InfoS("NodeStageVolume: called", "args", stripSecrets(request)) volumeID := request.GetVolumeId() if len(volumeID) == 0 { @@ -220,7 +222,7 @@ func (n *NodeService) NodeStageVolume(_ context.Context, request *csi.NodeStageV // //nolint:dupl func (n *NodeService) NodeUnstageVolume(_ context.Context, request *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error) { - klog.V(4).InfoS("NodeUnstageVolume: called", "args", stripSecrets(*request)) + klog.V(4).InfoS("NodeUnstageVolume: called", "args", stripSecrets(request)) stagingTargetPath := request.GetStagingTargetPath() if len(stagingTargetPath) == 0 { @@ -282,7 +284,7 @@ func (n *NodeService) NodeUnstageVolume(_ context.Context, request *csi.NodeUnst // //nolint:dupl func (n *NodeService) NodePublishVolume(_ context.Context, request *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error) { - klog.V(4).InfoS("NodePublishVolume: called", "args", stripSecrets(*request)) + klog.V(4).InfoS("NodePublishVolume: called", "args", stripSecrets(request)) stagingTargetPath := request.GetStagingTargetPath() if len(stagingTargetPath) == 0 { @@ -387,7 +389,7 @@ func (n *NodeService) NodePublishVolume(_ context.Context, request *csi.NodePubl // //nolint:dupl func (n *NodeService) NodeUnpublishVolume(_ context.Context, request *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error) { - klog.V(4).InfoS("NodeUnpublishVolume: called", "args", stripSecrets(*request)) + klog.V(4).InfoS("NodeUnpublishVolume: called", "args", stripSecrets(request)) targetPath := request.GetTargetPath() if len(targetPath) == 0 { @@ -408,7 +410,7 @@ func (n *NodeService) NodeUnpublishVolume(_ context.Context, request *csi.NodeUn // NodeGetVolumeStats get the volume stats func (n *NodeService) NodeGetVolumeStats(_ context.Context, request *csi.NodeGetVolumeStatsRequest) (*csi.NodeGetVolumeStatsResponse, error) { - klog.V(4).InfoS("NodeGetVolumeStats: called", "args", stripSecrets(*request)) + klog.V(4).InfoS("NodeGetVolumeStats: called", "args", stripSecrets(request)) volumePath := request.GetVolumePath() if len(volumePath) == 0 { @@ -450,7 +452,7 @@ func (n *NodeService) NodeGetVolumeStats(_ context.Context, request *csi.NodeGet // NodeExpandVolume expand the volume func (n *NodeService) NodeExpandVolume(_ context.Context, request *csi.NodeExpandVolumeRequest) (*csi.NodeExpandVolumeResponse, error) { - klog.V(4).InfoS("NodeExpandVolume: called", "args", stripSecrets(*request)) + klog.V(4).InfoS("NodeExpandVolume: called", "args", stripSecrets(request)) volumeID := request.GetVolumeId() if len(volumeID) == 0 { @@ -566,7 +568,7 @@ func (n *NodeService) NodeGetInfo(ctx context.Context, _ *csi.NodeGetInfoRequest func isValidVolumeCapabilities(volCaps []*csi.VolumeCapability) bool { hasSupport := func(reqcap *csi.VolumeCapability) bool { - for _, c := range volumeCaps { + for _, c := range volumeCaps { // nolint: govet if c.GetMode() == reqcap.GetAccessMode().GetMode() { return true } diff --git a/pkg/csi/node_test.go b/pkg/csi/node_test.go index 5e126cf..c461ed7 100644 --- a/pkg/csi/node_test.go +++ b/pkg/csi/node_test.go @@ -139,7 +139,7 @@ func TestNodeStageVolumeErrors(t *testing.T) { } else { assert.Nil(t, err) assert.NotNil(t, resp) - assert.Equal(t, *resp, proto.NodeStageVolumeResponse{}) + assert.Equal(t, resp, &proto.NodeStageVolumeResponse{}) } }) } diff --git a/pkg/csi/utils.go b/pkg/csi/utils.go index 7634bf8..7908f41 100644 --- a/pkg/csi/utils.go +++ b/pkg/csi/utils.go @@ -18,6 +18,7 @@ package csi import ( "encoding/hex" + "errors" "fmt" "os" "path/filepath" @@ -146,7 +147,7 @@ func getVolumeSize(cl *pxapi.Client, vol *volume.Volume) (int64, error) { } if st == nil { - return 0, fmt.Errorf(ErrorNotFound) + return 0, errors.New(ErrorNotFound) } return st.size, nil