Documentation
¶
Index ¶
- Constants
- Variables
- func FindImage(api ec2iface.EC2API, namePattern string) (string, error)
- func IsAvailable(api ec2iface.EC2API, id string) (bool, error)
- func Resolve(region string, instanceType string) (string, error)
- type AutoResolver
- type ErrFailedResolution
- type ErrNotFound
- type Resolver
- type StaticDefaultResolver
- type StaticGPUResolver
Constants ¶
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" )
const ( ImageClassGeneral int = iota ImageClassGPU )
Variables ¶
var ( // DefaultResolvers contains a list of resolvers to try in order DefaultResolvers = []Resolver{&StaticGPUResolver{}, &StaticDefaultResolver{}} )
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
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 ¶
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 ¶
IsAvailable checks if a given AMI ID is available in AWS EC2
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
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
type Resolver ¶
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
type StaticGPUResolver ¶
type StaticGPUResolver struct { }
StaticGPUResolver resolves the AMI for GPU instances types.