utils

package
v1.1.14 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: Apache-2.0 Imports: 11 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"

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

	// MachineTypeLabel is the node label used to identify the cluster type (upi,ipi,etc)
	MachineTypeLabel = "ibm-cloud.kubernetes.io/machine-type"

	// UPI is the expected value assigned to machine-type label on satellite cluster nodes
	UPI = "upi"

	// 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 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

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