Documentation ¶
Index ¶
- Constants
- Variables
- func CollapseCreateFileSystemParameters(parameters map[string]string) error
- func CollapseCreateVolumeParameters(parameters map[string]string) error
- func CollapseDeleteFileSystemParameters(parameters map[string]string) error
- func CollapseDeleteVolumeParameters(parameters map[string]string) error
- func ValidateDeleteFileSystemParameters(parameters map[string]string) error
- func ValidateDeleteVolumeParameters(parameters map[string]string) error
- type Cloud
- type EC2Metadata
- type EC2MetadataClient
- type FSx
- type FakeCloudProvider
- func (c *FakeCloudProvider) CreateFileSystem(ctx context.Context, parameters map[string]string) (*FileSystem, error)
- func (c *FakeCloudProvider) CreateSnapshot(ctx context.Context, parameters map[string]string) (snapshot *Snapshot, err error)
- func (c *FakeCloudProvider) CreateVolume(ctx context.Context, parameters map[string]string) (*Volume, error)
- func (c *FakeCloudProvider) DeleteFileSystem(ctx context.Context, parameters map[string]string) error
- func (c *FakeCloudProvider) DeleteSnapshot(ctx context.Context, parameters map[string]string) (err error)
- func (c *FakeCloudProvider) DeleteVolume(ctx context.Context, parameters map[string]string) (err error)
- func (c *FakeCloudProvider) DescribeFileSystem(ctx context.Context, filesystemId string) (*FileSystem, error)
- func (c *FakeCloudProvider) DescribeSnapshot(ctx context.Context, snapshotId string) (*Snapshot, error)
- func (c *FakeCloudProvider) DescribeVolume(ctx context.Context, volumeId string) (*Volume, error)
- func (c *FakeCloudProvider) GetDeleteParameters(ctx context.Context, id string) (map[string]string, error)
- func (c *FakeCloudProvider) GetMetadata() MetadataService
- func (c *FakeCloudProvider) GetVolumeId(ctx context.Context, volumeId string) (string, error)
- func (c *FakeCloudProvider) ResizeFileSystem(ctx context.Context, fileSystemId string, newSizeGiB int64) (*int64, error)
- func (c *FakeCloudProvider) WaitForFileSystemAvailable(ctx context.Context, fileSystemId string) error
- func (c *FakeCloudProvider) WaitForFileSystemResize(ctx context.Context, fileSystemId string, newSizeGiB int64) error
- func (c *FakeCloudProvider) WaitForSnapshotAvailable(ctx context.Context, snapshotId string) error
- func (c *FakeCloudProvider) WaitForVolumeAvailable(ctx context.Context, volumeId string) error
- func (c *FakeCloudProvider) WaitForVolumeResize(ctx context.Context, volumeId string, newSizeGiB int64) error
- type FileSystem
- type KubernetesAPIClient
- type Metadata
- type MetadataService
- type Snapshot
- type Volume
Constants ¶
const ( // PollCheckInterval specifies the interval to check if the resource is ready; // this needs to be shorter than the timeout. PollCheckInterval = 15 * time.Second // PollCheckTimeout specifies the time limit for polling the describe API for a completed create/update operation. PollCheckTimeout = 15 * time.Minute )
Polling
const ( FilesystemPrefix = "fs" VolumePrefix = "fsvol" )
Prefixes used to parse the volume id.
Variables ¶
var ( ErrAlreadyExists = errors.New("resource already exists with the given name and different parameters") ErrInvalidInput = errors.New("invalid input") ErrMultipleFound = errors.New("multiple resource found with the given ID") ErrNotFound = errors.New("resource could not be found using the respective ID") )
Errors
var DefaultEC2MetadataClient = func() (EC2Metadata, error) { sess := session.Must(session.NewSession(&aws.Config{})) svc := ec2metadata.New(sess) return svc, nil }
var DefaultKubernetesAPIClient = func() (kubernetes.Interface, error) { config, err := rest.InClusterConfig() if err != nil { return nil, err } clientset, err := kubernetes.NewForConfig(config) if err != nil { return nil, err } return clientset, nil }
Functions ¶
func ValidateDeleteFileSystemParameters ¶
ValidateDeleteFileSystemParameters is used in CreateVolume to remove all delete parameters from the parameters map, and ensure they are valid. Parameters should be unique map containing only delete parameters without the OnDeletion suffix This method expects there to be no remaining delete parameters and errors if there are any Verifies parameters are valid in accordance to the API to prevent unknown errors from occurring during DeleteVolume
func ValidateDeleteVolumeParameters ¶
ValidateDeleteVolumeParameters is used in CreateVolume to remove all delete parameters from the parameters map, and ensure they are valid. Parameters should be unique map containing only delete parameters without the OnDeletion suffix This method expects there to be no remaining delete parameters and errors if there are any Verifies parameters are valid in accordance to the API to prevent unknown errors from occurring during DeleteVolume
Types ¶
type Cloud ¶
type Cloud interface { CreateFileSystem(ctx context.Context, parameters map[string]string) (*FileSystem, error) ResizeFileSystem(ctx context.Context, fileSystemId string, newSizeGiB int64) (*int64, error) DeleteFileSystem(ctx context.Context, parameters map[string]string) error DescribeFileSystem(ctx context.Context, fileSystemId string) (*FileSystem, error) WaitForFileSystemAvailable(ctx context.Context, fileSystemId string) error WaitForFileSystemResize(ctx context.Context, fileSystemId string, resizeGiB int64) error CreateVolume(ctx context.Context, parameters map[string]string) (*Volume, error) DeleteVolume(ctx context.Context, parameters map[string]string) error DescribeVolume(ctx context.Context, volumeId string) (*Volume, error) WaitForVolumeAvailable(ctx context.Context, volumeId string) error WaitForVolumeResize(ctx context.Context, volumeId string, resizeGiB int64) error CreateSnapshot(ctx context.Context, options map[string]string) (*Snapshot, error) DeleteSnapshot(ctx context.Context, parameters map[string]string) error DescribeSnapshot(ctx context.Context, snapshotId string) (*Snapshot, error) WaitForSnapshotAvailable(ctx context.Context, snapshotId string) error GetDeleteParameters(ctx context.Context, id string) (map[string]string, error) GetVolumeId(ctx context.Context, volumeId string) (string, error) }
type EC2Metadata ¶
type EC2Metadata interface { Available() bool // EC2 instance metadata endpoints: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html GetMetadata(string) (string, error) GetInstanceIdentityDocument() (ec2metadata.EC2InstanceIdentityDocument, error) }
type EC2MetadataClient ¶
type EC2MetadataClient func() (EC2Metadata, error)
type FSx ¶
type FSx interface { CreateFileSystemWithContext(aws.Context, *fsx.CreateFileSystemInput, ...request.Option) (*fsx.CreateFileSystemOutput, error) UpdateFileSystemWithContext(aws.Context, *fsx.UpdateFileSystemInput, ...request.Option) (*fsx.UpdateFileSystemOutput, error) DeleteFileSystemWithContext(aws.Context, *fsx.DeleteFileSystemInput, ...request.Option) (*fsx.DeleteFileSystemOutput, error) DescribeFileSystemsWithContext(aws.Context, *fsx.DescribeFileSystemsInput, ...request.Option) (*fsx.DescribeFileSystemsOutput, error) CreateVolumeWithContext(aws.Context, *fsx.CreateVolumeInput, ...request.Option) (*fsx.CreateVolumeOutput, error) DeleteVolumeWithContext(aws.Context, *fsx.DeleteVolumeInput, ...request.Option) (*fsx.DeleteVolumeOutput, error) DescribeVolumesWithContext(aws.Context, *fsx.DescribeVolumesInput, ...request.Option) (*fsx.DescribeVolumesOutput, error) CreateSnapshotWithContext(aws.Context, *fsx.CreateSnapshotInput, ...request.Option) (*fsx.CreateSnapshotOutput, error) DeleteSnapshotWithContext(aws.Context, *fsx.DeleteSnapshotInput, ...request.Option) (*fsx.DeleteSnapshotOutput, error) DescribeSnapshotsWithContext(aws.Context, *fsx.DescribeSnapshotsInput, ...request.Option) (*fsx.DescribeSnapshotsOutput, error) ListTagsForResource(*fsx.ListTagsForResourceInput) (*fsx.ListTagsForResourceOutput, error) }
FSx abstracts FSx client to facilitate its mocking. See https://docs.aws.amazon.com/sdk-for-go/api/service/fsx/ for details
type FakeCloudProvider ¶
type FakeCloudProvider struct {
// contains filtered or unexported fields
}
func NewFakeCloudProvider ¶
func NewFakeCloudProvider() *FakeCloudProvider
func (*FakeCloudProvider) CreateFileSystem ¶
func (c *FakeCloudProvider) CreateFileSystem(ctx context.Context, parameters map[string]string) (*FileSystem, error)
func (*FakeCloudProvider) CreateSnapshot ¶
func (*FakeCloudProvider) CreateVolume ¶
func (*FakeCloudProvider) DeleteFileSystem ¶
func (*FakeCloudProvider) DeleteSnapshot ¶
func (*FakeCloudProvider) DeleteVolume ¶
func (*FakeCloudProvider) DescribeFileSystem ¶
func (c *FakeCloudProvider) DescribeFileSystem(ctx context.Context, filesystemId string) (*FileSystem, error)
func (*FakeCloudProvider) DescribeSnapshot ¶
func (*FakeCloudProvider) DescribeVolume ¶
func (*FakeCloudProvider) GetDeleteParameters ¶
func (*FakeCloudProvider) GetMetadata ¶
func (c *FakeCloudProvider) GetMetadata() MetadataService
func (*FakeCloudProvider) GetVolumeId ¶
func (*FakeCloudProvider) ResizeFileSystem ¶
func (*FakeCloudProvider) WaitForFileSystemAvailable ¶
func (c *FakeCloudProvider) WaitForFileSystemAvailable(ctx context.Context, fileSystemId string) error
func (*FakeCloudProvider) WaitForFileSystemResize ¶
func (*FakeCloudProvider) WaitForSnapshotAvailable ¶
func (c *FakeCloudProvider) WaitForSnapshotAvailable(ctx context.Context, snapshotId string) error
func (*FakeCloudProvider) WaitForVolumeAvailable ¶
func (c *FakeCloudProvider) WaitForVolumeAvailable(ctx context.Context, volumeId string) error
func (*FakeCloudProvider) WaitForVolumeResize ¶
type FileSystem ¶
FileSystem represents an OpenZFS filesystem
type KubernetesAPIClient ¶
type KubernetesAPIClient func() (kubernetes.Interface, error)
type Metadata ¶
type Metadata struct { InstanceID string InstanceType string Region string AvailabilityZone string }
func EC2MetadataInstanceInfo ¶
func EC2MetadataInstanceInfo(svc EC2Metadata, regionFromSession string) (*Metadata, error)
func KubernetesAPIInstanceInfo ¶
func KubernetesAPIInstanceInfo(clientset kubernetes.Interface) (*Metadata, error)
func (*Metadata) GetAvailabilityZone ¶
GetAvailabilityZone returns the Availability Zone which the instance is in.
func (*Metadata) GetInstanceID ¶
GetInstanceID returns the instance identification.
func (*Metadata) GetInstanceType ¶
GetInstanceType returns the instance type.
type MetadataService ¶
type MetadataService interface { GetInstanceID() string GetInstanceType() string GetRegion() string GetAvailabilityZone() string }
MetadataService represents AWS metadata service.
func NewMetadataService ¶
func NewMetadataService(ec2MetadataClient EC2MetadataClient, k8sAPIClient KubernetesAPIClient, region string) (MetadataService, error)
NewMetadataService returns a new MetadataServiceImplementation.