cloudprovider

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: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudProvider

type CloudProvider interface {
	// Create a node given constraints and instance type options. This API uses a
	// callback pattern to enable cloudproviders to batch capacity creation
	// requests. The callback must be called with a theoretical node object that
	// is fulfilled by the cloud providers capacity creation request.
	Create(context.Context, *NodeRequest) (*v1.Node, error)
	// Delete node in cloudprovider
	Delete(context.Context, *v1.Node) error
	// GetInstanceTypes returns instance types supported by the cloudprovider.
	// Availability of types or zone may vary by provisioner or over time.  Regardless of
	// availability, the GetInstanceTypes method should always return all instance types,
	// even those with no offerings available.
	GetInstanceTypes(context.Context, *v1alpha5.Provisioner) ([]InstanceType, error)
	// Name returns the CloudProvider implementation name.
	Name() string
}

CloudProvider interface is implemented by cloud providers to support provisioning.

type InstanceType

type InstanceType interface {
	// Name of the instance type, must correspond to v1.LabelInstanceTypeStable
	Name() string
	// Requirements returns a flexible set of properties that may be selected
	// for scheduling. Must be defined for every well known label, even if empty.
	Requirements() scheduling.Requirements
	// Note that though this is an array it is expected that all the Offerings are unique from one another
	Offerings() []Offering
	// Resources are the full allocatable resource capacities for this instance type
	Resources() v1.ResourceList
	// Overhead is the amount of resource overhead expected to be used by kubelet and any other system daemons outside
	// of Kubernetes.
	Overhead() v1.ResourceList
}

InstanceType describes the properties of a potential node (either concrete attributes of an instance of this type or supported options in the case of arrays)

type NodeRequest added in v0.8.0

type NodeRequest struct {
	Template            *scheduling.NodeTemplate
	InstanceTypeOptions []InstanceType
}

type Offering

type Offering struct {
	CapacityType string
	Zone         string
	Price        float64
	// Available is added so that Offerings() can return all offerings that have ever existed for an instance type
	// so we can get historical pricing data for calculating savings in consolidation
	Available bool
}

An Offering describes where an InstanceType is available to be used, with the expectation that its properties may be tightly coupled (e.g. the availability of an instance type in some zone is scoped to a capacity type)

func AvailableOfferings added in v0.16.1

func AvailableOfferings(it InstanceType) []Offering

AvailableOfferings filters the offerings on the passed instance type and returns the offerings marked as available

func GetOffering added in v0.16.1

func GetOffering(it InstanceType, ct, zone string) (Offering, bool)

GetOffering gets the offering from passed instance type that matches the passed zone and capacity type

type Options

type Options struct {
	ClientSet  *kubernetes.Clientset
	KubeClient client.Client
	// WebhookOnly is true if the cloud provider is being used for its validation/defaulting only by the webhook. In
	// this case it may not need to perform some initialization and the StartAsync channel will not be closed.
	WebhookOnly bool
	// StartAsync is a channel that is closed when leader election has been won.  This is a signal to start any  async
	// processing that should only occur while the cloud provider is the leader.
	StartAsync <-chan struct{}
}

Options are injected into cloud providers' factories

Directories

Path Synopsis
aws
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