utils

package
v1.0.0-beta17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2022 License: Apache-2.0 Imports: 22 Imported by: 7

Documentation

Overview

Package utils ...

Package utils ...

Package utils ...

Package utils ...

Package utils ...

Index

Constants

View Source
const (
	// GiB in bytes
	GiB = 1024 * 1024 * 1024

	// MinimumVolumeSizeInBytes minimum size of the volume in bytes
	MinimumVolumeSizeInBytes int64 = 10 * GiB
	// MaximumVolumeSizeInBytes the max allowed capacity
	MaximumVolumeSizeInBytes int64 = 2 * 1024 * GiB //2000GB = 2TB

	// MinimumVolumeDiskSizeInGb minimum size of the volume in GB
	MinimumVolumeDiskSizeInGb = 10
	// MaximumVolumeDiskSizeInGb ...
	MaximumVolumeDiskSizeInGb = 2048
	// DefaultVolumeDiskSizeinGb default size of the volume in GB
	DefaultVolumeDiskSizeinGb = 10
	// MaxRetryAttemptForSessions ...
	MaxRetryAttemptForSessions = 2
)
View Source
const (

	// KB ...
	KB = 1 << (10 * iota)
	// MB ...
	MB
	// GB ...
	GB
	// TB ...
	TB
)
View Source
const (
	// ClusterInfoPath ...
	ClusterInfoPath = "cluster_info/cluster-config.json"

	// NodeZoneLabel  Zone Label attached to node
	NodeZoneLabel = "failure-domain.beta.kubernetes.io/zone"

	// NodeRegionLabel Region Label attached to node
	NodeRegionLabel = "failure-domain.beta.kubernetes.io/region"

	// NodeWorkerIDLabel  worker ID label attached to node
	NodeWorkerIDLabel = "ibm-cloud.kubernetes.io/worker-id"

	// NodeInstanceIDLabel VPC ID label attached to satellite host
	NodeInstanceIDLabel = "ibm-cloud.kubernetes.io/vpc-instance-id"

	// VolumeIDLabel ...
	VolumeIDLabel = "volumeId"

	// VolumeCRNLabel ...
	VolumeCRNLabel = "volumeCRN"

	// ClusterIDLabel ...
	ClusterIDLabel = "clusterID"

	// IOPSLabel ...
	IOPSLabel = "iops"

	// ZoneLabel ...
	ZoneLabel = "zone"

	// ConfigFileName ...
	ConfigFileName = "slclient.toml"
)

Variables

View Source
var LockEnabled = flag.Bool("lock_enabled", true, "Enable or disable lock")

LockEnabled ...

Functions

func BytesToGiB

func BytesToGiB(volumeSizeBytes int64) int

BytesToGiB converts Bytes to GiB

func GetContextLogger

func GetContextLogger(ctx context.Context, isDebug bool) (*zap.Logger, string)

GetContextLogger ...

func GetContextLoggerWithRequestID

func GetContextLoggerWithRequestID(ctx context.Context, isDebug bool, requestIDIn *string) (*zap.Logger, string)

GetContextLoggerWithRequestID adds existing requestID in the logger The Existing requestID might be coming from ControllerPublishVolume etc

func GetTestLogger

func GetTestLogger(t *testing.T) (logger *zap.Logger, teardown func())

GetTestLogger ...

func ListContainsSubstr

func ListContainsSubstr(mainStr []string, subStr string) bool

ListContainsSubstr Checks if subStr is there in mainStr

func NewControllerServiceCapability

func NewControllerServiceCapability(cap csi.ControllerServiceCapability_RPC_Type) *csi.ControllerServiceCapability

NewControllerServiceCapability ...

func NewNodeServiceCapability

func NewNodeServiceCapability(cap csi.NodeServiceCapability_RPC_Type) *csi.NodeServiceCapability

NewNodeServiceCapability ...

func NewVolumeCapabilityAccessMode

func NewVolumeCapabilityAccessMode(mode csi.VolumeCapability_AccessMode_Mode) *csi.VolumeCapability_AccessMode

NewVolumeCapabilityAccessMode ...

func RoundUpBytes

func RoundUpBytes(volumeSizeBytes int64) int64

RoundUpBytes rounds up the volume size in bytes upto multiplications of GiB in the unit of Bytes

Types

type APIKeyImpl

type APIKeyImpl struct {
	GRPCBackend grpcClient.GrpcSessionFactory
	// contains filtered or unexported fields
}

APIKeyImpl implementation

func NewAPIKeyImpl

func NewAPIKeyImpl(loggerIn *zap.Logger) (*APIKeyImpl, error)

NewAPIKeyImpl returns the new decryptor

func (*APIKeyImpl) UpdateIAMKeys

func (d *APIKeyImpl) UpdateIAMKeys(config *config.Config) error

UpdateIAMKeys decrypts the API keys and updates.

type ClusterInfo

type ClusterInfo struct {
	ClusterID   string `json:"cluster_id"`
	ClusterName string `json:"cluster_name,omitempty"`
	DataCenter  string `json:"datacenter,omitempty"`
	CustomerID  string `json:"customer_id,omitempty"`
}

ClusterInfo contains the cluster information

func NewClusterInfo

func NewClusterInfo(logger *zap.Logger) (*ClusterInfo, error)

NewClusterInfo loads cluster info

type LockStore

type LockStore struct {
	// contains filtered or unexported fields
}

LockStore ...

func (*LockStore) Lock

func (s *LockStore) Lock(name string)

Lock ...

func (*LockStore) Unlock

func (s *LockStore) Unlock(name string)

Unlock ...

Directories

Path Synopsis
Package grpcclient ...
Package grpcclient ...
fake-grpc
Package fakegrpc ...
Package fakegrpc ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL