aws

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2022 License: Apache-2.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CreationQPS limits the number of requests per second to CreateFleet
	// https://docs.aws.amazon.com/AWSEC2/latest/APIReference/throttling.html#throttling-limits
	CreationQPS = 2
	// CreationBurst limits the additional burst requests.
	// https://docs.aws.amazon.com/AWSEC2/latest/APIReference/throttling.html#throttling-limits
	CreationBurst = 100
	// CacheTTL restricts QPS to AWS APIs to this interval for verifying setup
	// resources. This value represents the maximum eventual consistency between
	// AWS actual state and the controller's ability to provision those
	// resources. Cache hits enable faster provisioning and reduced API load on
	// AWS APIs, which can have a serious impact on performance and scalability.
	// DO NOT CHANGE THIS VALUE WITHOUT DUE CONSIDERATION
	CacheTTL = 60 * time.Second
	// CacheCleanupInterval triggers cache cleanup (lazy eviction) at this interval.
	CacheCleanupInterval = 10 * time.Minute
)
View Source
const (
	InstanceTypesCacheKey                         = "types"
	InstanceTypeZonesCacheKey                     = "zones"
	InstanceTypesAndZonesCacheTTL                 = 5 * time.Minute
	InsufficientCapacityErrorCacheTTL             = 45 * time.Second
	InsufficientCapacityErrorCacheCleanupInterval = 5 * time.Minute
)
View Source
const EC2VMAvailableMemoryFactor = .925

EC2VMAvailableMemoryFactor assumes the EC2 VM will consume <7.25% of the memory of a given machine

View Source
const InsufficientCapacityErrorCode = "InsufficientInstanceCapacity"

InsufficientCapacityErrorCode indicates that EC2 is temporarily lacking capacity for this instance type and availability zone combination

Variables

This section is empty.

Functions

func UnavailableOfferingsCacheKey

func UnavailableOfferingsCacheKey(capacityType string, instanceType string, zone string) string

Types

type AMIProvider

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

func NewAMIProvider

func NewAMIProvider(ssm ssmiface.SSMAPI, clientSet *kubernetes.Clientset) *AMIProvider

func (*AMIProvider) Get

func (p *AMIProvider) Get(ctx context.Context, constraints *v1alpha1.Constraints, instanceTypes []cloudprovider.InstanceType) (map[string][]cloudprovider.InstanceType, error)

Get returns a set of AMIIDs and corresponding instance types. AMI may vary due to architecture, accelerator, etc

type CloudProvider

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

func NewCloudProvider

func NewCloudProvider(ctx context.Context, options cloudprovider.Options) *CloudProvider

func (*CloudProvider) Create

func (c *CloudProvider) Create(ctx context.Context, constraints *v1alpha5.Constraints, instanceTypes []cloudprovider.InstanceType, quantity int, callback func(*v1.Node) error) error

Create a node given the constraints.

func (*CloudProvider) Default

func (c *CloudProvider) Default(ctx context.Context, constraints *v1alpha5.Constraints)

Default the provisioner

func (*CloudProvider) Delete

func (c *CloudProvider) Delete(ctx context.Context, node *v1.Node) error

func (*CloudProvider) GetInstanceTypes

func (c *CloudProvider) GetInstanceTypes(ctx context.Context, provider *v1alpha5.Provider) ([]cloudprovider.InstanceType, error)

GetInstanceTypes returns all available InstanceTypes despite accepting a Constraints struct (note that it does not utilize Requirements)

func (*CloudProvider) Name added in v0.5.3

func (c *CloudProvider) Name() string

Name returns the CloudProvider implementation name.

func (*CloudProvider) Validate

func (c *CloudProvider) Validate(ctx context.Context, constraints *v1alpha5.Constraints) *apis.FieldError

Validate the provisioner

type InstanceProvider

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

func (*InstanceProvider) Create

func (p *InstanceProvider) Create(ctx context.Context, constraints *v1alpha1.Constraints, instanceTypes []cloudprovider.InstanceType, quantity int) ([]*v1.Node, error)

Create an instance given the constraints. instanceTypes should be sorted by priority for spot capacity type. If spot is not used, the instanceTypes are not required to be sorted because we are using ec2 fleet's lowest-price OD allocation strategy

func (*InstanceProvider) Terminate

func (p *InstanceProvider) Terminate(ctx context.Context, node *v1.Node) error

type InstanceType

type InstanceType struct {
	ec2.InstanceTypeInfo
	AvailableOfferings []cloudprovider.Offering
	MaxPods            *int32
}

func (*InstanceType) AMDGPUs

func (i *InstanceType) AMDGPUs() *resource.Quantity

func (*InstanceType) AWSNeurons

func (i *InstanceType) AWSNeurons() *resource.Quantity

func (*InstanceType) AWSPodENI added in v0.5.2

func (i *InstanceType) AWSPodENI() *resource.Quantity

func (*InstanceType) Architecture

func (i *InstanceType) Architecture() string

func (*InstanceType) CPU

func (i *InstanceType) CPU() *resource.Quantity

func (*InstanceType) Memory

func (i *InstanceType) Memory() *resource.Quantity

func (*InstanceType) Name

func (i *InstanceType) Name() string

func (*InstanceType) NvidiaGPUs

func (i *InstanceType) NvidiaGPUs() *resource.Quantity

func (*InstanceType) Offerings

func (i *InstanceType) Offerings() []cloudprovider.Offering

func (*InstanceType) OperatingSystems added in v0.5.2

func (i *InstanceType) OperatingSystems() sets.String

func (*InstanceType) Overhead

func (i *InstanceType) Overhead() v1.ResourceList

Overhead computes overhead for https://kubernetes.io/docs/tasks/administer-cluster/reserve-compute-resources/#node-allocatable using calculations copied from https://github.com/bottlerocket-os/bottlerocket#kubernetes-settings. While this doesn't calculate the correct overhead for non-ENI-limited nodes, we're using this approach until further analysis can be performed

func (*InstanceType) Pods

func (i *InstanceType) Pods() *resource.Quantity

type InstanceTypeProvider

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

func NewInstanceTypeProvider

func NewInstanceTypeProvider(ec2api ec2iface.EC2API, subnetProvider *SubnetProvider) *InstanceTypeProvider

func (*InstanceTypeProvider) CacheUnavailable

func (p *InstanceTypeProvider) CacheUnavailable(ctx context.Context, instanceType string, zone string, capacityType string)

CacheUnavailable allows the InstanceProvider to communicate recently observed temporary capacity shortages in the provided offerings

func (*InstanceTypeProvider) Get

Get all instance type options (the constraints are only used for tag filtering on subnets, not for Requirements filtering)

type LaunchTemplateProvider

type LaunchTemplateProvider struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewLaunchTemplateProvider

func NewLaunchTemplateProvider(ctx context.Context, ec2api ec2iface.EC2API, amiProvider *AMIProvider, securityGroupProvider *SecurityGroupProvider) *LaunchTemplateProvider

func (*LaunchTemplateProvider) Get

func (p *LaunchTemplateProvider) Get(ctx context.Context, constraints *v1alpha1.Constraints, instanceTypes []cloudprovider.InstanceType, additionalLabels map[string]string) (map[string][]cloudprovider.InstanceType, error)

func (*LaunchTemplateProvider) GetCABundle

func (p *LaunchTemplateProvider) GetCABundle(ctx context.Context) (*string, error)

type SecurityGroupProvider

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

func NewSecurityGroupProvider

func NewSecurityGroupProvider(ec2api ec2iface.EC2API) *SecurityGroupProvider

func (*SecurityGroupProvider) Get

func (s *SecurityGroupProvider) Get(ctx context.Context, constraints *v1alpha1.Constraints) ([]string, error)

type SubnetProvider

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

func NewSubnetProvider

func NewSubnetProvider(ec2api ec2iface.EC2API) *SubnetProvider

func (*SubnetProvider) Get

func (s *SubnetProvider) Get(ctx context.Context, constraints *v1alpha1.AWS) ([]*ec2.Subnet, error)

Directories

Path Synopsis
apis
v1alpha1
+k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:defaulter-gen=TypeMeta +groupName=karpenter.k8s.aws
+k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:defaulter-gen=TypeMeta +groupName=karpenter.k8s.aws

Jump to

Keyboard shortcuts

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