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 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 int32) (*int32, error)
- func (c *FakeCloudProvider) WaitForFileSystemAvailable(ctx context.Context, fileSystemId string) error
- func (c *FakeCloudProvider) WaitForFileSystemResize(ctx context.Context, fileSystemId string, newSizeGiB int32) 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 int32) error
- type FileSystem
- type IMDS
- type IMDSClient
- 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 DefaultIMDSClient = func() (IMDS, error) { cfg, err := config.LoadDefaultConfig(context.Background()) if err != nil { return nil, err } svc := imds.NewFromConfig(cfg) 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 int32) (*int32, 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 int32) 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 int32) 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 FSx ¶
type FSx interface {
CreateFileSystem(context.Context, *fsx.CreateFileSystemInput, ...func(*fsx.Options)) (*fsx.CreateFileSystemOutput, error)
UpdateFileSystem(context.Context, *fsx.UpdateFileSystemInput, ...func(*fsx.Options)) (*fsx.UpdateFileSystemOutput, error)
DeleteFileSystem(context.Context, *fsx.DeleteFileSystemInput, ...func(*fsx.Options)) (*fsx.DeleteFileSystemOutput, error)
DescribeFileSystems(context.Context, *fsx.DescribeFileSystemsInput, ...func(*fsx.Options)) (*fsx.DescribeFileSystemsOutput, error)
CreateVolume(context.Context, *fsx.CreateVolumeInput, ...func(*fsx.Options)) (*fsx.CreateVolumeOutput, error)
DeleteVolume(context.Context, *fsx.DeleteVolumeInput, ...func(*fsx.Options)) (*fsx.DeleteVolumeOutput, error)
DescribeVolumes(context.Context, *fsx.DescribeVolumesInput, ...func(*fsx.Options)) (*fsx.DescribeVolumesOutput, error)
CreateSnapshot(context.Context, *fsx.CreateSnapshotInput, ...func(*fsx.Options)) (*fsx.CreateSnapshotOutput, error)
DeleteSnapshot(context.Context, *fsx.DeleteSnapshotInput, ...func(*fsx.Options)) (*fsx.DeleteSnapshotOutput, error)
DescribeSnapshots(context.Context, *fsx.DescribeSnapshotsInput, ...func(*fsx.Options)) (*fsx.DescribeSnapshotsOutput, error)
ListTagsForResource(context.Context, *fsx.ListTagsForResourceInput, ...func(*fsx.Options)) (*fsx.ListTagsForResourceOutput, error)
}
FSx abstracts FSx client to facilitate its mocking. See https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/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 ¶
type FileSystem struct {
DnsName string
FileSystemId string
StorageCapacity int32
StorageType types.StorageType
}
FileSystem represents an OpenZFS filesystem
type IMDS ¶ added in v1.2.0
type IMDS interface {
GetMetadata(ctx context.Context, params *imds.GetMetadataInput, optFns ...func(*imds.Options)) (*imds.GetMetadataOutput, error)
GetInstanceIdentityDocument(context.Context, *imds.GetInstanceIdentityDocumentInput, ...func(*imds.Options)) (*imds.GetInstanceIdentityDocumentOutput, error)
}
type IMDSClient ¶ added in v1.2.0
type KubernetesAPIClient ¶
type KubernetesAPIClient func() (kubernetes.Interface, error)
type Metadata ¶
type Metadata struct {
InstanceID string
InstanceType string
Region string
AvailabilityZone string
}
func IMDSInstanceInfo ¶ added in v1.2.0
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(imdsClient IMDSClient, k8sAPIClient KubernetesAPIClient, region string) (MetadataService, error)
NewMetadataService returns a new MetadataServiceImplementation.