service

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultMaxPowerFlexConnections is the number of workers that can query powerflex  at a time
	DefaultMaxPowerFlexConnections = 10
)

Variables

View Source
var SystemFinder = func(client PowerFlexClient, id string, name string, href string) (PowerFlexSystem, error) {
	return client.FindSystem(id, name, href)
}

SystemFinder is a function that will be used for finding a PowerFlexSystem by id, name, and href

Functions

func GetLogicalCapacityAvailable

func GetLogicalCapacityAvailable(stats *types.Statistics) float64

GetLogicalCapacityAvailable returns the unused user data in GB from the given storage pool statistics

func GetLogicalCapacityInUse

func GetLogicalCapacityInUse(stats *types.Statistics) float64

GetLogicalCapacityInUse returns the used user data in GB from the given storage pool statistics

func GetLogicalProvisioned

func GetLogicalProvisioned(stats *types.Statistics) float64

GetLogicalProvisioned returns the total volume size in GB from the given storage pool statistics

func GetSDCBandwidth

func GetSDCBandwidth(stats *types.SdcStatistics) (readBW float64, writeBW float64)

GetSDCBandwidth returns the read and write bandwidth based on the given SDC statistics

func GetSDCIOPS

func GetSDCIOPS(stats *types.SdcStatistics) (readIOPS float64, writeIOPS float64)

GetSDCIOPS returns the read and write IOPS based on the given SDC statistics

func GetSDCLatency

func GetSDCLatency(stats *types.SdcStatistics) (readLatency float64, writeLatency float64)

GetSDCLatency returns the read and write latency based on the given SDC statistics

func GetTotalLogicalCapacity

func GetTotalLogicalCapacity(stats *types.Statistics) float64

GetTotalLogicalCapacity returns the used + unused user data in GB from the given storage pool statistics

func GetVolumeBandwidth

func GetVolumeBandwidth(stats *types.VolumeStatistics) (readBW float64, writeBW float64)

GetVolumeBandwidth returns the read and write bandwidth based on the given SDC statistics

func GetVolumeIOPS

func GetVolumeIOPS(stats *types.VolumeStatistics) (readIOPS float64, writeIOPS float64)

GetVolumeIOPS returns the read and write IOPS based on the given SDC statistics

func GetVolumeLatency

func GetVolumeLatency(stats *types.VolumeStatistics) (readLatency float64, writeLatency float64)

GetVolumeLatency returns the read and write latency based on the given SDC statistics

Types

type ArrayConnectionData

type ArrayConnectionData struct {
	SystemID                  string `json:"systemID"`
	Username                  string `json:"username"`
	Password                  string `json:"password"`
	Endpoint                  string `json:"endpoint"`
	Insecure                  bool   `json:"insecure,omitempty"`
	IsDefault                 bool   `json:"isDefault,omitempty"`
	SkipCertificateValidation bool   `json:"skipCertificateValidation,omitempty"`
}

ArrayConnectionData contains data required to connect to array

type CapacityMetrics

type CapacityMetrics struct {
	TotalLogicalCapacity     asyncfloat64.UpDownCounter
	LogicalCapacityAvailable asyncfloat64.UpDownCounter
	LogicalCapacityInUse     asyncfloat64.UpDownCounter
	LogicalProvisioned       asyncfloat64.UpDownCounter
}

CapacityMetrics contains the metrics related to a capacity

type ConfigurationReader

type ConfigurationReader struct{}

ConfigurationReader handles reading of the storage system configuration secret

func (*ConfigurationReader) GetStorageSystemConfiguration

func (c *ConfigurationReader) GetStorageSystemConfiguration(file string) ([]ArrayConnectionData, error)

GetStorageSystemConfiguration returns a storage system from the configuration file If no default system is supplied, the first system in the list is returned

type Float64UpDownCounterCreater

type Float64UpDownCounterCreater interface {
	AsyncFloat64() asyncfloat64.InstrumentProvider
}

Float64UpDownCounterCreater creates a Float64UpDownCounter InstrumentProvider

type IDedPoolStatisticGetter

type IDedPoolStatisticGetter struct {
	ID     string
	Getter StoragePoolStatisticsGetter
}

IDedPoolStatisticGetter offers PoolStatisticGetter with its corresponding pool ID

type LeaderElector

type LeaderElector interface {
	InitLeaderElection(string, string) error
	IsLeader() bool
}

LeaderElector will elect a leader

type MappedSDC

type MappedSDC struct {
	SdcID string `json:"sdcId"`
	SdcIP string `json:"sdcIp"`
}

MappedSDC is the summerized details of the SDCs volume is mapped to

type Metrics

Metrics contains the list of metrics data that is collected

type MetricsRecorder

type MetricsRecorder interface {
	Record(ctx context.Context, meta interface{},
		readBW, writeBW,
		readIOPS, writeIOPS,
		readLatency, writeLatency float64) error
	RecordCapacity(ctx context.Context, meta interface{},
		totalLogicalCapacity, logicalCapacityAvailable, logicalCapacityInUse, logicalProvisioned float64) error
}

MetricsRecorder supports recording I/O metrics

type MetricsWrapper

type MetricsWrapper struct {
	Meter           Float64UpDownCounterCreater
	Metrics         sync.Map
	Labels          sync.Map
	CapacityMetrics sync.Map
}

MetricsWrapper contains data used for pushing metrics data

func (*MetricsWrapper) Record

func (mw *MetricsWrapper) Record(ctx context.Context, meta interface{},
	readBW, writeBW,
	readIOPS, writeIOPS,
	readLatency, writeLatency float64,
) error

Record will publish metrics data for a given instance

func (*MetricsWrapper) RecordCapacity

func (mw *MetricsWrapper) RecordCapacity(ctx context.Context, meta interface{},
	totalLogicalCapacity, logicalCapacityAvailable, logicalCapacityInUse, logicalProvisioned float64,
) error

RecordCapacity will publish capacity metrics for a given instance

type NodeFinder

type NodeFinder interface {
	GetNodes() ([]corev1.Node, error)
}

NodeFinder is a node finder that will query the Kubernetes API for a slice of cluster nodes

type PowerFlexClient

type PowerFlexClient interface {
	Authenticate(*sio.ConfigConnect) (sio.Cluster, error)
	GetInstance(string) ([]*types.System, error)
	FindSystem(string, string, string) (*sio.System, error)
	GetStoragePool(href string) ([]*types.StoragePool, error)
}

PowerFlexClient contains operations for a powerflex client

type PowerFlexService

type PowerFlexService struct {
	MetricsWrapper          MetricsRecorder
	MaxPowerFlexConnections int
	Logger                  *logrus.Logger
}

PowerFlexService represents the service for getting SDC metrics data for a PowerFlex system

func (*PowerFlexService) ExportVolumeStatistics

func (s *PowerFlexService) ExportVolumeStatistics(ctx context.Context, volumes []VolumeStatisticsGetter, volumeFinder VolumeFinder)

ExportVolumeStatistics records I/O statistics for the given list of Volumes

func (*PowerFlexService) GetSDCStatistics

func (s *PowerFlexService) GetSDCStatistics(ctx context.Context, nodes []corev1.Node, sdcs []StatisticsGetter)

GetSDCStatistics records I/O statistics for the given list of SDCs

func (*PowerFlexService) GetSDCs

func (s *PowerFlexService) GetSDCs(_ context.Context, client PowerFlexClient, sdcFinder SDCFinder) ([]StatisticsGetter, error)

GetSDCs returns a slice of SDCs

func (*PowerFlexService) GetStorageClasses

func (s *PowerFlexService) GetStorageClasses(_ context.Context, client PowerFlexClient, storageClassFinder StorageClassFinder) ([]StorageClassMeta, error)

GetStorageClasses returns a list of StorageClassMeta

func (*PowerFlexService) GetStoragePoolStatistics

func (s *PowerFlexService) GetStoragePoolStatistics(ctx context.Context, storageClassMetas []StorageClassMeta)

GetStoragePoolStatistics records the capacity metrics for a slice of StorageClassMeta

func (*PowerFlexService) GetVolumes

GetVolumes returns all unique, mapped volumes in sdcs

type PowerFlexSystem

type PowerFlexSystem interface {
	FindSdc(string, string) (*sio.Sdc, error)
}

PowerFlexSystem contains operations for a powerflex system

type SDCFinder

type SDCFinder interface {
	GetSDCGuids() ([]string, error)
}

SDCFinder is used to find SDC GUIDs

type SDCMeta

type SDCMeta struct {
	ID      string
	Name    string
	IP      string
	SdcGUID string
}

SDCMeta is meta data for a specific SDC

func GetSDCMeta

func GetSDCMeta(sdc interface{}, nodes []corev1.Node) *SDCMeta

GetSDCMeta returns SDC meta information from a goscaleio SDC This function is exported for direct testing

type SDCMetricsRecord

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

SDCMetricsRecord used for holding output of the SDC stat query results

type Service

type Service interface {
	GetSDCs(context.Context, PowerFlexClient, SDCFinder) ([]StatisticsGetter, error)
	GetSDCStatistics(context.Context, []corev1.Node, []StatisticsGetter)
	GetVolumes(context.Context, []StatisticsGetter) ([]VolumeStatisticsGetter, error)
	ExportVolumeStatistics(context.Context, []VolumeStatisticsGetter, VolumeFinder)
	GetStorageClasses(ctx context.Context, client PowerFlexClient, storageClassFinder StorageClassFinder) ([]StorageClassMeta, error)
	GetStoragePoolStatistics(ctx context.Context, storageClassMetas []StorageClassMeta)
}

Service contains operations that would be used to interact with a PowerFlex system

type StatisticsGetter

type StatisticsGetter interface {
	GetStatistics() (*types.SdcStatistics, error)
	GetVolume() ([]*types.Volume, error)
	FindVolumes() ([]*sio.Volume, error)
}

StatisticsGetter supports getting statistics

type StorageClassFinder

type StorageClassFinder interface {
	GetStorageClasses() ([]v1.StorageClass, error)
}

StorageClassFinder is used to find storage classes in kubernetes

type StorageClassInfo

type StorageClassInfo struct {
	ID              string
	Name            string
	Driver          string
	StorageSystemID string
	StoragePools    []string
}

StorageClassInfo is meta data about a storage class and contains the associated PowerFlex storage pool names

type StorageClassMeta

type StorageClassMeta struct {
	ID              string
	Name            string
	Driver          string
	StorageSystemID string
	StoragePools    map[string]StoragePoolStatisticsGetter
}

StorageClassMeta is the same as StorageClassInfo except it contains a map of PowerFlex storage pool IDs to goscaleio storage pool structs

type StoragePoolStatisticsGetter

type StoragePoolStatisticsGetter interface {
	GetStatistics() (*types.Statistics, error)
}

StoragePoolStatisticsGetter supports getting storage pool statistics

type VolumeFinder

type VolumeFinder interface {
	GetPersistentVolumes() ([]k8s.VolumeInfo, error)
}

VolumeFinder is used to find volume information in kubernetes

type VolumeMeta

type VolumeMeta struct {
	ID                        string
	Name                      string
	PersistentVolumeName      string
	PersistentVolumeClaimName string
	Namespace                 string
	StorageSystemID           string
	MappedSDCs                []MappedSDC
}

VolumeMeta is the details of a volume in an SDC

type VolumeMetricsRecord

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

VolumeMetricsRecord used for holding output of the Volume stat query results

type VolumeStatisticsGetter

type VolumeStatisticsGetter interface {
	GetVolumeStatistics() (*types.VolumeStatistics, error)
}

VolumeStatisticsGetter supports getting statistics

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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