cleanup: address godot warnings

Top level comments should end in a period

Signed-off-by: Yug <yuggupta27@gmail.com>
This commit is contained in:
Yug
2020-07-19 17:51:03 +05:30
committed by mergify[bot]
parent cb7ab307dd
commit 7f94a57908
48 changed files with 233 additions and 233 deletions

View File

@ -27,10 +27,10 @@ import (
klog "k8s.io/klog/v2"
)
// InvalidPoolID used to denote an invalid pool
// InvalidPoolID used to denote an invalid pool.
const InvalidPoolID int64 = -1
// ExecCommand executes passed in program with args and returns separate stdout and stderr streams
// ExecCommand executes passed in program with args and returns separate stdout and stderr streams.
func ExecCommand(program string, args ...string) (stdout, stderr []byte, err error) {
var (
cmd = exec.Command(program, args...) // nolint: gosec, #nosec
@ -51,7 +51,7 @@ func ExecCommand(program string, args ...string) (stdout, stderr []byte, err err
}
// GetPoolID fetches the ID of the pool that matches the passed in poolName
// parameter
// parameter.
func GetPoolID(monitors string, cr *Credentials, poolName string) (int64, error) {
conn, err := connPool.Get(monitors, cr.ID, cr.KeyFile)
if err != nil {
@ -70,7 +70,7 @@ func GetPoolID(monitors string, cr *Credentials, poolName string) (int64, error)
}
// GetPoolName fetches the pool whose pool ID is equal to the requested poolID
// parameter
// parameter.
func GetPoolName(monitors string, cr *Credentials, poolID int64) (string, error) {
conn, err := connPool.Get(monitors, cr.ID, cr.KeyFile)
if err != nil {
@ -87,7 +87,7 @@ func GetPoolName(monitors string, cr *Credentials, poolID int64) (string, error)
// GetPoolIDs searches a list of pools in a cluster and returns the IDs of the pools that matches
// the passed in pools
// TODO this should take in a list and return a map[string(poolname)]int64(poolID)
// TODO this should take in a list and return a map[string(poolname)]int64(poolID).
func GetPoolIDs(ctx context.Context, monitors, journalPool, imagePool string, cr *Credentials) (int64, int64, error) {
journalPoolID, err := GetPoolID(monitors, cr, journalPool)
if err != nil {
@ -106,7 +106,7 @@ func GetPoolIDs(ctx context.Context, monitors, journalPool, imagePool string, cr
}
// CreateObject creates the object name passed in and returns ErrObjectExists if the provided object
// is already present in rados
// is already present in rados.
func CreateObject(ctx context.Context, monitors string, cr *Credentials, poolName, namespace, objectName string) error {
conn := ClusterConnection{}
err := conn.Connect(monitors, cr)
@ -141,7 +141,7 @@ func CreateObject(ctx context.Context, monitors string, cr *Credentials, poolNam
}
// RemoveObject removes the entire omap name passed in and returns ErrObjectNotFound is provided omap
// is not found in rados
// is not found in rados.
func RemoveObject(ctx context.Context, monitors string, cr *Credentials, poolName, namespace, oMapName string) error {
conn := ClusterConnection{}
err := conn.Connect(monitors, cr)

View File

@ -43,7 +43,7 @@ func createCephConfigRoot() error {
}
// WriteCephConfig writes out a basic ceph.conf file, making it easy to use
// ceph related CLIs
// ceph related CLIs.
func WriteCephConfig() error {
if err := createCephConfigRoot(); err != nil {
return err
@ -64,7 +64,7 @@ if any ceph commands fails it will log below error message
/etc/ceph/ceph.client.admin.keyring,/etc/ceph/ceph.keyring,/etc/ceph/keyring,
/etc/ceph/keyring.bin,: (2) No such file or directory
*/
// createKeyRingFile creates the keyring files to fix above error message logging
// createKeyRingFile creates the keyring files to fix above error message logging.
func createKeyRingFile() error {
_, err := os.Create(keyRing)
return err

View File

@ -106,7 +106,7 @@ func (cp *ConnPool) generateUniqueKey(monitors, user, keyfile string) (string, e
// getExisting returns the existing rados.Conn associated with the unique key.
//
// Requires: locked cp.lock because of ce.get()
// Requires: locked cp.lock because of ce.get().
func (cp *ConnPool) getConn(unique string) *rados.Conn {
ce, exists := cp.conns[unique]
if exists {

View File

@ -33,7 +33,7 @@ const (
// fakeGet is used as a replacement for ConnPool.Get and does not need a
// working Ceph cluster to connect to.
//
// This is mostly a copy of ConnPool.Get()
// This is mostly a copy of ConnPool.Get().
func (cp *ConnPool) fakeGet(monitors, user, keyfile string) (*rados.Conn, string, error) {
unique, err := cp.generateUniqueKey(monitors, user, keyfile)
if err != nil {

View File

@ -51,7 +51,7 @@ const (
)
// EncryptionKMS provides external Key Management System for encryption
// passphrases storage
// passphrases storage.
type EncryptionKMS interface {
GetPassphrase(key string) (string, error)
SavePassphrase(key, value string) error
@ -59,12 +59,12 @@ type EncryptionKMS interface {
GetID() string
}
// MissingPassphrase is an error instructing to generate new passphrase
// MissingPassphrase is an error instructing to generate new passphrase.
type MissingPassphrase struct {
error
}
// SecretsKMS is default KMS implementation that means no KMS is in use
// SecretsKMS is default KMS implementation that means no KMS is in use.
type SecretsKMS struct {
passphrase string
}
@ -77,28 +77,28 @@ func initSecretsKMS(secrets map[string]string) (EncryptionKMS, error) {
return SecretsKMS{passphrase: passphraseValue}, nil
}
// GetPassphrase returns passphrase from Kubernetes secrets
// GetPassphrase returns passphrase from Kubernetes secrets.
func (kms SecretsKMS) GetPassphrase(key string) (string, error) {
return kms.passphrase, nil
}
// SavePassphrase is not implemented
// SavePassphrase is not implemented.
func (kms SecretsKMS) SavePassphrase(key, value string) error {
return fmt.Errorf("save new passphrase is not implemented for Kubernetes secrets")
}
// DeletePassphrase is doing nothing as no new passphrases are saved with
// SecretsKMS
// SecretsKMS.
func (kms SecretsKMS) DeletePassphrase(key string) error {
return nil
}
// GetID is returning ID representing default KMS `default`
// GetID is returning ID representing default KMS `default`.
func (kms SecretsKMS) GetID() string {
return defaultKMSType
}
// GetKMS returns an instance of Key Management System
// GetKMS returns an instance of Key Management System.
func GetKMS(kmsID string, secrets map[string]string) (EncryptionKMS, error) {
if kmsID == "" || kmsID == defaultKMSType {
return initSecretsKMS(secrets)
@ -141,7 +141,7 @@ func GetKMS(kmsID string, secrets map[string]string) (EncryptionKMS, error) {
return nil, fmt.Errorf("unknown encryption KMS type %s", kmsType)
}
// GetCryptoPassphrase Retrieves passphrase to encrypt volume
// GetCryptoPassphrase Retrieves passphrase to encrypt volume.
func GetCryptoPassphrase(ctx context.Context, volumeID string, kms EncryptionKMS) (string, error) {
passphrase, err := kms.GetPassphrase(volumeID)
if err == nil {
@ -164,7 +164,7 @@ func GetCryptoPassphrase(ctx context.Context, volumeID string, kms EncryptionKMS
return "", err
}
// generateNewEncryptionPassphrase generates a random passphrase for encryption
// generateNewEncryptionPassphrase generates a random passphrase for encryption.
func generateNewEncryptionPassphrase() (string, error) {
bytesPassphrase := make([]byte, encryptionPassphraseSize)
_, err := rand.Read(bytesPassphrase)
@ -174,14 +174,14 @@ func generateNewEncryptionPassphrase() (string, error) {
return base64.URLEncoding.EncodeToString(bytesPassphrase), nil
}
// VolumeMapper returns file name and it's path to where encrypted device should be open
// VolumeMapper returns file name and it's path to where encrypted device should be open.
func VolumeMapper(volumeID string) (mapperFile, mapperFilePath string) {
mapperFile = mapperFilePrefix + volumeID
mapperFilePath = path.Join(mapperFilePathPrefix, mapperFile)
return mapperFile, mapperFilePath
}
// EncryptVolume encrypts provided device with LUKS
// EncryptVolume encrypts provided device with LUKS.
func EncryptVolume(ctx context.Context, devicePath, passphrase string) error {
DebugLog(ctx, "Encrypting device %s with LUKS", devicePath)
if _, _, err := LuksFormat(devicePath, passphrase); err != nil {
@ -190,21 +190,21 @@ func EncryptVolume(ctx context.Context, devicePath, passphrase string) error {
return nil
}
// OpenEncryptedVolume opens volume so that it can be used by the client
// OpenEncryptedVolume opens volume so that it can be used by the client.
func OpenEncryptedVolume(ctx context.Context, devicePath, mapperFile, passphrase string) error {
DebugLog(ctx, "Opening device %s with LUKS on %s", devicePath, mapperFile)
_, _, err := LuksOpen(devicePath, mapperFile, passphrase)
return err
}
// CloseEncryptedVolume closes encrypted volume so it can be detached
// CloseEncryptedVolume closes encrypted volume so it can be detached.
func CloseEncryptedVolume(ctx context.Context, mapperFile string) error {
DebugLog(ctx, "Closing LUKS device %s", mapperFile)
_, _, err := LuksClose(mapperFile)
return err
}
// IsDeviceOpen determines if encrypted device is already open
// IsDeviceOpen determines if encrypted device is already open.
func IsDeviceOpen(ctx context.Context, device string) (bool, error) {
_, mappedFile, err := DeviceEncryptionStatus(ctx, device)
return (mappedFile != ""), err

View File

@ -23,22 +23,22 @@ import (
"strings"
)
// LuksFormat sets up volume as an encrypted LUKS partition
// LuksFormat sets up volume as an encrypted LUKS partition.
func LuksFormat(devicePath, passphrase string) (stdout, stderr []byte, err error) {
return execCryptsetupCommand(&passphrase, "-q", "luksFormat", "--hash", "sha256", devicePath, "-d", "/dev/stdin")
}
// LuksOpen opens LUKS encrypted partition and sets up a mapping
// LuksOpen opens LUKS encrypted partition and sets up a mapping.
func LuksOpen(devicePath, mapperFile, passphrase string) (stdout, stderr []byte, err error) {
return execCryptsetupCommand(&passphrase, "luksOpen", devicePath, mapperFile, "-d", "/dev/stdin")
}
// LuksClose removes existing mapping
// LuksClose removes existing mapping.
func LuksClose(mapperFile string) (stdout, stderr []byte, err error) {
return execCryptsetupCommand(nil, "luksClose", mapperFile)
}
// LuksStatus returns encryption status of a provided device
// LuksStatus returns encryption status of a provided device.
func LuksStatus(mapperFile string) (stdout, stderr []byte, err error) {
return execCryptsetupCommand(nil, "status", mapperFile)
}

View File

@ -29,7 +29,7 @@ const (
defaultCsiSubvolumeGroup = "csi"
)
// ClusterInfo strongly typed JSON spec for the below JSON structure
// ClusterInfo strongly typed JSON spec for the below JSON structure.
type ClusterInfo struct {
// ClusterID is used for unique identification
ClusterID string `json:"clusterID"`
@ -57,7 +57,7 @@ type ClusterInfo struct {
// }
// },
// ...
// ]
// ].
func readClusterInfo(pathToConfig, clusterID string) (*ClusterInfo, error) {
var config []ClusterInfo
@ -83,7 +83,7 @@ func readClusterInfo(pathToConfig, clusterID string) (*ClusterInfo, error) {
return nil, fmt.Errorf("missing configuration for cluster ID (%s)", clusterID)
}
// Mons returns a comma separated MON list from the csi config for the given clusterID
// Mons returns a comma separated MON list from the csi config for the given clusterID.
func Mons(pathToConfig, clusterID string) (string, error) {
cluster, err := readClusterInfo(pathToConfig, clusterID)
if err != nil {
@ -96,7 +96,7 @@ func Mons(pathToConfig, clusterID string) (string, error) {
return strings.Join(cluster.Monitors, ","), nil
}
// CephFSSubvolumeGroup returns the subvolumeGroup for CephFS volumes. If not set, it returns the default value "csi"
// CephFSSubvolumeGroup returns the subvolumeGroup for CephFS volumes. If not set, it returns the default value "csi".
func CephFSSubvolumeGroup(pathToConfig, clusterID string) (string, error) {
cluster, err := readClusterInfo(pathToConfig, clusterID)
if err != nil {

View File

@ -16,7 +16,7 @@ limitations under the License.
package util
// ErrKeyNotFound is returned when requested key in omap is not found
// ErrKeyNotFound is returned when requested key in omap is not found.
type ErrKeyNotFound struct {
keyName string
err error
@ -37,7 +37,7 @@ func (e ErrKeyNotFound) Unwrap() error {
return e.err
}
// ErrObjectExists is returned when named omap is already present in rados
// ErrObjectExists is returned when named omap is already present in rados.
type ErrObjectExists struct {
objectName string
err error
@ -53,7 +53,7 @@ func (e ErrObjectExists) Unwrap() error {
return e.err
}
// ErrObjectNotFound is returned when named omap is not found in rados
// ErrObjectNotFound is returned when named omap is not found in rados.
type ErrObjectNotFound struct {
oMapName string
err error
@ -70,7 +70,7 @@ func (e ErrObjectNotFound) Unwrap() error {
}
// ErrSnapNameConflict is generated when a requested CSI snap name already exists on RBD but with
// different properties, and hence is in conflict with the passed in CSI volume name
// different properties, and hence is in conflict with the passed in CSI volume name.
type ErrSnapNameConflict struct {
requestName string
err error
@ -91,7 +91,7 @@ func NewErrSnapNameConflict(name string, err error) ErrSnapNameConflict {
return ErrSnapNameConflict{name, err}
}
// ErrPoolNotFound is returned when pool is not found
// ErrPoolNotFound is returned when pool is not found.
type ErrPoolNotFound struct {
Pool string
Err error

View File

@ -10,13 +10,13 @@ import (
klog "k8s.io/klog/v2"
)
// ValidateURL validates the url
// ValidateURL validates the url.
func ValidateURL(c *Config) error {
_, err := url.Parse(c.MetricsPath)
return err
}
// StartMetricsServer starts http server
// StartMetricsServer starts http server.
func StartMetricsServer(c *Config) {
addr := net.JoinHostPort(c.MetricsIP, strconv.Itoa(c.MetricsPort))
http.Handle(c.MetricsPath, promhttp.Handler())

View File

@ -20,7 +20,7 @@ import (
"testing"
)
// very basic tests for the moment
// very basic tests for the moment.
func TestIDLocker(t *testing.T) {
fakeID := "fake-id"
locks := NewVolumeLocks()

View File

@ -25,7 +25,7 @@ import (
klog "k8s.io/klog/v2"
)
// NewK8sClient create kubernetes client
// NewK8sClient create kubernetes client.
func NewK8sClient() *k8s.Clientset {
var cfg *rest.Config
var err error

View File

@ -20,13 +20,13 @@ import (
type contextKey string
// CtxKey for context based logging
// CtxKey for context based logging.
var CtxKey = contextKey("ID")
// ReqID for logging request ID
// ReqID for logging request ID.
var ReqID = contextKey("Req-ID")
// Log helps in context based logging
// Log helps in context based logging.
func Log(ctx context.Context, format string) string {
id := ctx.Value(CtxKey)
if id == nil {

View File

@ -35,7 +35,7 @@ const (
// find the line containing the pids group from the /proc/self/cgroup file
// $ grep 'pids' /proc/self/cgroup
// 7:pids:/kubepods.slice/kubepods-besteffort.slice/....scope
// $ cat /sys/fs/cgroup/pids + *.scope + /pids.max
// $ cat /sys/fs/cgroup/pids + *.scope + /pids.max.
func getCgroupPidsFile() (string, error) {
cgroup, err := os.Open(procCgroup)
if err != nil {

View File

@ -22,7 +22,7 @@ import (
)
// minimal test to check if GetPIDLimit() returns an int
// changing the limit require root permissions, not tested
// changing the limit require root permissions, not tested.
func TestGetPIDLimit(t *testing.T) {
runTest := os.Getenv("CEPH_CSI_RUN_ALL_TESTS")
if runTest == "" {

View File

@ -44,7 +44,7 @@ func k8sGetNodeLabels(nodeName string) (map[string]string, error) {
// GetTopologyFromDomainLabels returns the CSI topology map, determined from
// the domain labels and their values from the CO system
// Expects domainLabels in arg to be in the format "[prefix/]<name>,[prefix/]<name>,...",
// Expects domainLabels in arg to be in the format "[prefix/]<name>,[prefix/]<name>,...",.
func GetTopologyFromDomainLabels(domainLabels, nodeName, driverName string) (map[string]string, error) {
if domainLabels == "" {
return nil, nil
@ -122,7 +122,7 @@ type topologySegment struct {
DomainValue string `json:"value"`
}
// TopologyConstrainedPool stores the pool name and a list of its associated topology domain values
// TopologyConstrainedPool stores the pool name and a list of its associated topology domain values.
type TopologyConstrainedPool struct {
PoolName string `json:"poolName"`
DataPoolName string `json:"dataPool"`
@ -130,7 +130,7 @@ type TopologyConstrainedPool struct {
}
// GetTopologyFromRequest extracts TopologyConstrainedPools and passed in accessibility constraints
// from a CSI CreateVolume request
// from a CSI CreateVolume request.
func GetTopologyFromRequest(req *csi.CreateVolumeRequest) (*[]TopologyConstrainedPool, *csi.TopologyRequirement, error) {
var (
topologyPools []TopologyConstrainedPool
@ -158,7 +158,7 @@ func GetTopologyFromRequest(req *csi.CreateVolumeRequest) (*[]TopologyConstraine
}
// MatchTopologyForPool returns the topology map, if the passed in pool matches any
// passed in accessibility constraints
// passed in accessibility constraints.
func MatchTopologyForPool(topologyPools *[]TopologyConstrainedPool,
accessibilityRequirements *csi.TopologyRequirement, poolName string) (map[string]string, error) {
var topologyPool []TopologyConstrainedPool
@ -187,7 +187,7 @@ func MatchTopologyForPool(topologyPools *[]TopologyConstrainedPool,
// FindPoolAndTopology loops through passed in "topologyPools" and also related
// accessibility requirements, to determine which pool matches the requirement.
// The return variables are, image poolname, data poolname, and topology map of
// matched requirement
// matched requirement.
func FindPoolAndTopology(topologyPools *[]TopologyConstrainedPool,
accessibilityRequirements *csi.TopologyRequirement) (string, string, map[string]string, error) {
if topologyPools == nil || accessibilityRequirements == nil {
@ -217,7 +217,7 @@ func FindPoolAndTopology(topologyPools *[]TopologyConstrainedPool,
// matchPoolToTopology loops through passed in pools, and for each pool checks if all
// requested topology segments are present and match the request, returning the first pool
// that hence matches (or an empty string if none match)
// that hence matches (or an empty string if none match).
func matchPoolToTopology(topologyPools *[]TopologyConstrainedPool, topology *csi.Topology) TopologyConstrainedPool {
domainMap := extractDomainsFromlabels(topology)
@ -243,7 +243,7 @@ func matchPoolToTopology(topologyPools *[]TopologyConstrainedPool, topology *csi
}
// extractDomainsFromlabels returns the domain name map, from passed in domain segments,
// which is of the form [prefix/]<name>
// which is of the form [prefix/]<name>.
func extractDomainsFromlabels(topology *csi.Topology) map[string]string {
domainMap := make(map[string]string)
for domainKey, value := range topology.GetSegments() {

View File

@ -35,7 +35,7 @@ func checkAndReportError(t *testing.T, msg string, err error) {
}
}
// TestFindPoolAndTopology also tests MatchTopologyForPool
// TestFindPoolAndTopology also tests MatchTopologyForPool.
func TestFindPoolAndTopology(t *testing.T) {
var err error
var label1 = "region"

View File

@ -44,7 +44,7 @@ const (
Trace
)
// RoundOffVolSize rounds up given quantity upto chunks of MiB/GiB
// RoundOffVolSize rounds up given quantity upto chunks of MiB/GiB.
func RoundOffVolSize(size int64) int64 {
size = RoundOffBytes(size)
// convert size back to MiB for rbd CLI
@ -53,7 +53,7 @@ func RoundOffVolSize(size int64) int64 {
// RoundOffBytes converts roundoff the size
// 1.1Mib will be round off to 2Mib same for GiB
// size less than 1MiB will be round off to 1MiB
// size less than 1MiB will be round off to 1MiB.
func RoundOffBytes(bytes int64) int64 {
var num int64
floatBytes := float64(bytes)
@ -68,7 +68,7 @@ func RoundOffBytes(bytes int64) int64 {
return num
}
// variables which will be set during the build time
// variables which will be set during the build time.
var (
// GitCommit tell the latest git commit image is built from
GitCommit string
@ -76,7 +76,7 @@ var (
DriverVersion string
)
// Config holds the parameters list which can be configured
// Config holds the parameters list which can be configured.
type Config struct {
Vtype string // driver type [rbd|cephfs|liveness]
Endpoint string // CSI endpoint
@ -119,7 +119,7 @@ type Config struct {
MaxSnapshotsOnImage uint
}
// ValidateDriverName validates the driver name
// ValidateDriverName validates the driver name.
func ValidateDriverName(driverName string) error {
if driverName == "" {
return errors.New("driver name is empty")
@ -150,7 +150,7 @@ func GetKernelVersion() (string, error) {
return strings.TrimRight(string(utsname.Release[:]), "\x00"), nil
}
// KernelVersion holds kernel related informations
// KernelVersion holds kernel related informations.
type KernelVersion struct {
Version int
PatchLevel int
@ -235,7 +235,7 @@ func CheckKernelSupport(release string, supportedVersions []KernelVersion) bool
}
// GenerateVolID generates a volume ID based on passed in parameters and version, to be returned
// to the CO system
// to the CO system.
func GenerateVolID(ctx context.Context, monitors string, cr *Credentials, locationID int64, pool, clusterID, objUUID string, volIDVersion uint16) (string, error) {
var err error
@ -259,12 +259,12 @@ func GenerateVolID(ctx context.Context, monitors string, cr *Credentials, locati
return volID, err
}
// CreateMountPoint creates the directory with given path
// CreateMountPoint creates the directory with given path.
func CreateMountPoint(mountPath string) error {
return os.MkdirAll(mountPath, 0750)
}
// checkDirExists checks directory exists or not
// checkDirExists checks directory exists or not.
func checkDirExists(p string) bool {
if _, err := os.Stat(p); os.IsNotExist(err) {
return false
@ -272,7 +272,7 @@ func checkDirExists(p string) bool {
return true
}
// IsMountPoint checks if the given path is mountpoint or not
// IsMountPoint checks if the given path is mountpoint or not.
func IsMountPoint(p string) (bool, error) {
dummyMount := mount.New("")
notMnt, err := dummyMount.IsLikelyNotMountPoint(p)
@ -283,7 +283,7 @@ func IsMountPoint(p string) (bool, error) {
return !notMnt, nil
}
// Mount mounts the source to target path
// Mount mounts the source to target path.
func Mount(source, target, fstype string, options []string) error {
dummyMount := mount.New("")
return dummyMount.Mount(source, target, fstype, options)
@ -321,7 +321,7 @@ func contains(s []string, key string) bool {
return false
}
// DefaultLog helps in logging with klog.level 1
// DefaultLog helps in logging with klog.level 1.
func DefaultLog(message string, args ...interface{}) {
logMessage := fmt.Sprintf(message, args...)
// If logging is disabled, don't evaluate the arguments
@ -330,7 +330,7 @@ func DefaultLog(message string, args ...interface{}) {
}
}
// UsefulLog helps in logging with klog.level 2
// UsefulLog helps in logging with klog.level 2.
func UsefulLog(ctx context.Context, message string, args ...interface{}) {
logMessage := fmt.Sprintf(Log(ctx, message), args...)
// If logging is disabled, don't evaluate the arguments
@ -339,7 +339,7 @@ func UsefulLog(ctx context.Context, message string, args ...interface{}) {
}
}
// ExtendedLogMsg helps in logging a message with klog.level 3
// ExtendedLogMsg helps in logging a message with klog.level 3.
func ExtendedLogMsg(message string, args ...interface{}) {
logMessage := fmt.Sprintf(message, args...)
// If logging is disabled, don't evaluate the arguments
@ -348,7 +348,7 @@ func ExtendedLogMsg(message string, args ...interface{}) {
}
}
// ExtendedLog helps in logging with klog.level 3
// ExtendedLog helps in logging with klog.level 3.
func ExtendedLog(ctx context.Context, message string, args ...interface{}) {
logMessage := fmt.Sprintf(Log(ctx, message), args...)
// If logging is disabled, don't evaluate the arguments
@ -357,7 +357,7 @@ func ExtendedLog(ctx context.Context, message string, args ...interface{}) {
}
}
// DebugLogMsg helps in logging a message with klog.level 4
// DebugLogMsg helps in logging a message with klog.level 4.
func DebugLogMsg(message string, args ...interface{}) {
logMessage := fmt.Sprintf(message, args...)
// If logging is disabled, don't evaluate the arguments
@ -366,7 +366,7 @@ func DebugLogMsg(message string, args ...interface{}) {
}
}
// DebugLog helps in logging with klog.level 4
// DebugLog helps in logging with klog.level 4.
func DebugLog(ctx context.Context, message string, args ...interface{}) {
logMessage := fmt.Sprintf(Log(ctx, message), args...)
// If logging is disabled, don't evaluate the arguments
@ -375,7 +375,7 @@ func DebugLog(ctx context.Context, message string, args ...interface{}) {
}
}
// TraceLogMsg helps in logging a message with klog.level 5
// TraceLogMsg helps in logging a message with klog.level 5.
func TraceLogMsg(message string, args ...interface{}) {
logMessage := fmt.Sprintf(message, args...)
// If logging is disabled, don't evaluate the arguments
@ -384,7 +384,7 @@ func TraceLogMsg(message string, args ...interface{}) {
}
}
// TraceLog helps in logging with klog.level 5
// TraceLog helps in logging with klog.level 5.
func TraceLog(ctx context.Context, message string, args ...interface{}) {
logMessage := fmt.Sprintf(Log(ctx, message), args...)
// If logging is disabled, don't evaluate the arguments

View File

@ -6,7 +6,7 @@ import (
"google.golang.org/grpc/status"
)
// ValidateNodeStageVolumeRequest validates the node stage request
// ValidateNodeStageVolumeRequest validates the node stage request.
func ValidateNodeStageVolumeRequest(req *csi.NodeStageVolumeRequest) error {
if req.GetVolumeCapability() == nil {
return status.Error(codes.InvalidArgument, "volume capability missing in request")
@ -32,7 +32,7 @@ func ValidateNodeStageVolumeRequest(req *csi.NodeStageVolumeRequest) error {
return nil
}
// ValidateNodeUnstageVolumeRequest validates the node unstage request
// ValidateNodeUnstageVolumeRequest validates the node unstage request.
func ValidateNodeUnstageVolumeRequest(req *csi.NodeUnstageVolumeRequest) error {
if req.GetVolumeId() == "" {
return status.Error(codes.InvalidArgument, "volume ID missing in request")
@ -45,7 +45,7 @@ func ValidateNodeUnstageVolumeRequest(req *csi.NodeUnstageVolumeRequest) error {
return nil
}
// ValidateNodePublishVolumeRequest validates the node publish request
// ValidateNodePublishVolumeRequest validates the node publish request.
func ValidateNodePublishVolumeRequest(req *csi.NodePublishVolumeRequest) error {
if req.GetVolumeCapability() == nil {
return status.Error(codes.InvalidArgument, "volume capability missing in request")
@ -66,7 +66,7 @@ func ValidateNodePublishVolumeRequest(req *csi.NodePublishVolumeRequest) error {
return nil
}
// ValidateNodeUnpublishVolumeRequest validates the node unpublish request
// ValidateNodeUnpublishVolumeRequest validates the node unpublish request.
func ValidateNodeUnpublishVolumeRequest(req *csi.NodeUnpublishVolumeRequest) error {
if req.GetVolumeId() == "" {
return status.Error(codes.InvalidArgument, "volume ID missing in request")

View File

@ -62,7 +62,7 @@ Example JSON structure in the KMS config is,
"vaultCAFromSecret": "vault-ca"
},
...
}
}.
*/
type VaultKMS struct {
EncryptionKMSID string
@ -76,7 +76,7 @@ type VaultKMS struct {
vaultCA *x509.CertPool
}
// InitVaultKMS returns an interface to HashiCorp Vault KMS
// InitVaultKMS returns an interface to HashiCorp Vault KMS.
func InitVaultKMS(kmsID string, config, secrets map[string]string) (EncryptionKMS, error) {
var (
ok bool
@ -136,12 +136,12 @@ func InitVaultKMS(kmsID string, config, secrets map[string]string) (EncryptionKM
return kms, nil
}
// GetID is returning correlation ID to KMS configuration
// GetID is returning correlation ID to KMS configuration.
func (kms *VaultKMS) GetID() string {
return kms.EncryptionKMSID
}
// GetPassphrase returns passphrase from Vault
// GetPassphrase returns passphrase from Vault.
func (kms *VaultKMS) GetPassphrase(key string) (string, error) {
var passphrase string
resp, err := kms.request("GET", kms.getKeyDataURI(key), nil)
@ -182,7 +182,7 @@ func (kms *VaultKMS) GetPassphrase(key string) (string, error) {
return passphrase, nil
}
// SavePassphrase saves new passphrase in Vault
// SavePassphrase saves new passphrase in Vault.
func (kms *VaultKMS) SavePassphrase(key, value string) error {
data, err := json.Marshal(map[string]map[string]string{
"data": {
@ -206,7 +206,7 @@ func (kms *VaultKMS) SavePassphrase(key, value string) error {
return nil
}
// DeletePassphrase deletes passphrase from Vault
// DeletePassphrase deletes passphrase from Vault.
func (kms *VaultKMS) DeletePassphrase(key string) error {
vaultToken, err := kms.getAccessToken()
if err != nil {
@ -241,7 +241,7 @@ getVaultAccessToken retrieves vault token using kubernetes authentication:
1. read jwt service account token from well known location
2. request token from vault using service account jwt token
Vault will verify service account jwt token with Kubernetes and return token
if the requester is allowed
if the requester is allowed.
*/
func (kms *VaultKMS) getAccessToken() (string, error) {
saToken, err := ioutil.ReadFile(serviceAccountTokenPath)

View File

@ -49,7 +49,7 @@ type CSIIdentifier struct {
ObjectUUID string
}
// This maximum comes from the CSI spec on max bytes allowed in the various CSI ID fields
// This maximum comes from the CSI spec on max bytes allowed in the various CSI ID fields.
const maxVolIDLen = 128
const (
@ -95,7 +95,7 @@ func (ci CSIIdentifier) ComposeCSIID() (string, error) {
}
/*
DecomposeCSIID composes a CSIIdentifier from passed in string
DecomposeCSIID composes a CSIIdentifier from passed in string.
*/
func (ci *CSIIdentifier) DecomposeCSIID(composedCSIID string) (err error) {
bytesToProcess := uint16(len(composedCSIID))

View File

@ -29,7 +29,7 @@ type testTuple struct {
wantDecError bool
}
// TODO: Add more test tuples to test out other edge conditions
// TODO: Add more test tuples to test out other edge conditions.
var testData = []testTuple{
{
vID: CSIIdentifier{