diff --git a/cmd/cephcsi.go b/cmd/cephcsi.go index 6bf476a79..d62c0ecc0 100644 --- a/cmd/cephcsi.go +++ b/cmd/cephcsi.go @@ -46,7 +46,7 @@ const ( pollTime = 60 // seconds probeTimeout = 3 // seconds - // use default namespace if namespace is not set + // use default namespace if namespace is not set. defaultNS = "default" ) diff --git a/e2e/ceph_user.go b/e2e/ceph_user.go index cecfef1bc..b9ab0f781 100644 --- a/e2e/ceph_user.go +++ b/e2e/ceph_user.go @@ -9,14 +9,14 @@ import ( // #nosec because of the word `Secret` const ( - // ceph user names + // ceph user names. keyringRBDProvisionerUsername = "cephcsi-rbd-provisioner" keyringRBDNodePluginUsername = "cephcsi-rbd-node" keyringRBDNamespaceProvisionerUsername = "cephcsi-rbd-ns-provisioner" keyringRBDNamespaceNodePluginUsername = "cephcsi-rbd-ns-node" keyringCephFSProvisionerUsername = "cephcsi-cephfs-provisioner" keyringCephFSNodePluginUsername = "cephcsi-cephfs-node" - // secret names + // secret names. rbdNodePluginSecretName = "cephcsi-rbd-node" rbdProvisionerSecretName = "cephcsi-rbd-provisioner" rbdNamespaceNodePluginSecretName = "cephcsi-rbd-ns-node" diff --git a/e2e/rbd.go b/e2e/rbd.go index 8148c8254..fd52b8ec5 100644 --- a/e2e/rbd.go +++ b/e2e/rbd.go @@ -30,7 +30,7 @@ var ( rbdDeploymentName = "csi-rbdplugin-provisioner" rbdDaemonsetName = "csi-rbdplugin" defaultRBDPool = "replicapool" - // Topology related variables + // Topology related variables. nodeRegionLabel = "test.failure-domain/region" regionValue = "testregion" nodeZoneLabel = "test.failure-domain/zone" @@ -40,7 +40,7 @@ var ( rbdTopologyPool = "newrbdpool" rbdTopologyDataPool = "replicapool" // NOTE: should be different than rbdTopologyPool for test to be effective - // yaml files required for deployment + // yaml files required for deployment. pvcPath = rbdExamplePath + "pvc.yaml" appPath = rbdExamplePath + "pod.yaml" rawPvcPath = rbdExamplePath + "raw-block-pvc.yaml" diff --git a/e2e/utils.go b/e2e/utils.go index 502952850..376a862bf 100644 --- a/e2e/utils.go +++ b/e2e/utils.go @@ -35,7 +35,7 @@ const ( retainPolicy = v1.PersistentVolumeReclaimRetain // deletePolicy is the default policy in E2E. deletePolicy = v1.PersistentVolumeReclaimDelete - // Default key and label for Listoptions + // Default key and label for Listoptions. appKey = "app" appLabel = "write-data-in-pod" @@ -43,7 +43,7 @@ const ( ) var ( - // cli flags + // cli flags. deployTimeout int deployCephFS bool deployRBD bool diff --git a/internal/cephfs/driver.go b/internal/cephfs/driver.go index 174f68cda..c8699bbc6 100644 --- a/internal/cephfs/driver.go +++ b/internal/cephfs/driver.go @@ -25,10 +25,10 @@ import ( ) const ( - // volIDVersion is the version number of volume ID encoding scheme + // volIDVersion is the version number of volume ID encoding scheme. volIDVersion uint16 = 1 - // RADOS namespace to store CSI specific objects and keys + // RADOS namespace to store CSI specific objects and keys. radosNamespace = "csi" ) @@ -43,15 +43,15 @@ type Driver struct { var ( // CSIInstanceID is the instance ID that is unique to an instance of CSI, used when sharing - // ceph clusters across CSI instances, to differentiate omap names per CSI instance + // ceph clusters across CSI instances, to differentiate omap names per CSI instance. CSIInstanceID = "default" // volJournal is used to maintain RADOS based journals for CO generated - // VolumeName to backing CephFS subvolumes + // VolumeName to backing CephFS subvolumes. volJournal *journal.Config // snapJournal is used to maintain RADOS based journals for CO generated - // SnapshotName to backing CephFS subvolumes + // SnapshotName to backing CephFS subvolumes. snapJournal *journal.Config ) diff --git a/internal/cephfs/errors.go b/internal/cephfs/errors.go index 2af5e46d4..2c617e43f 100644 --- a/internal/cephfs/errors.go +++ b/internal/cephfs/errors.go @@ -27,13 +27,13 @@ const ( ) var ( - // ErrCloneInProgress is returned when snapshot clone state is `in progress` + // ErrCloneInProgress is returned when snapshot clone state is `in progress`. ErrCloneInProgress = errors.New("clone from snapshot is already in progress") - // ErrClonePending is returned when snapshot clone state is `pending` + // ErrClonePending is returned when snapshot clone state is `pending`. ErrClonePending = errors.New("clone from snapshot is pending") - // ErrInvalidClone is returned when the clone state is invalid + // ErrInvalidClone is returned when the clone state is invalid. ErrInvalidClone = errors.New("invalid clone state") // ErrCloneFailed is returned when the clone state is failed. @@ -46,7 +46,7 @@ var ( // statically provisioned. ErrNonStaticVolume = errors.New("volume not static") - // ErrSnapProtectionExist is returned when the snapshot is already protected + // ErrSnapProtectionExist is returned when the snapshot is already protected. ErrSnapProtectionExist = errors.New("snapshot protection already exists") // ErrSnapNotFound is returned when snap name passed is not found in the list @@ -56,7 +56,7 @@ var ( // ErrVolumeNotFound is returned when a subvolume is not found in CephFS. ErrVolumeNotFound = errors.New("volume not found") - // ErrInvalidCommand is returned when a command is not known to the cluster + // ErrInvalidCommand is returned when a command is not known to the cluster. ErrInvalidCommand = errors.New("invalid command") // ErrVolumeHasSnapshots is returned when a subvolume has snapshots. diff --git a/internal/cephfs/volumemounter.go b/internal/cephfs/volumemounter.go index 20390fd90..2e0e53549 100644 --- a/internal/cephfs/volumemounter.go +++ b/internal/cephfs/volumemounter.go @@ -39,7 +39,7 @@ const ( var ( availableMounters []string - // maps a mountpoint to PID of its FUSE daemon + // maps a mountpoint to PID of its FUSE daemon. fusePidMap = make(map[string]int) fusePidMapMtx sync.Mutex diff --git a/internal/rbd/driver.go b/internal/rbd/driver.go index 3d1437a18..3de9fe55e 100644 --- a/internal/rbd/driver.go +++ b/internal/rbd/driver.go @@ -26,7 +26,7 @@ import ( ) const ( - // volIDVersion is the version number of volume ID encoding scheme + // volIDVersion is the version number of volume ID encoding scheme. volIDVersion uint16 = 1 ) @@ -43,19 +43,19 @@ type Driver struct { var ( // CSIInstanceID is the instance ID that is unique to an instance of CSI, used when sharing - // ceph clusters across CSI instances, to differentiate omap names per CSI instance + // ceph clusters across CSI instances, to differentiate omap names per CSI instance. CSIInstanceID = "default" // volJournal and snapJournal are used to maintain RADOS based journals for CO generated - // VolumeName to backing RBD images + // VolumeName to backing RBD images. volJournal *journal.Config snapJournal *journal.Config // rbdHardMaxCloneDepth is the hard limit for maximum number of nested volume clones that are taken before a flatten - // occurs + // occurs. rbdHardMaxCloneDepth uint // rbdSoftMaxCloneDepth is the soft limit for maximum number of nested volume clones that are taken before a flatten - // occurs + // occurs. rbdSoftMaxCloneDepth uint maxSnapshotsOnImage uint minSnapshotsOnImageToStartFlatten uint diff --git a/internal/rbd/encryption.go b/internal/rbd/encryption.go index 8047b4409..11289ce28 100644 --- a/internal/rbd/encryption.go +++ b/internal/rbd/encryption.go @@ -49,10 +49,10 @@ const ( // rbdImageRequiresEncryption has been deprecated, it is used only for // volumes that have been created with an old provisioner, were never // attached/mounted and now get staged by a new node-plugin - // TODO: remove this backwards compatibility support + // TODO: remove this backwards compatibility support. rbdImageRequiresEncryption = rbdEncryptionState("requiresEncryption") - // image metadata key for encryption + // image metadata key for encryption. encryptionMetaKey = ".rbd.csi.ceph.com/encrypted" // metadataDEK is the key in the image metadata where the (encrypted) diff --git a/internal/rbd/nodeserver.go b/internal/rbd/nodeserver.go index fefb99085..17121a479 100644 --- a/internal/rbd/nodeserver.go +++ b/internal/rbd/nodeserver.go @@ -61,7 +61,7 @@ type stageTransaction struct { } const ( - // values for xfsHasReflink + // values for xfsHasReflink. xfsReflinkUnset int = iota xfsReflinkNoSupport xfsReflinkSupport @@ -92,7 +92,7 @@ var ( } // xfsHasReflink is set by xfsSupportsReflink(), use the function when - // checking the support for reflink + // checking the support for reflink. xfsHasReflink = xfsReflinkUnset ) diff --git a/internal/rbd/rbd_attach.go b/internal/rbd/rbd_attach.go index 158a96d42..1e485208f 100644 --- a/internal/rbd/rbd_attach.go +++ b/internal/rbd/rbd_attach.go @@ -43,7 +43,7 @@ const ( // Output strings returned during invocation of "rbd unmap --device-type... " when // image is not found to be mapped. Used to ignore errors when attempting to unmap such images. // The %s format specifier should contain the string - // NOTE: When using devicePath instead of imageSpec, the error strings are different + // NOTE: When using devicePath instead of imageSpec, the error strings are different. rbdUnmapCmdkRbdMissingMap = "rbd: %s: not a mapped image or snapshot" rbdUnmapCmdNbdMissingMap = "rbd-nbd: %s is not mapped" rbdMapConnectionTimeout = "Connection timed out" diff --git a/internal/util/aws_metadata.go b/internal/util/aws_metadata.go index 4e8166a3d..3aadca739 100644 --- a/internal/util/aws_metadata.go +++ b/internal/util/aws_metadata.go @@ -51,9 +51,9 @@ const ( // // #nosec:G101, no hardcoded secrets, only configuration keys. awsAccessKey = "AWS_ACCESS_KEY_ID" - // #nosec:G101 + // #nosec:G101. awsSecretAccessKey = "AWS_SECRET_ACCESS_KEY" - // #nosec:G101 + // #nosec:G101. awsSessionToken = "AWS_SESSION_TOKEN" awsCMK = "AWS_CMK_ARN" ) diff --git a/internal/util/cephconf.go b/internal/util/cephconf.go index b33c828de..cea694c2f 100644 --- a/internal/util/cephconf.go +++ b/internal/util/cephconf.go @@ -37,7 +37,7 @@ fuse_big_writes = true const ( cephConfigRoot = "/etc/ceph" - // CephConfigPath ceph configuration file + // CephConfigPath ceph configuration file. CephConfigPath = "/etc/ceph/ceph.conf" keyRing = "/etc/ceph/keyring" diff --git a/internal/util/connection.go b/internal/util/connection.go index 6d17697d9..c5cca7357 100644 --- a/internal/util/connection.go +++ b/internal/util/connection.go @@ -40,7 +40,7 @@ type ClusterConnection struct { var ( // large interval and timeout, it should be longer than the maximum // time an operation can take (until refcounting of the connections is - // available) + // available). cpInterval = 15 * time.Minute cpExpiry = 10 * time.Minute connPool = NewConnPool(cpInterval, cpExpiry) diff --git a/internal/util/crypto.go b/internal/util/crypto.go index 83adc354d..f55e6aef4 100644 --- a/internal/util/crypto.go +++ b/internal/util/crypto.go @@ -31,7 +31,7 @@ const ( mapperFilePrefix = "luks-rbd-" mapperFilePathPrefix = "/dev/mapper" - // kmsConfigPath is the location of the vault config file + // kmsConfigPath is the location of the vault config file. kmsConfigPath = "/etc/ceph-csi-encryption-kms-config/config.json" // Passphrase size - 20 bytes is 160 bits to satisfy: diff --git a/internal/util/csiconfig.go b/internal/util/csiconfig.go index 10e05e6e1..51b1d397a 100644 --- a/internal/util/csiconfig.go +++ b/internal/util/csiconfig.go @@ -29,7 +29,7 @@ const ( // This was hardcoded once and defaults to the old value to keep backward compatibility. defaultCsiSubvolumeGroup = "csi" - // CsiConfigFile is the location of the CSI config file + // CsiConfigFile is the location of the CSI config file. CsiConfigFile = "/etc/ceph-csi-config/config.json" ) diff --git a/internal/util/idlocker.go b/internal/util/idlocker.go index adf8486cc..2f56ee529 100644 --- a/internal/util/idlocker.go +++ b/internal/util/idlocker.go @@ -21,10 +21,10 @@ import ( ) const ( - // VolumeOperationAlreadyExistsFmt string format to return for concurrent operation + // VolumeOperationAlreadyExistsFmt string format to return for concurrent operation. VolumeOperationAlreadyExistsFmt = "an operation with the given Volume ID %s already exists" - // SnapshotOperationAlreadyExistsFmt string format to return for concurrent operation + // SnapshotOperationAlreadyExistsFmt string format to return for concurrent operation. SnapshotOperationAlreadyExistsFmt = "an operation with the given Snapshot ID %s already exists" ) diff --git a/internal/util/kms.go b/internal/util/kms.go index 660ccac88..ba7dc07a1 100644 --- a/internal/util/kms.go +++ b/internal/util/kms.go @@ -35,14 +35,14 @@ const ( // options. kmsTypeKey = "encryptionKMSType" - // podNamespaceEnv ENV should be set in the cephcsi container + // podNamespaceEnv ENV should be set in the cephcsi container. podNamespaceEnv = "POD_NAMESPACE" - // kmsConfigMapEnv env to read a ConfigMap by name + // kmsConfigMapEnv env to read a ConfigMap by name. kmsConfigMapEnv = "KMS_CONFIGMAP_NAME" // defaultKMSConfigMapName default ConfigMap name to fetch kms - // connection details + // connection details. defaultKMSConfigMapName = "csi-kms-connection-details" ) diff --git a/internal/util/secretskms.go b/internal/util/secretskms.go index b6b8fd18e..7d05c3c26 100644 --- a/internal/util/secretskms.go +++ b/internal/util/secretskms.go @@ -31,10 +31,10 @@ import ( ) const ( - // Encryption passphrase location in K8s secrets + // Encryption passphrase location in K8s secrets. encryptionPassphraseKey = "encryptionPassphrase" - // Default KMS type + // Default KMS type. defaultKMSType = "default" // kmsTypeSecretsMetadata is the SecretsKMS with per-volume encryption, diff --git a/internal/util/util.go b/internal/util/util.go index 8e0ffda07..3d8ac7b6e 100644 --- a/internal/util/util.go +++ b/internal/util/util.go @@ -57,9 +57,9 @@ func RoundOffBytes(bytes int64) int64 { // variables which will be set during the build time. var ( - // GitCommit tell the latest git commit image is built from + // GitCommit tell the latest git commit image is built from. GitCommit string - // DriverVersion which will be driver version + // DriverVersion which will be driver version. DriverVersion string ) diff --git a/internal/util/vault.go b/internal/util/vault.go index fc66c3986..f7d0b5336 100644 --- a/internal/util/vault.go +++ b/internal/util/vault.go @@ -37,7 +37,7 @@ const ( // #nosec serviceAccountTokenPath = "/var/run/secrets/kubernetes.io/serviceaccount/token" - // vault configuration defaults + // vault configuration defaults. vaultDefaultAuthPath = "/v1/auth/kubernetes/login" vaultDefaultRole = "csi-kubernetes" vaultDefaultNamespace = ""