cloud

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: Apache-2.0 Imports: 18 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// DefaultVolumeSize represents the default size used
	// this is the minimum FSx for Lustre FS size
	DefaultVolumeSize = 1200

	// PollCheckInterval specifies the interval to check if filesystem is ready;
	// needs to be shorter than the provisioner timeout
	PollCheckInterval = 30 * time.Second
	// PollCheckTimeout specifies the time limit for polling DescribeFileSystems
	// for a completed create/update operation. FSx for Lustre filesystem
	// creation time is around 5 minutes, and update time varies depending on
	// target file system values
	PollCheckTimeout = 10 * time.Minute
)
View Source
const (
	// VolumeNameTagKey is the key value that refers to the volume's name.
	VolumeNameTagKey = "CSIVolumeName"
)

Tags

Variables

View Source
var (
	// ErrMultiDisks is an error that is returned when multiple
	// disks are found with the same volume name.
	ErrMultiFileSystems = errors.New("Multiple filesystems with same ID")

	// ErrFsExistsDiffSize is an error that is returned if a filesystem
	// exists with a given ID, but a different capacity is requested.
	ErrFsExistsDiffSize = errors.New("There is already a disk with same ID and different size")

	// ErrNotFound is returned when a resource is not found.
	ErrNotFound = errors.New("Resource was not found")
)
View Source
var DefaultEC2MetadataClient = func() (EC2Metadata, error) {
	cfg, err := config.LoadDefaultConfig(context.Background())
	if err != nil {
		return nil, err
	}
	svc := imds.NewFromConfig(cfg)
	return &imdsClient{svc}, nil
}
View Source
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

This section is empty.

Types

type Cloud

type Cloud interface {
	CreateFileSystem(ctx context.Context, volumeName string, fileSystemOptions *FileSystemOptions) (fs *FileSystem, err error)
	ResizeFileSystem(ctx context.Context, fileSystemId string, newSizeGiB int32) (int32, error)
	DeleteFileSystem(ctx context.Context, fileSystemId string) (err error)
	DescribeFileSystem(ctx context.Context, fileSystemId string) (fs *FileSystem, err error)
	WaitForFileSystemAvailable(ctx context.Context, fileSystemId string) error
	WaitForFileSystemResize(ctx context.Context, fileSystemId string, resizeGiB int32) error
}

func NewCloud

func NewCloud(region string) (Cloud, error)

NewCloud returns a new instance of AWS cloud It panics if config is invalid

type EC2MetadataClient added in v0.10.0

type EC2MetadataClient func() (EC2Metadata, error)

type FSx

FSx abstracts FSx client to facilitate its mocking.

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, volumeName string, fileSystemOptions *FileSystemOptions) (fs *FileSystem, err error)

func (*FakeCloudProvider) DeleteFileSystem

func (c *FakeCloudProvider) DeleteFileSystem(ctx context.Context, volumeID string) (err error)

func (*FakeCloudProvider) DescribeFileSystem

func (c *FakeCloudProvider) DescribeFileSystem(ctx context.Context, volumeID string) (fs *FileSystem, err error)

func (*FakeCloudProvider) GetMetadata

func (c *FakeCloudProvider) GetMetadata() MetadataService

func (*FakeCloudProvider) ResizeFileSystem

func (c *FakeCloudProvider) ResizeFileSystem(ctx context.Context, volumeName string, newSizeGiB int32) (int32, error)

func (*FakeCloudProvider) WaitForFileSystemAvailable

func (c *FakeCloudProvider) WaitForFileSystemAvailable(ctx context.Context, fileSystemId string) error

func (*FakeCloudProvider) WaitForFileSystemResize

func (c *FakeCloudProvider) WaitForFileSystemResize(ctx context.Context, fileSystemId string, resizeGiB int32) error

type FileSystem

type FileSystem struct {
	FileSystemId             string
	CapacityGiB              int32
	DnsName                  string
	MountName                string
	StorageType              string
	DeploymentType           string
	PerUnitStorageThroughput int32
}

FileSystem represents a FSx for Lustre filesystem

type FileSystemOptions

type FileSystemOptions struct {
	CapacityGiB                   int32
	SubnetId                      string
	SecurityGroupIds              []string
	AutoImportPolicy              string
	S3ImportPath                  string
	S3ExportPath                  string
	DeploymentType                string
	KmsKeyId                      string
	PerUnitStorageThroughput      int32
	StorageType                   string
	DriveCacheType                string
	DailyAutomaticBackupStartTime string
	AutomaticBackupRetentionDays  int32
	CopyTagsToBackups             bool
	DataCompressionType           string
	WeeklyMaintenanceStartTime    string
	FileSystemTypeVersion         string
	ExtraTags                     []string
	EfaEnabled                    bool
	MetadataConfigurationMode     string
	MetadataIops                  int32
}

FileSystemOptions represents the options to create FSx for Lustre filesystem

type KubernetesAPIClient added in v0.10.0

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

type Metadata added in v0.10.0

type Metadata struct {
	InstanceID       string
	InstanceType     string
	Region           string
	AvailabilityZone string
}

func EC2MetadataInstanceInfo added in v0.10.0

func EC2MetadataInstanceInfo(svc EC2Metadata, regionFromSession string) (*Metadata, error)

func KubernetesAPIInstanceInfo added in v0.10.0

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

func (*Metadata) GetAvailabilityZone added in v0.10.0

func (m *Metadata) GetAvailabilityZone() string

GetAvailabilityZone returns the Availability Zone which the instance is in.

func (*Metadata) GetInstanceID added in v0.10.0

func (m *Metadata) GetInstanceID() string

GetInstanceID returns the instance identification.

func (*Metadata) GetInstanceType added in v0.10.0

func (m *Metadata) GetInstanceType() string

GetInstanceType returns the instance type.

func (*Metadata) GetRegion added in v0.10.0

func (m *Metadata) GetRegion() string

GetRegion returns the Region Zone which the instance is in.

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.

Directories

Path Synopsis
Package mock_cloud is a generated GoMock package.
Package mock_cloud is a generated GoMock package.

Jump to

Keyboard shortcuts

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