ami

package
v0.44.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2021 License: Apache-2.0 Imports: 12 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(ec2api ec2iface.EC2API, 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, imageFamily, amiType string) (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(ec2api ec2iface.EC2API, 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(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(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(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 ec2iface.EC2API) Resolver

NewAutoResolver creates a new AutoResolver

func NewSSMResolver

func NewSSMResolver(api ssmiface.SSMAPI) 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(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