ebs

package
v8.2.1+incompatible Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsFiltered

func IsFiltered(vol *ec2.Volume, filterFuncs []func(t *ec2.Tag) bool) bool

func IsInvalidConfig

func IsInvalidConfig(err error) bool

IsInvalidConfig asserts invalidConfigError.

func IsVolumeAttached

func IsVolumeAttached(err error) bool

IsVolumeAttached asserts volumeAttachedError.

func IsVolumeNotFound

func IsVolumeNotFound(err error) bool

IsVolumeNotFound asserts volume not found error from upstream's API code.

func NewDockerVolumeFilter

func NewDockerVolumeFilter(cr infrastructurev1alpha2.AWSCluster) func(t *ec2.Tag) bool

func NewEtcdVolumeFilter

func NewEtcdVolumeFilter(cr infrastructurev1alpha2.AWSCluster) func(t *ec2.Tag) bool

func NewPersistentVolumeFilter

func NewPersistentVolumeFilter(cr infrastructurev1alpha2.AWSCluster) func(t *ec2.Tag) bool

Types

type Config

type Config struct {
	Client EC2Client
	Logger micrologger.Logger
}

type EBS

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

func New

func New(config Config) (*EBS, error)

func (*EBS) DeleteVolume

func (e *EBS) DeleteVolume(ctx context.Context, volumeID string) error

DeleteVolume deletes an EBS volume with retry logic.

func (*EBS) DetachVolume

func (e *EBS) DetachVolume(ctx context.Context, volumeID string, attachment VolumeAttachment, force bool, shutdown bool, wait bool) error

DetachVolume detaches an EBS volume. If force is specified data loss may occur. If shutdown is specified the instance will be stopped first. Note that the long term plan for the interface and functionality is to remove the EC2 instance management so the EBS service implementation here only manages EBS volumes.

func (*EBS) ListVolumes

func (e *EBS) ListVolumes(cr infrastructurev1alpha2.AWSCluster, filterFuncs ...func(t *ec2.Tag) bool) ([]Volume, error)

ListVolumes lists EBS volumes for a guest cluster. If etcdVolume is true the Etcd volume for the master instance will be returned. If persistentVolume is set then any Persistent Volumes associated with the cluster will be returned.

type EC2Client

type EC2Client interface {
	DeleteVolume(*ec2.DeleteVolumeInput) (*ec2.DeleteVolumeOutput, error)
	DescribeVolumes(*ec2.DescribeVolumesInput) (*ec2.DescribeVolumesOutput, error)
	DetachVolume(*ec2.DetachVolumeInput) (*ec2.VolumeAttachment, error)
	StopInstances(*ec2.StopInstancesInput) (*ec2.StopInstancesOutput, error)
	WaitUntilInstanceStopped(*ec2.DescribeInstancesInput) error
}

EC2Client describes the methods required to be implemented by an EC2 AWS client.

type Interface

type Interface interface {
	// DeleteVolume deletes an EBS volume with retry logic.
	DeleteVolume(ctx context.Context, volumeID string) error
	// DetachVolume detaches an EBS volume. If force is specified data loss may
	// occur. If shutdown is specified the instance will be stopped first.
	DetachVolume(ctx context.Context, volumeID string, attachment VolumeAttachment, force bool, shutdown bool, wait bool) error
	// ListVolumes lists EBS volumes for a guest cluster. If etcdVolume is true
	// the Etcd volume for the master instance will be returned. If
	// persistentVolume is true then any Persistent Volumes associated with the
	// cluster will be returned.
	ListVolumes(customObject infrastructurev1alpha2.AWSCluster, filterFuncs ...func(t *ec2.Tag) bool) ([]Volume, error)
}

Interface describes the methods provided by the helm client.

type Volume

type Volume struct {
	VolumeID    string
	Attachments []VolumeAttachment
}

Volume is an EBS volume and its attachments.

type VolumeAttachment

type VolumeAttachment struct {
	Device     string
	InstanceID string
}

VolumeAttachment is an EBS volume attached to an EC2 instance.

Jump to

Keyboard shortcuts

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