ami

package
v0.159.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: Apache-2.0 Imports: 16 Imported by: 6

Documentation

Index

Constants

View Source
const (
	ImageClassGeneral = iota
	ImageClassGPU
	ImageClassARM
)

Variations of image classes

Variables

View Source
var ImageClasses = []string{
	"ImageClassGeneral",
	"ImageClassGPU",
	"ImageClassARM",
}

ImageClasses is a list of image class names

Functions

func FindImage

func FindImage(ctx context.Context, ec2API awsapi.EC2, ownerAccount, namePattern string) (string, error)

FindImage will get the AMI to use for the EKS nodes by querying AWS EC2 API. It will only look for images with a status of available and it will pick the image with the newest creation date.

func MakeImageSearchPatterns

func MakeImageSearchPatterns(version string) map[string]map[int]string

MakeImageSearchPatterns creates a map of image search patterns by image OS family and class

func MakeManagedSSMParameterName

func MakeManagedSSMParameterName(version string, amiType ekstypes.AMITypes) (string, error)

MakeManagedSSMParameterName creates an SSM parameter name for a managed nodegroup

func MakeSSMParameterName

func MakeSSMParameterName(version, instanceType, imageFamily string) (string, error)

MakeSSMParameterName creates an SSM parameter name

func OwnerAccountID

func OwnerAccountID(imageFamily, region string) (string, error)

OwnerAccountID returns the AWS account ID that owns worker AMI.

func Use

func Use(ctx context.Context, ec2API awsapi.EC2, ng *api.NodeGroupBase) error

Use checks if a given AMI ID is available in AWS EC2 as well as checking and populating RootDevice information

Types

type AutoResolver

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

AutoResolver resolves the AMi to the defaults for the region by querying AWS EC2 API for the AMI to use

func (*AutoResolver) Resolve

func (r *AutoResolver) Resolve(ctx context.Context, region, version, instanceType, imageFamily string) (string, error)

Resolve will return an AMI to use based on the default AMI for each region

type ErrFailedResolution

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

ErrFailedResolution is an error type that represents failure to resolve a region/instance type/image family to an AMI

func NewErrFailedResolution

func NewErrFailedResolution(region, version, instanceType, imageFamily string) *ErrFailedResolution

NewErrFailedResolution creates a new instance of ErrFailedResolution for a give region, instance type and image family

func (*ErrFailedResolution) Error

func (e *ErrFailedResolution) Error() string

Error return the error message

type ErrNotFound

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

ErrNotFound is an error type that represents failure to find a given ami

func NewErrNotFound

func NewErrNotFound(ami string) *ErrNotFound

NewErrNotFound creates a new instance of ErrNotFound for a given ami

func (*ErrNotFound) Error

func (e *ErrNotFound) Error() string

Error return the error message

type MultiResolver

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

MultiResolver is a Resolver that delegates to one or more Resolvers. It iterates over the delegate resolvers and returns the first AMI found

func NewMultiResolver

func NewMultiResolver(delegates ...Resolver) *MultiResolver

NewMultiResolver creates and returns a MultiResolver with the specified delegates

func (*MultiResolver) Resolve

func (r *MultiResolver) Resolve(ctx context.Context, region, version, instanceType, imageFamily string) (string, error)

Resolve will resolve an AMI from the supplied region and instance type. It will invoke a specific resolver to do the actual determining of AMI.

type Resolver

type Resolver interface {
	Resolve(ctx context.Context, region, version, instanceType, imageFamily string) (string, error)
}

Resolver provides an interface to enable implementing multiple ways to determine which AMI to use from the region/instance type/image family.

func NewAutoResolver

func NewAutoResolver(api awsapi.EC2) Resolver

NewAutoResolver creates a new AutoResolver

func NewSSMResolver

func NewSSMResolver(api awsapi.SSM) Resolver

NewSSMResolver creates a new AutoResolver.

type SSMResolver

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

SSMResolver resolves the AMI to the defaults for the region by querying AWS SSM get parameter API

func (*SSMResolver) Resolve

func (r *SSMResolver) Resolve(ctx context.Context, region, version, instanceType, imageFamily string) (string, error)

Resolve will return an AMI to use based on the default AMI for each region

type UnsupportedQueryError

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

UnsupportedQueryError represents an unsupported AMI query error

func (*UnsupportedQueryError) Error

func (ue *UnsupportedQueryError) Error() string

Error returns the error string

Jump to

Keyboard shortcuts

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