ami

package
v0.0.0-...-b3ee267 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultImageFamily = ImageFamilyAmazonLinux2

	ImageFamilyAmazonLinux2 = "AmazonLinux2"

	// ResolverStatic is used to indicate that the static (i.e. compiled into eksctl) AMIs should be used
	ResolverStatic = "static"
	// ResolverAuto is used to indicate that the latest EKS AMIs should be used for the nodes. This implies
	// that automatic resolution of AMI will occur.
	ResolverAuto = "auto"
)
View Source
const (
	ImageClassGeneral int = iota
	ImageClassGPU
)

Variables

View Source
var (
	// DefaultResolvers contains a list of resolvers to try in order
	DefaultResolvers = []Resolver{&StaticGPUResolver{}, &StaticDefaultResolver{}}
)
View Source
var ImageSearchPatterns = map[string]map[int]string{
	ImageFamilyAmazonLinux2: {
		ImageClassGeneral: "amazon-eks-node-*",
		ImageClassGPU:     "amazon-eks-gpu-node-*",
	},
}

ImageSearchPatterns is a map of image search patterns by image OS family and by class

View Source
var StaticImages = map[string]map[int]map[string]string{
	ImageFamilyAmazonLinux2: {
		ImageClassGeneral: {
			"eu-west-1": "ami-0c7a4976cb6fafd3a",
			"us-east-1": "ami-0440e4f6b9713faf6",
			"us-west-2": "ami-0a54c984b9f908c81",
		},
		ImageClassGPU: {
			"eu-west-1": "ami-0706dc8a5eed2eed9",
			"us-east-1": "ami-058bfb8c236caae89",
			"us-west-2": "ami-0731694d53ef9604b",
		},
	},
}

StaticImages is a map that holds the list of amis to be used by for static ami resolution

Functions

func FindImage

func FindImage(api ec2iface.EC2API, 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 IsAvailable

func IsAvailable(api ec2iface.EC2API, id string) (bool, error)

IsAvailable checks if a given AMI ID is available in AWS EC2

func Resolve

func Resolve(region string, instanceType 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.

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 NewAutoResolver

func NewAutoResolver(api ec2iface.EC2API) *AutoResolver

NewAutoResolver creates a new AutoResolver

func (*AutoResolver) Resolve

func (r *AutoResolver) Resolve(region string, instanceType 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 to an AMI

func NewErrFailedResolution

func NewErrFailedResolution(region string, instanceType string) *ErrFailedResolution

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

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 Resolver

type Resolver interface {
	Resolve(region string, instanceType string) (string, error)
}

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

type StaticDefaultResolver

type StaticDefaultResolver struct {
}

StaticDefaultResolver resolves the AMI to the defaults for the region

func (*StaticDefaultResolver) Resolve

func (r *StaticDefaultResolver) Resolve(region string, instanceType string) (string, error)

Resolve will return an AMI to use based on the default AMI for each region currently source of truth for these is here

type StaticGPUResolver

type StaticGPUResolver struct {
}

StaticGPUResolver resolves the AMI for GPU instances types.

func (*StaticGPUResolver) Resolve

func (r *StaticGPUResolver) Resolve(region string, instanceType string) (string, error)

Resolve will return an AMI based on the region for GPU instance types

Jump to

Keyboard shortcuts

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