aws

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2022 License: Apache-2.0 Imports: 56 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 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
	// MaxInstanceTypes defines the number of instance type options to pass to CreateFleet
	MaxInstanceTypes = 20
)
View Source
const (
	InstanceTypesCacheKey              = "types"
	InstanceTypeZonesCacheKeyPrefix    = "zones:"
	InstanceTypesAndZonesCacheTTL      = 5 * time.Minute
	UnfulfillableCapacityErrorCacheTTL = 3 * time.Minute
)

Variables

View Source
var Limits = map[string]*VPCLimits{}/* 535 elements not displayed */

VPC Limits and flags for ENI and IPv4 Addresses

Functions

func NewPricingAPI added in v0.13.0

func NewPricingAPI(sess *session.Session, region string) pricingiface.PricingAPI

NewPricingAPI returns a pricing API configured based on a particular region

func UnavailableOfferingsCacheKey

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

Types

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, nodeRequest *cloudprovider.NodeRequest) (*v1.Node, error)

Create a node given the constraints.

func (*CloudProvider) Default

func (*CloudProvider) Default(ctx context.Context, provisioner *v1alpha5.Provisioner)

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, provisioner *v1alpha5.Provisioner) ([]cloudprovider.InstanceType, error)

GetInstanceTypes returns all available InstanceTypes

func (*CloudProvider) LivenessProbe added in v0.16.1

func (c *CloudProvider) LivenessProbe(req *http.Request) error

func (*CloudProvider) Name added in v0.5.3

func (c *CloudProvider) Name() string

Name returns the CloudProvider implementation name.

func (*CloudProvider) Validate

func (*CloudProvider) Validate(ctx context.Context, provisioner *v1alpha5.Provisioner) *apis.FieldError

Validate the provisioner

type CreateFleetBatcher added in v0.14.0

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

CreateFleetBatcher is used to batch CreateFleet calls from the cloud provider with identical parameters into a single call that launches more instances simultaneously.

func NewCreateFleetBatcher added in v0.14.0

func NewCreateFleetBatcher(ctx context.Context, ec2api ec2iface.EC2API) *CreateFleetBatcher

func (*CreateFleetBatcher) CreateFleet added in v0.14.0

func (b *CreateFleetBatcher) CreateFleet(ctx context.Context, createFleetInput *ec2.CreateFleetInput) (*ec2.CreateFleetOutput, error)

type InstanceProvider

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

func NewInstanceProvider added in v0.7.0

func NewInstanceProvider(ctx context.Context, ec2api ec2iface.EC2API, instanceTypeProvider *InstanceTypeProvider, subnetProvider *SubnetProvider, launchTemplateProvider *LaunchTemplateProvider) *InstanceProvider

func (*InstanceProvider) Create

func (p *InstanceProvider) Create(ctx context.Context, provider *v1alpha1.AWS, nodeRequest *cloudprovider.NodeRequest) (*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 InstanceTerminatedError added in v0.14.0

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

type InstanceType

type InstanceType struct {
	*ec2.InstanceTypeInfo
	// contains filtered or unexported fields
}

func NewInstanceType added in v0.12.0

func NewInstanceType(ctx context.Context, info *ec2.InstanceTypeInfo, kc *v1alpha5.KubeletConfiguration, region string, provider *v1alpha1.AWS, offerings []cloudprovider.Offering) *InstanceType

func (*InstanceType) Name

func (i *InstanceType) Name() string

func (*InstanceType) Offerings

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

func (*InstanceType) Requirements added in v0.11.0

func (i *InstanceType) Requirements() scheduling.Requirements

func (*InstanceType) Resources added in v0.7.3

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

type InstanceTypeProvider

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

func NewInstanceTypeProvider

func NewInstanceTypeProvider(ctx context.Context, sess *session.Session, options cloudprovider.Options, ec2api ec2iface.EC2API, subnetProvider *SubnetProvider) *InstanceTypeProvider

func (*InstanceTypeProvider) CacheUnavailable

func (p *InstanceTypeProvider) CacheUnavailable(ctx context.Context, fleetErr *ec2.CreateFleetError, 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

func (*InstanceTypeProvider) LivenessProbe added in v0.16.1

func (p *InstanceTypeProvider) LivenessProbe(req *http.Request) error

type LaunchTemplateProvider

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

func NewLaunchTemplateProvider

func NewLaunchTemplateProvider(ctx context.Context, ec2api ec2iface.EC2API, clientSet *kubernetes.Clientset, amiFamily *amifamily.Resolver, securityGroupProvider *SecurityGroupProvider, caBundle *string, startAsync <-chan struct{}) *LaunchTemplateProvider

func (*LaunchTemplateProvider) Get

func (p *LaunchTemplateProvider) Get(ctx context.Context, provider *v1alpha1.AWS, nodeRequest *cloudprovider.NodeRequest, additionalLabels map[string]string) (map[string][]cloudprovider.InstanceType, error)

func (*LaunchTemplateProvider) Invalidate added in v0.13.0

func (p *LaunchTemplateProvider) Invalidate(ctx context.Context, ltName string)

Invalidate deletes a launch template from cache if it exists

type PricingProvider added in v0.13.0

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

PricingProvider provides actual pricing data to the AWS cloud provider to allow it to make more informed decisions regarding which instances to launch. This is initialized at startup with a periodically updated static price list to support running in locations where pricing data is unavailable. In those cases the static pricing data provides a relative ordering that is still more accurate than our previous pricing model. In the event that a pricing update fails, the previous pricing information is retained and used which may be the static initial pricing data if pricing updates never succeed.

func NewPricingProvider added in v0.13.0

func NewPricingProvider(ctx context.Context, pricing pricingiface.PricingAPI, ec2Api ec2iface.EC2API, region string, isolatedVPC bool, startAsync <-chan struct{}) *PricingProvider

func (*PricingProvider) InstanceTypes added in v0.13.0

func (p *PricingProvider) InstanceTypes() []string

InstanceTypes returns the list of all instance types for which either a spot or on-demand price is known.

func (*PricingProvider) LivenessProbe added in v0.16.1

func (p *PricingProvider) LivenessProbe(req *http.Request) error

func (*PricingProvider) OnDemandLastUpdated added in v0.13.2

func (p *PricingProvider) OnDemandLastUpdated() time.Time

OnDemandLastUpdated returns the time that the on-demand pricing was last updated

func (*PricingProvider) OnDemandPrice added in v0.13.0

func (p *PricingProvider) OnDemandPrice(instanceType string) (float64, bool)

OnDemandPrice returns the last known on-demand price for a given instance type, returning an error if there is no known on-demand pricing for the instance type.

func (*PricingProvider) SpotLastUpdated added in v0.13.2

func (p *PricingProvider) SpotLastUpdated() time.Time

SpotLastUpdated returns the time that the spot pricing was last updated

func (*PricingProvider) SpotPrice added in v0.13.0

func (p *PricingProvider) SpotPrice(instanceType string, zone string) (float64, bool)

SpotPrice returns the last known spot price for a given instance type and zone, returning an error if there is no known spot pricing for that instance type or zone

type SecurityGroupProvider

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

func NewSecurityGroupProvider

func NewSecurityGroupProvider(ec2api ec2iface.EC2API) *SecurityGroupProvider

func (*SecurityGroupProvider) Get

func (p *SecurityGroupProvider) Get(ctx context.Context, provider *v1alpha1.AWS) ([]string, error)

type SubnetProvider

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

func NewSubnetProvider

func NewSubnetProvider(ec2api ec2iface.EC2API) *SubnetProvider

func (*SubnetProvider) Get

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

func (*SubnetProvider) LivenessProbe added in v0.16.1

func (p *SubnetProvider) LivenessProbe(req *http.Request) error

type VPCLimits added in v0.14.0

type VPCLimits struct {
	Interface            int
	IPv4PerInterface     int
	IsTrunkingCompatible bool
	BranchInterface      int
}

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