mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-09 16:00:22 +00:00
build: address nolintlint
errors from new golangci-lint
Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
parent
5913ed92fe
commit
81218a69f9
@ -23,7 +23,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
snapapi "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1"
|
snapapi "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1"
|
||||||
. "github.com/onsi/ginkgo/v2" // nolint
|
. "github.com/onsi/ginkgo/v2"
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
|
@ -21,7 +21,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
. "github.com/onsi/gomega" // nolint
|
. "github.com/onsi/gomega"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
"k8s.io/kubernetes/test/e2e/framework"
|
"k8s.io/kubernetes/test/e2e/framework"
|
||||||
|
@ -21,7 +21,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
// nolint:lll // error string cannot be split into multiple lines as is a
|
//nolint:lll // error string cannot be split into multiple lines as is a
|
||||||
// output from kubectl.
|
// output from kubectl.
|
||||||
func TestGetStdErr(t *testing.T) {
|
func TestGetStdErr(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
@ -30,7 +30,7 @@ import (
|
|||||||
// composeIntreeMigVolID create a volID similar to intree migration volID
|
// composeIntreeMigVolID create a volID similar to intree migration volID
|
||||||
// the migration volID format looks like below
|
// the migration volID format looks like below
|
||||||
// mig-mons-<hash>-image-<UUID_<poolhash>
|
// mig-mons-<hash>-image-<UUID_<poolhash>
|
||||||
// nolint:lll // ex: "mig_mons-b7f67366bb43f32e07d8a261a7840da9_image-e0b45b52-7e09-47d3-8f1b-806995fa4412_706f6f6c5f7265706c6963615f706f6f6c
|
//nolint:lll // ex: "mig_mons-b7f67366bb43f32e07d8a261a7840da9_image-e0b45b52-7e09-47d3-8f1b-806995fa4412_706f6f6c5f7265706c6963615f706f6f6c
|
||||||
func composeIntreeMigVolID(mons, rbdImageName string) string {
|
func composeIntreeMigVolID(mons, rbdImageName string) string {
|
||||||
poolField := hex.EncodeToString([]byte(defaultRBDPool))
|
poolField := hex.EncodeToString([]byte(defaultRBDPool))
|
||||||
monsField := monsPrefix + getMonsHash(mons)
|
monsField := monsPrefix + getMonsHash(mons)
|
||||||
|
@ -24,7 +24,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
snapapi "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1"
|
snapapi "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1"
|
||||||
. "github.com/onsi/ginkgo/v2" // nolint
|
. "github.com/onsi/ginkgo/v2"
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
apierrs "k8s.io/apimachinery/pkg/api/errors"
|
apierrs "k8s.io/apimachinery/pkg/api/errors"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
@ -420,7 +420,7 @@ func deletePod(name, ns string, c kubernetes.Interface, t int) error {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint:unparam // currently skipNotFound is always false, this can change in the future
|
//nolint:unparam // currently skipNotFound is always false, this can change in the future
|
||||||
func deletePodWithLabel(label, ns string, skipNotFound bool) error {
|
func deletePodWithLabel(label, ns string, skipNotFound bool) error {
|
||||||
err := retryKubectlArgs(
|
err := retryKubectlArgs(
|
||||||
ns,
|
ns,
|
||||||
|
@ -25,7 +25,7 @@ import (
|
|||||||
|
|
||||||
"github.com/ceph/ceph-csi/internal/util"
|
"github.com/ceph/ceph-csi/internal/util"
|
||||||
|
|
||||||
. "github.com/onsi/ginkgo/v2" // nolint
|
. "github.com/onsi/ginkgo/v2"
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
@ -204,7 +204,7 @@ func checkGetKeyError(err error, stdErr string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// checkClusternameInMetadata check for cluster name metadata on RBD image.
|
// checkClusternameInMetadata check for cluster name metadata on RBD image.
|
||||||
// nolint:nilerr // intentionally returning nil on error in the retry loop.
|
//nolint:nilerr // intentionally returning nil on error in the retry loop.
|
||||||
func checkClusternameInMetadata(f *framework.Framework, ns, pool, image string) {
|
func checkClusternameInMetadata(f *framework.Framework, ns, pool, image string) {
|
||||||
t := time.Duration(deployTimeout) * time.Minute
|
t := time.Duration(deployTimeout) * time.Minute
|
||||||
var (
|
var (
|
||||||
|
@ -37,7 +37,7 @@ import (
|
|||||||
"k8s.io/kubernetes/test/e2e/framework"
|
"k8s.io/kubernetes/test/e2e/framework"
|
||||||
)
|
)
|
||||||
|
|
||||||
// nolint:gomnd // numbers specify Kernel versions.
|
//nolint:gomnd // numbers specify Kernel versions.
|
||||||
var nbdResizeSupport = []util.KernelVersion{
|
var nbdResizeSupport = []util.KernelVersion{
|
||||||
{
|
{
|
||||||
Version: 5,
|
Version: 5,
|
||||||
@ -49,7 +49,7 @@ var nbdResizeSupport = []util.KernelVersion{
|
|||||||
}, // standard 5.3+ versions
|
}, // standard 5.3+ versions
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint:gomnd // numbers specify Kernel versions.
|
//nolint:gomnd // numbers specify Kernel versions.
|
||||||
var fastDiffSupport = []util.KernelVersion{
|
var fastDiffSupport = []util.KernelVersion{
|
||||||
{
|
{
|
||||||
Version: 5,
|
Version: 5,
|
||||||
@ -61,7 +61,7 @@ var fastDiffSupport = []util.KernelVersion{
|
|||||||
}, // standard 5.3+ versions
|
}, // standard 5.3+ versions
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint:gomnd // numbers specify Kernel versions.
|
//nolint:gomnd // numbers specify Kernel versions.
|
||||||
var deepFlattenSupport = []util.KernelVersion{
|
var deepFlattenSupport = []util.KernelVersion{
|
||||||
{
|
{
|
||||||
Version: 5,
|
Version: 5,
|
||||||
@ -75,7 +75,7 @@ var deepFlattenSupport = []util.KernelVersion{
|
|||||||
|
|
||||||
// To use `io-timeout=0` we need
|
// To use `io-timeout=0` we need
|
||||||
// www.mail-archive.com/linux-block@vger.kernel.org/msg38060.html
|
// www.mail-archive.com/linux-block@vger.kernel.org/msg38060.html
|
||||||
// nolint:gomnd // numbers specify Kernel versions.
|
//nolint:gomnd // numbers specify Kernel versions.
|
||||||
var nbdZeroIOtimeoutSupport = []util.KernelVersion{
|
var nbdZeroIOtimeoutSupport = []util.KernelVersion{
|
||||||
{
|
{
|
||||||
Version: 5,
|
Version: 5,
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
. "github.com/onsi/gomega" // nolint
|
. "github.com/onsi/gomega"
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/api/resource"
|
"k8s.io/apimachinery/pkg/api/resource"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
@ -23,7 +23,7 @@ import (
|
|||||||
|
|
||||||
snapapi "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1"
|
snapapi "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1"
|
||||||
snapclient "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1"
|
snapclient "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1"
|
||||||
. "github.com/onsi/gomega" // nolint
|
. "github.com/onsi/gomega"
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
apierrs "k8s.io/apimachinery/pkg/api/errors"
|
apierrs "k8s.io/apimachinery/pkg/api/errors"
|
||||||
"k8s.io/apimachinery/pkg/api/resource"
|
"k8s.io/apimachinery/pkg/api/resource"
|
||||||
@ -293,7 +293,7 @@ func getVolumeSnapshotContent(namespace, snapshotName string) (*snapapi.VolumeSn
|
|||||||
return volumeSnapshotContent, nil
|
return volumeSnapshotContent, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint:gocyclo,cyclop // reduce complexity
|
//nolint:gocyclo,cyclop // reduce complexity
|
||||||
func validateBiggerPVCFromSnapshot(f *framework.Framework,
|
func validateBiggerPVCFromSnapshot(f *framework.Framework,
|
||||||
pvcPath,
|
pvcPath,
|
||||||
appPath,
|
appPath,
|
||||||
|
@ -322,7 +322,7 @@ func validateRBDStaticMigrationPVC(f *framework.Framework, appPath, scName strin
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint:gocyclo,cyclop // reduce complexity
|
//nolint:gocyclo,cyclop // reduce complexity
|
||||||
func validateCephFsStaticPV(f *framework.Framework, appPath, scPath string) error {
|
func validateCephFsStaticPV(f *framework.Framework, appPath, scPath string) error {
|
||||||
opt := make(map[string]string)
|
opt := make(map[string]string)
|
||||||
var (
|
var (
|
||||||
|
@ -23,7 +23,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
. "github.com/onsi/ginkgo/v2" // nolint
|
. "github.com/onsi/ginkgo/v2"
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/api/resource"
|
"k8s.io/apimachinery/pkg/api/resource"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
@ -23,7 +23,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
. "github.com/onsi/ginkgo/v2" // nolint
|
. "github.com/onsi/ginkgo/v2"
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/api/resource"
|
"k8s.io/apimachinery/pkg/api/resource"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
@ -852,7 +852,7 @@ func writeDataAndCalChecksum(app *v1.Pod, opt *metav1.ListOptions, f *framework.
|
|||||||
return checkSum, nil
|
return checkSum, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint:gocyclo,gocognit,nestif,cyclop // reduce complexity
|
//nolint:gocyclo,gocognit,nestif,cyclop // reduce complexity
|
||||||
func validatePVCClone(
|
func validatePVCClone(
|
||||||
totalCount int,
|
totalCount int,
|
||||||
sourcePvcPath, sourceAppPath, clonePvcPath, clonePvcAppPath,
|
sourcePvcPath, sourceAppPath, clonePvcPath, clonePvcAppPath,
|
||||||
@ -1067,7 +1067,7 @@ func validatePVCClone(
|
|||||||
validateRBDImageCount(f, 0, defaultRBDPool)
|
validateRBDImageCount(f, 0, defaultRBDPool)
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint:gocyclo,gocognit,nestif,cyclop // reduce complexity
|
//nolint:gocyclo,gocognit,nestif,cyclop // reduce complexity
|
||||||
func validatePVCSnapshot(
|
func validatePVCSnapshot(
|
||||||
totalCount int,
|
totalCount int,
|
||||||
pvcPath, appPath, snapshotPath, pvcClonePath, appClonePath string,
|
pvcPath, appPath, snapshotPath, pvcClonePath, appClonePath string,
|
||||||
@ -1529,7 +1529,7 @@ func validateController(
|
|||||||
return deleteResource(rbdExamplePath + "storageclass.yaml")
|
return deleteResource(rbdExamplePath + "storageclass.yaml")
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint:deadcode,unused // Unused code will be used in future.
|
//nolint:deadcode,unused // Unused code will be used in future.
|
||||||
// k8sVersionGreaterEquals checks the ServerVersion of the Kubernetes cluster
|
// k8sVersionGreaterEquals checks the ServerVersion of the Kubernetes cluster
|
||||||
// and compares it to the major.minor version passed. In case the version of
|
// and compares it to the major.minor version passed. In case the version of
|
||||||
// the cluster is equal or higher to major.minor, `true` is returned, `false`
|
// the cluster is equal or higher to major.minor, `true` is returned, `false`
|
||||||
@ -1681,7 +1681,7 @@ func retryKubectlFile(namespace string, action kubectlAction, filename string, t
|
|||||||
// retryKubectlArgs takes a namespace and action telling kubectl what to do
|
// retryKubectlArgs takes a namespace and action telling kubectl what to do
|
||||||
// with the passed arguments. This function retries until no error occurred, or
|
// with the passed arguments. This function retries until no error occurred, or
|
||||||
// the timeout passed.
|
// the timeout passed.
|
||||||
// nolint:unparam // retryKubectlArgs will be used with kubectlDelete arg later on.
|
//nolint:unparam // retryKubectlArgs will be used with kubectlDelete arg later on.
|
||||||
func retryKubectlArgs(namespace string, action kubectlAction, t int, args ...string) error {
|
func retryKubectlArgs(namespace string, action kubectlAction, t int, args ...string) error {
|
||||||
timeout := time.Duration(t) * time.Minute
|
timeout := time.Duration(t) * time.Minute
|
||||||
args = append([]string{string(action)}, args...)
|
args = append([]string{string(action)}, args...)
|
||||||
|
@ -241,7 +241,7 @@ func checkValidCreateVolumeRequest(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CreateVolume creates a reservation and the volume in backend, if it is not already present.
|
// CreateVolume creates a reservation and the volume in backend, if it is not already present.
|
||||||
// nolint:gocognit,gocyclo,nestif,cyclop // TODO: reduce complexity
|
//nolint:gocognit,gocyclo,nestif,cyclop // TODO: reduce complexity
|
||||||
func (cs *ControllerServer) CreateVolume(
|
func (cs *ControllerServer) CreateVolume(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
req *csi.CreateVolumeRequest,
|
req *csi.CreateVolumeRequest,
|
||||||
@ -730,7 +730,7 @@ func (cs *ControllerServer) ControllerExpandVolume(
|
|||||||
|
|
||||||
// CreateSnapshot creates the snapshot in backend and stores metadata
|
// CreateSnapshot creates the snapshot in backend and stores metadata
|
||||||
// in store
|
// in store
|
||||||
// nolint:gocognit,gocyclo,cyclop // golangci-lint did not catch this earlier, needs to get fixed late
|
//nolint:gocognit,gocyclo,cyclop // golangci-lint did not catch this earlier, needs to get fixed late
|
||||||
func (cs *ControllerServer) CreateSnapshot(
|
func (cs *ControllerServer) CreateSnapshot(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
req *csi.CreateSnapshotRequest,
|
req *csi.CreateSnapshotRequest,
|
||||||
@ -986,7 +986,7 @@ func (cs *ControllerServer) validateSnapshotReq(ctx context.Context, req *csi.Cr
|
|||||||
|
|
||||||
// DeleteSnapshot deletes the snapshot in backend and removes the
|
// DeleteSnapshot deletes the snapshot in backend and removes the
|
||||||
// snapshot metadata from store.
|
// snapshot metadata from store.
|
||||||
// nolint:gocyclo,cyclop // TODO: reduce complexity
|
//nolint:gocyclo,cyclop // TODO: reduce complexity
|
||||||
func (cs *ControllerServer) DeleteSnapshot(
|
func (cs *ControllerServer) DeleteSnapshot(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
req *csi.DeleteSnapshotRequest,
|
req *csi.DeleteSnapshotRequest,
|
||||||
|
@ -31,7 +31,7 @@ import (
|
|||||||
var (
|
var (
|
||||||
availableMounters []string
|
availableMounters []string
|
||||||
|
|
||||||
// nolint:gomnd // numbers specify Kernel versions.
|
//nolint:gomnd // numbers specify Kernel versions.
|
||||||
quotaSupport = []util.KernelVersion{
|
quotaSupport = []util.KernelVersion{
|
||||||
{
|
{
|
||||||
Version: 4,
|
Version: 4,
|
||||||
|
@ -71,7 +71,7 @@ because, the order of omap creation and deletion are inverse of each other, and
|
|||||||
request name lock, and hence any stale omaps are leftovers from incomplete transactions and are
|
request name lock, and hence any stale omaps are leftovers from incomplete transactions and are
|
||||||
hence safe to garbage collect.
|
hence safe to garbage collect.
|
||||||
*/
|
*/
|
||||||
// nolint:gocognit,gocyclo,nestif,cyclop // TODO: reduce complexity
|
//nolint:gocognit,gocyclo,nestif,cyclop // TODO: reduce complexity
|
||||||
func CheckVolExists(ctx context.Context,
|
func CheckVolExists(ctx context.Context,
|
||||||
volOptions,
|
volOptions,
|
||||||
parentVolOpt *VolumeOptions,
|
parentVolOpt *VolumeOptions,
|
||||||
|
@ -210,7 +210,7 @@ func fmtBackingSnapshotOptionMismatch(optName, expected, actual string) error {
|
|||||||
|
|
||||||
// NewVolumeOptions generates a new instance of volumeOptions from the provided
|
// NewVolumeOptions generates a new instance of volumeOptions from the provided
|
||||||
// CSI request parameters.
|
// CSI request parameters.
|
||||||
// nolint:gocyclo,cyclop // TODO: reduce complexity
|
//nolint:gocyclo,cyclop // TODO: reduce complexity
|
||||||
func NewVolumeOptions(
|
func NewVolumeOptions(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
requestName,
|
requestName,
|
||||||
@ -348,7 +348,7 @@ func IsVolumeCreateRO(caps []*csi.VolumeCapability) bool {
|
|||||||
|
|
||||||
// newVolumeOptionsFromVolID generates a new instance of volumeOptions and VolumeIdentifier
|
// newVolumeOptionsFromVolID generates a new instance of volumeOptions and VolumeIdentifier
|
||||||
// from the provided CSI VolumeID.
|
// from the provided CSI VolumeID.
|
||||||
// nolint:gocyclo,cyclop // TODO: reduce complexity
|
//nolint:gocyclo,cyclop // TODO: reduce complexity
|
||||||
func NewVolumeOptionsFromVolID(
|
func NewVolumeOptionsFromVolID(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
volID string,
|
volID string,
|
||||||
|
@ -82,7 +82,7 @@ func (d *CSIDriver) ValidateControllerServiceRequest(c csi.ControllerServiceCapa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return status.Error(codes.InvalidArgument, fmt.Sprintf("%s", c)) //nolint
|
return status.Error(codes.InvalidArgument, fmt.Sprintf("%s", c))
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddControllerServiceCapabilities stores the controller capabilities
|
// AddControllerServiceCapabilities stores the controller capabilities
|
||||||
|
@ -53,7 +53,7 @@ func TestGenerateNonce(t *testing.T) {
|
|||||||
|
|
||||||
func TestGenerateCipher(t *testing.T) {
|
func TestGenerateCipher(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
// nolint:gosec // this passphrase is intentionally hardcoded
|
//nolint:gosec // this passphrase is intentionally hardcoded
|
||||||
passphrase := "my-cool-luks-passphrase"
|
passphrase := "my-cool-luks-passphrase"
|
||||||
salt := "unique-id-for-the-volume"
|
salt := "unique-id-for-the-volume"
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ func setConfigString(option *string, config map[string]interface{}, key string)
|
|||||||
// these settings will be used when connecting to the Vault service with
|
// these settings will be used when connecting to the Vault service with
|
||||||
// vc.connectVault().
|
// vc.connectVault().
|
||||||
//
|
//
|
||||||
// nolint:gocyclo,cyclop // iterating through many config options, not complex at all.
|
//nolint:gocyclo,cyclop // iterating through many config options, not complex at all.
|
||||||
func (vc *vaultConnection) initConnection(config map[string]interface{}) error {
|
func (vc *vaultConnection) initConnection(config map[string]interface{}) error {
|
||||||
vaultConfig := make(map[string]interface{})
|
vaultConfig := make(map[string]interface{})
|
||||||
keyContext := make(map[string]string)
|
keyContext := make(map[string]string)
|
||||||
|
@ -353,7 +353,7 @@ func (kms *vaultTokensKMS) setTokenName(config map[string]interface{}) error {
|
|||||||
// initCertificates updates the kms.vaultConfig with the options from config
|
// initCertificates updates the kms.vaultConfig with the options from config
|
||||||
// it calls the kubernetes secrets and get the required data.
|
// it calls the kubernetes secrets and get the required data.
|
||||||
|
|
||||||
// nolint:gocyclo,cyclop // iterating through many config options, not complex at all.
|
//nolint:gocyclo,cyclop // iterating through many config options, not complex at all.
|
||||||
func (vtc *vaultTenantConnection) initCertificates(config map[string]interface{}) error {
|
func (vtc *vaultTenantConnection) initCertificates(config map[string]interface{}) error {
|
||||||
vaultConfig := make(map[string]interface{})
|
vaultConfig := make(map[string]interface{})
|
||||||
|
|
||||||
|
@ -1060,7 +1060,7 @@ func (cs *ControllerServer) ValidateVolumeCapabilities(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CreateSnapshot creates the snapshot in backend and stores metadata in store.
|
// CreateSnapshot creates the snapshot in backend and stores metadata in store.
|
||||||
// nolint:gocyclo,cyclop // TODO: reduce complexity.
|
//nolint:gocyclo,cyclop // TODO: reduce complexity.
|
||||||
func (cs *ControllerServer) CreateSnapshot(
|
func (cs *ControllerServer) CreateSnapshot(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
req *csi.CreateSnapshotRequest,
|
req *csi.CreateSnapshotRequest,
|
||||||
|
@ -78,7 +78,7 @@ var (
|
|||||||
kernelRelease = ""
|
kernelRelease = ""
|
||||||
// deepFlattenSupport holds the list of kernel which support mapping rbd
|
// deepFlattenSupport holds the list of kernel which support mapping rbd
|
||||||
// image with deep-flatten image feature
|
// image with deep-flatten image feature
|
||||||
// nolint:gomnd // numbers specify Kernel versions.
|
//nolint:gomnd // numbers specify Kernel versions.
|
||||||
deepFlattenSupport = []util.KernelVersion{
|
deepFlattenSupport = []util.KernelVersion{
|
||||||
{
|
{
|
||||||
Version: 5,
|
Version: 5,
|
||||||
@ -114,7 +114,7 @@ var (
|
|||||||
|
|
||||||
// parseBoolOption checks if parameters contain option and parse it. If it is
|
// parseBoolOption checks if parameters contain option and parse it. If it is
|
||||||
// empty or not set return default.
|
// empty or not set return default.
|
||||||
// nolint:unparam // currently defValue is always false, this can change in the future
|
//nolint:unparam // currently defValue is always false, this can change in the future
|
||||||
func parseBoolOption(ctx context.Context, parameters map[string]string, optionName string, defValue bool) bool {
|
func parseBoolOption(ctx context.Context, parameters map[string]string, optionName string, defValue bool) bool {
|
||||||
boolVal := defValue
|
boolVal := defValue
|
||||||
|
|
||||||
|
@ -538,7 +538,7 @@ func undoVolReservation(ctx context.Context, rbdVol *rbdVolume, cr *util.Credent
|
|||||||
// Generate new volume Handler
|
// Generate new volume Handler
|
||||||
// The volume handler won't remain same as its contains poolID,clusterID etc
|
// The volume handler won't remain same as its contains poolID,clusterID etc
|
||||||
// which are not same across clusters.
|
// which are not same across clusters.
|
||||||
// nolint:gocyclo,cyclop,nestif // TODO: reduce complexity
|
//nolint:gocyclo,cyclop,nestif // TODO: reduce complexity
|
||||||
func RegenerateJournal(
|
func RegenerateJournal(
|
||||||
volumeAttributes map[string]string,
|
volumeAttributes map[string]string,
|
||||||
claimName,
|
claimName,
|
||||||
|
@ -1161,7 +1161,7 @@ func generateVolumeFromVolumeID(
|
|||||||
// GenVolFromVolID generates a rbdVolume structure from the provided identifier, updating
|
// GenVolFromVolID generates a rbdVolume structure from the provided identifier, updating
|
||||||
// the structure with elements from on-disk image metadata as well.
|
// the structure with elements from on-disk image metadata as well.
|
||||||
//
|
//
|
||||||
// nolint // returns non-exported *rbdVolume, which is fine
|
|
||||||
func GenVolFromVolID(
|
func GenVolFromVolID(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
volumeID string,
|
volumeID string,
|
||||||
@ -1702,7 +1702,7 @@ func (ri *rbdImageMetadataStash) String() string {
|
|||||||
func stashRBDImageMetadata(volOptions *rbdVolume, metaDataPath string) error {
|
func stashRBDImageMetadata(volOptions *rbdVolume, metaDataPath string) error {
|
||||||
imgMeta := rbdImageMetadataStash{
|
imgMeta := rbdImageMetadataStash{
|
||||||
// there are no checks for this at present
|
// there are no checks for this at present
|
||||||
Version: 3, // nolint:gomnd // number specifies version.
|
Version: 3, //nolint:gomnd // number specifies version.
|
||||||
Pool: volOptions.Pool,
|
Pool: volOptions.Pool,
|
||||||
RadosNamespace: volOptions.RadosNamespace,
|
RadosNamespace: volOptions.RadosNamespace,
|
||||||
ImageName: volOptions.RbdImageName,
|
ImageName: volOptions.RbdImageName,
|
||||||
|
@ -73,7 +73,7 @@ func (cp *ConnPool) fakeGet(monitors, user, keyfile string) (*rados.Conn, string
|
|||||||
return conn, unique, nil
|
return conn, unique, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint:paralleltest // these tests cannot run in parallel
|
//nolint:paralleltest // these tests cannot run in parallel
|
||||||
func TestConnPool(t *testing.T) {
|
func TestConnPool(t *testing.T) {
|
||||||
cp := NewConnPool(interval, expiry)
|
cp := NewConnPool(interval, expiry)
|
||||||
defer cp.Destroy()
|
defer cp.Destroy()
|
||||||
|
@ -67,7 +67,7 @@ type ClusterInfo struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Expected JSON structure in the passed in config file is,
|
// Expected JSON structure in the passed in config file is,
|
||||||
// nolint:godot // example json content should not contain unwanted dot.
|
//nolint:godot // example json content should not contain unwanted dot.
|
||||||
/*
|
/*
|
||||||
[{
|
[{
|
||||||
"clusterID": "<cluster-id>",
|
"clusterID": "<cluster-id>",
|
||||||
|
@ -70,7 +70,7 @@ func TryRADOSAborted(opErr error) error {
|
|||||||
return opErr
|
return opErr
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint:errorlint // Can't use errors.As() because rados.radosError is private.
|
//nolint:errorlint // Can't use errors.As() because rados.radosError is private.
|
||||||
errnoErr, ok := radosOpErr.OpError.(interface{ ErrorCode() int })
|
errnoErr, ok := radosOpErr.OpError.(interface{ ErrorCode() int })
|
||||||
if !ok {
|
if !ok {
|
||||||
return opErr
|
return opErr
|
||||||
|
@ -54,7 +54,7 @@ func FromBytes(bs []byte) (RefType, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
num := RefType(bs[0])
|
num := RefType(bs[0])
|
||||||
switch num { // nolint:exhaustive // reftype.Unknown is handled in default case.
|
switch num { //nolint:exhaustive // reftype.Unknown is handled in default case.
|
||||||
case Normal, Mask:
|
case Normal, Mask:
|
||||||
return num, nil
|
return num, nil
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user