cloud

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VolumeTypeTier1 = "tier1"
	VolumeTypeTier3 = "tier3"
)

PowerVS volume types

View Source
const (
	// DefaultVolumeSize represents the default volume size.
	DefaultVolumeSize int64 = 10 * util.GiB
	// DefaultVolumeType specifies which storage to use for newly created Volumes.
	DefaultVolumeType = VolumeTypeTier1
)

Defaults

View Source
const (
	PollTimeout          = 120 * time.Second
	PollInterval         = 5 * time.Second
	TIMEOUT              = 60 * time.Minute
	VolumeInUseState     = "in-use"
	VolumeAvailableState = "available"
)
View Source
const (
	PowerVSInstanceStateSHUTOFF = "SHUTOFF"
	PowerVSInstanceStateACTIVE  = "ACTIVE"
	StoragePoolAffinity         = false
)
View Source
const (
	ProviderIDValidLength = 6
)

Variables

View Source
var (
	// ErrNotFound is returned when a resource is not found.
	ErrNotFound = errors.New("resource was not found")

	// ErrAlreadyExists is returned when a resource is already existent.
	ErrAlreadyExists = errors.New("resource already exists")
)
View Source
var DefaultKubernetesAPIClient = func(kubeconfig string) (kubernetes.Interface, error) {
	config, err := clientcmd.BuildConfigFromFlags("", kubeconfig)
	if err != nil {
		return nil, err
	}

	clientset, err := kubernetes.NewForConfig(config)
	if err != nil {
		return nil, err
	}
	return clientset, nil
}

Get default kubernetes API client

View Source
var (
	ValidVolumeTypes = []string{
		VolumeTypeTier1,
		VolumeTypeTier3,
	}
)

Functions

This section is empty.

Types

type Cloud

type Cloud interface {
	CreateDisk(volumeName string, diskOptions *DiskOptions) (disk *Disk, err error)
	DeleteDisk(volumeID string) (success bool, err error)
	AttachDisk(volumeID string, nodeID string) (err error)
	DetachDisk(volumeID string, nodeID string) (err error)
	ResizeDisk(volumeID string, reqSize int64) (newSize int64, err error)
	WaitForVolumeState(volumeID, state string) error
	GetDiskByName(name string) (disk *Disk, err error)
	GetDiskByID(volumeID string) (disk *Disk, err error)
	GetPVMInstanceByName(instanceName string) (instance *PVMInstance, err error)
	GetPVMInstanceByID(instanceID string) (instance *PVMInstance, err error)
	GetPVMInstanceDetails(instanceID string) (*models.PVMInstance, error)
	UpdateStoragePoolAffinity(instanceID string) error
	IsAttached(volumeID string, nodeID string) (attached bool, err error)
}

func NewPowerVSCloud

func NewPowerVSCloud(cloudInstanceID, zone string, debug bool) (Cloud, error)

type Disk

type Disk struct {
	VolumeID    string
	DiskType    string
	WWN         string
	Name        string
	Shareable   bool
	CapacityGiB int64
}

Disk represents a PowerVS volume

type DiskOptions

type DiskOptions struct {
	//PowerVS options
	Shareable bool
	//CapacityGigaBytes float64
	CapacityBytes int64
	VolumeType    string
}

DiskOptions represents parameters to create an PowerVS volume

type KubernetesAPIClient

type KubernetesAPIClient func(kubeconfig string) (kubernetes.Interface, error)

type Metadata

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

Metadata is info about the instance on which the driver is running

func GetInstanceInfoFromProviderID

func GetInstanceInfoFromProviderID(clientset kubernetes.Interface, nodeName string) (*Metadata, error)

func KubernetesAPIInstanceInfo

func KubernetesAPIInstanceInfo(clientset kubernetes.Interface) (*Metadata, error)

Get instance info from kubernetes API

func TokenizeProviderID added in v0.2.0

func TokenizeProviderID(providerID string) (*Metadata, error)

TokenizeProviderID tokenize the provider id into Metadata structure ProviderID format: ibmpowervs://<region>/<zone>/<service_instance_id>/<powervs_machine_id>

func (*Metadata) GetCloudInstanceId

func (m *Metadata) GetCloudInstanceId() string

GetCloudInstanceId returns cloud instance id of the instance

func (*Metadata) GetPvmInstanceId

func (m *Metadata) GetPvmInstanceId() string

GetPvmInstanceId returns pvm instance id of the instance

func (*Metadata) GetRegion added in v0.2.0

func (m *Metadata) GetRegion() string

GetRegion returns region of the instance

func (*Metadata) GetZone added in v0.2.0

func (m *Metadata) GetZone() string

GetZone returns zone of the instance

type MetadataService

type MetadataService interface {
	GetRegion() string
	GetZone() string
	GetCloudInstanceId() string
	GetPvmInstanceId() string
}

MetadataService represents Power VS metadata service.

func NewMetadataService

func NewMetadataService(k8sAPIClient KubernetesAPIClient, kubeconfig string) (MetadataService, error)

Get New Metadata Service

type NodeUpdateScope

type NodeUpdateScope struct {
	Cloud
	ServiceInstanceId string
	InstanceId        string
	Zone              string
}

func NewNodeUpdateScope

func NewNodeUpdateScope(params NodeUpdateScopeParams) (scope *NodeUpdateScope, err error)

type NodeUpdateScopeParams

type NodeUpdateScopeParams struct {
	ServiceInstanceId string
	InstanceId        string
	Zone              string
}

type PVMInstance

type PVMInstance struct {
	ID       string
	DiskType string
	Name     string
}

type PowerVSClient

type PowerVSClient interface {
}

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