Documentation ¶
Overview ¶
Package array provides structs and methods for configuring connection to PowerStore array.
Index ¶
- Variables
- func ParseVolumeID(ctx context.Context, volumeID string, defaultArray *PowerStoreArray, ...) (id string, arrayID string, protocol string, e error)
- type Cluster
- type ClusterInfoStruct
- type Consumer
- type K8sClusterInfo
- type KubeConfig
- type Locker
- func (s *Locker) Arrays() map[string]*PowerStoreArray
- func (s *Locker) DefaultArray() *PowerStoreArray
- func (s *Locker) GetOneArray(globalID string) (*PowerStoreArray, error)
- func (s *Locker) RegisterK8sCluster(fs fs.Interface) error
- func (s *Locker) SetArrays(arrays map[string]*PowerStoreArray)
- func (s *Locker) SetDefaultArray(array *PowerStoreArray)
- func (s *Locker) UpdateArrays(configPath string, fs fs.Interface) error
- type PowerStoreArray
Constants ¶
This section is empty.
Variables ¶
var ( // IPToArray - Store Array IPs IPToArray map[string]string )
Functions ¶
func ParseVolumeID ¶
func ParseVolumeID(ctx context.Context, volumeID string, defaultArray *PowerStoreArray, cap *csi.VolumeCapability) (id string, arrayID string, protocol string, e error)
ParseVolumeID parses volume id in from CO (Kubernetes) and tries to understand what in it are PowerStore volume id, and what is ip, protocol. "/" is used as a delimiter.
Example:
ParseVolumeID("1cd254s/192.168.0.1/scsi") will return id = "1cd254s" ip = "192.168.0.1" protocol = "scsi"
This function is backwards compatible and will try to understand volume protocol even if there is no such information in volume id. It will do that by querying default powerstore array passed as one of the arguments
Types ¶
type Cluster ¶
type Cluster struct { ClusterInfo ClusterInfoStruct `yaml:"cluster"` Name string `yaml:"name"` }
Cluster contains k8s cluster information
type ClusterInfoStruct ¶
type ClusterInfoStruct struct {
Server string `yaml:"server"`
}
ClusterInfoStruct contains k8s server address
type Consumer ¶
type Consumer interface { Arrays() map[string]*PowerStoreArray SetArrays(map[string]*PowerStoreArray) DefaultArray() *PowerStoreArray SetDefaultArray(*PowerStoreArray) UpdateArrays(string, fs.Interface) error RegisterK8sCluster(fs.Interface) error }
Consumer provides methods for safe management of arrays
type K8sClusterInfo ¶
K8sClusterInfo contains information of k8s cluster
type KubeConfig ¶
type KubeConfig struct { APIVersion string `yaml:"apiVersion"` Clusters []Cluster `yaml:"clusters,flow"` }
KubeConfig contains information read from kubeconfig file
type Locker ¶
type Locker struct {
// contains filtered or unexported fields
}
Locker provides implementation for safe management of arrays
func (*Locker) Arrays ¶
func (s *Locker) Arrays() map[string]*PowerStoreArray
Arrays is a getter for list of arrays
func (*Locker) DefaultArray ¶
func (s *Locker) DefaultArray() *PowerStoreArray
DefaultArray is a getter for default array
func (*Locker) GetOneArray ¶
func (s *Locker) GetOneArray(globalID string) (*PowerStoreArray, error)
GetOneArray is a getter for an arrays based on globalID
func (*Locker) RegisterK8sCluster ¶
RegisterK8sCluster registers the k8s cluster with PowerStore arrays
func (*Locker) SetArrays ¶
func (s *Locker) SetArrays(arrays map[string]*PowerStoreArray)
SetArrays adds an array
func (*Locker) SetDefaultArray ¶
func (s *Locker) SetDefaultArray(array *PowerStoreArray)
SetDefaultArray sets default array
type PowerStoreArray ¶
type PowerStoreArray struct { Endpoint string `yaml:"endpoint"` GlobalID string `yaml:"globalID"` Username string `yaml:"username"` Password string `yaml:"password"` NasName string `yaml:"nasName"` BlockProtocol common.TransportType `yaml:"blockProtocol"` Insecure bool `yaml:"skipCertificateValidation"` IsDefault bool `yaml:"isDefault"` NfsAcls string `yaml:"nfsAcls"` Client gopowerstore.Client IP string }
PowerStoreArray is a struct that stores all PowerStore connection information. It stores gopowerstore client that can be directly used to invoke PowerStore API calls. This structure is supposed to be parsed from config and mainly is created by GetPowerStoreArrays function.
func GetPowerStoreArrays ¶
func GetPowerStoreArrays(fs fs.Interface, filePath string) (map[string]*PowerStoreArray, map[string]string, *PowerStoreArray, error)
GetPowerStoreArrays parses config.yaml file, initializes gopowerstore Clients and composes map of arrays for ease of access. It will return array that can be used as default as a second return parameter. If config does not have any array as a default then the first will be returned as a default.
func (*PowerStoreArray) GetClient ¶
func (psa *PowerStoreArray) GetClient() gopowerstore.Client
GetClient is a getter that returns gopowerstore Client interface
func (*PowerStoreArray) GetGlobalID ¶
func (psa *PowerStoreArray) GetGlobalID() string
GetGlobalID is a getter that returns GlobalID address of the array
func (*PowerStoreArray) GetIP ¶
func (psa *PowerStoreArray) GetIP() string
GetIP is a getter that returns IP address of the array
func (*PowerStoreArray) GetNasName ¶
func (psa *PowerStoreArray) GetNasName() string
GetNasName is a getter that returns name of configured NAS