Documentation
¶
Index ¶
- Constants
- func UnavailableOfferingsCacheKey(instanceType string, zone string, capacityType string) string
- type CloudProvider
- func (c *CloudProvider) Create(ctx context.Context, nodeRequest *cloudprovider.NodeRequest) (*v1.Node, error)
- func (c *CloudProvider) Default(ctx context.Context, provisioner *v1alpha5.Provisioner)
- func (c *CloudProvider) Delete(ctx context.Context, node *v1.Node) error
- func (c *CloudProvider) GetInstanceTypes(ctx context.Context, provider *v1alpha5.Provider) ([]cloudprovider.InstanceType, error)
- func (c *CloudProvider) Name() string
- func (c *CloudProvider) Validate(ctx context.Context, provisioner *v1alpha5.Provisioner) *apis.FieldError
- type InstanceProvider
- type InstanceType
- type InstanceTypeProvider
- type LaunchTemplateProvider
- type SecurityGroupProvider
- type SubnetProvider
Constants ¶
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 )
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 )
const ( InstanceTypesCacheKey = "types" InstanceTypeZonesCacheKey = "zones" InstanceTypesAndZonesCacheTTL = 5 * time.Minute UnfulfillableCapacityErrorCacheTTL = 3 * time.Minute )
const EC2VMAvailableMemoryFactor = .925
EC2VMAvailableMemoryFactor assumes the EC2 VM will consume <7.25% of the memory of a given machine
Variables ¶
This section is empty.
Functions ¶
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 (c *CloudProvider) Default(ctx context.Context, provisioner *v1alpha5.Provisioner)
Default the provisioner
func (*CloudProvider) GetInstanceTypes ¶
func (c *CloudProvider) GetInstanceTypes(ctx context.Context, provider *v1alpha5.Provider) ([]cloudprovider.InstanceType, error)
GetInstanceTypes returns all available InstanceTypes
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, provisioner *v1alpha5.Provisioner) *apis.FieldError
Validate the provisioner
type InstanceProvider ¶
type InstanceProvider struct {
// contains filtered or unexported fields
}
func NewInstanceProvider ¶ added in v0.7.0
func NewInstanceProvider(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
type InstanceType ¶
type InstanceType struct {
*ec2.InstanceTypeInfo
// contains filtered or unexported fields
}
func (*InstanceType) Name ¶
func (i *InstanceType) Name() string
func (*InstanceType) Offerings ¶
func (i *InstanceType) Offerings() []cloudprovider.Offering
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) Price ¶ added in v0.7.3
func (i *InstanceType) Price() float64
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 ¶
func NewInstanceTypeProvider ¶
func NewInstanceTypeProvider(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 ¶
func (p *InstanceTypeProvider) Get(ctx context.Context, provider *v1alpha1.AWS) ([]cloudprovider.InstanceType, error)
Get all instance type options
type LaunchTemplateProvider ¶
func NewLaunchTemplateProvider ¶
func NewLaunchTemplateProvider(ctx context.Context, ec2api ec2iface.EC2API, clientSet *kubernetes.Clientset, amiFamily *amifamily.Resolver, securityGroupProvider *SecurityGroupProvider, caBundle *string) *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)
type SecurityGroupProvider ¶
func NewSecurityGroupProvider ¶
func NewSecurityGroupProvider(ec2api ec2iface.EC2API) *SecurityGroupProvider
type SubnetProvider ¶
func NewSubnetProvider ¶
func NewSubnetProvider(ec2api ec2iface.EC2API) *SubnetProvider