aws

package
v0.0.0-...-73e42e7 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2020 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InstanceTypes = map[string]*instanceType{
	"c1.medium": {
		InstanceType: "c1.medium",
		VCPU:         2,
		MemoryMb:     1740,
		GPU:          0,
	},
	"c1.xlarge": {
		InstanceType: "c1.xlarge",
		VCPU:         8,
		MemoryMb:     7168,
		GPU:          0,
	},
	"c3": {
		InstanceType: "c3",
		VCPU:         32,
		MemoryMb:     0,
		GPU:          0,
	},
	"c3.2xlarge": {
		InstanceType: "c3.2xlarge",
		VCPU:         8,
		MemoryMb:     15360,
		GPU:          0,
	},
	"c3.4xlarge": {
		InstanceType: "c3.4xlarge",
		VCPU:         16,
		MemoryMb:     30720,
		GPU:          0,
	},
	"c3.8xlarge": {
		InstanceType: "c3.8xlarge",
		VCPU:         32,
		MemoryMb:     61440,
		GPU:          0,
	},
	"c3.large": {
		InstanceType: "c3.large",
		VCPU:         2,
		MemoryMb:     3840,
		GPU:          0,
	},
	"c3.xlarge": {
		InstanceType: "c3.xlarge",
		VCPU:         4,
		MemoryMb:     7680,
		GPU:          0,
	},
	"c4": {
		InstanceType: "c4",
		VCPU:         36,
		MemoryMb:     0,
		GPU:          0,
	},
	"c4.2xlarge": {
		InstanceType: "c4.2xlarge",
		VCPU:         8,
		MemoryMb:     15360,
		GPU:          0,
	},
	"c4.4xlarge": {
		InstanceType: "c4.4xlarge",
		VCPU:         16,
		MemoryMb:     30720,
		GPU:          0,
	},
	"c4.8xlarge": {
		InstanceType: "c4.8xlarge",
		VCPU:         36,
		MemoryMb:     61440,
		GPU:          0,
	},
	"c4.large": {
		InstanceType: "c4.large",
		VCPU:         2,
		MemoryMb:     3840,
		GPU:          0,
	},
	"c4.xlarge": {
		InstanceType: "c4.xlarge",
		VCPU:         4,
		MemoryMb:     7680,
		GPU:          0,
	},
	"cc1.4xlarge": {
		InstanceType: "cc1.4xlarge",
		VCPU:         16,
		MemoryMb:     23552,
		GPU:          0,
	},
	"cc2.8xlarge": {
		InstanceType: "cc2.8xlarge",
		VCPU:         32,
		MemoryMb:     61952,
		GPU:          0,
	},
	"cg1.4xlarge": {
		InstanceType: "cg1.4xlarge",
		VCPU:         16,
		MemoryMb:     23040,
		GPU:          0,
	},
	"cr1.8xlarge": {
		InstanceType: "cr1.8xlarge",
		VCPU:         32,
		MemoryMb:     249856,
		GPU:          0,
	},
	"d2": {
		InstanceType: "d2",
		VCPU:         36,
		MemoryMb:     0,
		GPU:          0,
	},
	"d2.2xlarge": {
		InstanceType: "d2.2xlarge",
		VCPU:         8,
		MemoryMb:     62464,
		GPU:          0,
	},
	"d2.4xlarge": {
		InstanceType: "d2.4xlarge",
		VCPU:         16,
		MemoryMb:     124928,
		GPU:          0,
	},
	"d2.8xlarge": {
		InstanceType: "d2.8xlarge",
		VCPU:         36,
		MemoryMb:     249856,
		GPU:          0,
	},
	"d2.xlarge": {
		InstanceType: "d2.xlarge",
		VCPU:         4,
		MemoryMb:     31232,
		GPU:          0,
	},
	"f1": {
		InstanceType: "f1",
		VCPU:         64,
		MemoryMb:     0,
		GPU:          0,
	},
	"f1.16xlarge": {
		InstanceType: "f1.16xlarge",
		VCPU:         64,
		MemoryMb:     999424,
		GPU:          0,
	},
	"f1.2xlarge": {
		InstanceType: "f1.2xlarge",
		VCPU:         8,
		MemoryMb:     124928,
		GPU:          0,
	},
	"g2": {
		InstanceType: "g2",
		VCPU:         32,
		MemoryMb:     0,
		GPU:          4,
	},
	"g2.2xlarge": {
		InstanceType: "g2.2xlarge",
		VCPU:         8,
		MemoryMb:     15360,
		GPU:          1,
	},
	"g2.8xlarge": {
		InstanceType: "g2.8xlarge",
		VCPU:         32,
		MemoryMb:     61440,
		GPU:          4,
	},
	"g3": {
		InstanceType: "g3",
		VCPU:         64,
		MemoryMb:     0,
		GPU:          4,
	},
	"g3.16xlarge": {
		InstanceType: "g3.16xlarge",
		VCPU:         64,
		MemoryMb:     499712,
		GPU:          4,
	},
	"g3.4xlarge": {
		InstanceType: "g3.4xlarge",
		VCPU:         16,
		MemoryMb:     124928,
		GPU:          1,
	},
	"g3.8xlarge": {
		InstanceType: "g3.8xlarge",
		VCPU:         32,
		MemoryMb:     249856,
		GPU:          2,
	},
	"hi1.4xlarge": {
		InstanceType: "hi1.4xlarge",
		VCPU:         16,
		MemoryMb:     61952,
		GPU:          0,
	},
	"hs1.8xlarge": {
		InstanceType: "hs1.8xlarge",
		VCPU:         17,
		MemoryMb:     119808,
		GPU:          0,
	},
	"i2": {
		InstanceType: "i2",
		VCPU:         32,
		MemoryMb:     0,
		GPU:          0,
	},
	"i2.2xlarge": {
		InstanceType: "i2.2xlarge",
		VCPU:         8,
		MemoryMb:     62464,
		GPU:          0,
	},
	"i2.4xlarge": {
		InstanceType: "i2.4xlarge",
		VCPU:         16,
		MemoryMb:     124928,
		GPU:          0,
	},
	"i2.8xlarge": {
		InstanceType: "i2.8xlarge",
		VCPU:         32,
		MemoryMb:     249856,
		GPU:          0,
	},
	"i2.xlarge": {
		InstanceType: "i2.xlarge",
		VCPU:         4,
		MemoryMb:     31232,
		GPU:          0,
	},
	"i3": {
		InstanceType: "i3",
		VCPU:         64,
		MemoryMb:     0,
		GPU:          0,
	},
	"i3.16xlarge": {
		InstanceType: "i3.16xlarge",
		VCPU:         64,
		MemoryMb:     499712,
		GPU:          0,
	},
	"i3.2xlarge": {
		InstanceType: "i3.2xlarge",
		VCPU:         8,
		MemoryMb:     62464,
		GPU:          0,
	},
	"i3.4xlarge": {
		InstanceType: "i3.4xlarge",
		VCPU:         16,
		MemoryMb:     124928,
		GPU:          0,
	},
	"i3.8xlarge": {
		InstanceType: "i3.8xlarge",
		VCPU:         32,
		MemoryMb:     249856,
		GPU:          0,
	},
	"i3.large": {
		InstanceType: "i3.large",
		VCPU:         2,
		MemoryMb:     15616,
		GPU:          0,
	},
	"i3.xlarge": {
		InstanceType: "i3.xlarge",
		VCPU:         4,
		MemoryMb:     31232,
		GPU:          0,
	},
	"m1.large": {
		InstanceType: "m1.large",
		VCPU:         2,
		MemoryMb:     7680,
		GPU:          0,
	},
	"m1.medium": {
		InstanceType: "m1.medium",
		VCPU:         1,
		MemoryMb:     3840,
		GPU:          0,
	},
	"m1.small": {
		InstanceType: "m1.small",
		VCPU:         1,
		MemoryMb:     1740,
		GPU:          0,
	},
	"m1.xlarge": {
		InstanceType: "m1.xlarge",
		VCPU:         4,
		MemoryMb:     15360,
		GPU:          0,
	},
	"m2.2xlarge": {
		InstanceType: "m2.2xlarge",
		VCPU:         4,
		MemoryMb:     35020,
		GPU:          0,
	},
	"m2.4xlarge": {
		InstanceType: "m2.4xlarge",
		VCPU:         8,
		MemoryMb:     70041,
		GPU:          0,
	},
	"m2.xlarge": {
		InstanceType: "m2.xlarge",
		VCPU:         2,
		MemoryMb:     17510,
		GPU:          0,
	},
	"m3": {
		InstanceType: "m3",
		VCPU:         8,
		MemoryMb:     0,
		GPU:          0,
	},
	"m3.2xlarge": {
		InstanceType: "m3.2xlarge",
		VCPU:         8,
		MemoryMb:     30720,
		GPU:          0,
	},
	"m3.large": {
		InstanceType: "m3.large",
		VCPU:         2,
		MemoryMb:     7680,
		GPU:          0,
	},
	"m3.medium": {
		InstanceType: "m3.medium",
		VCPU:         1,
		MemoryMb:     3840,
		GPU:          0,
	},
	"m3.xlarge": {
		InstanceType: "m3.xlarge",
		VCPU:         4,
		MemoryMb:     15360,
		GPU:          0,
	},
	"m4": {
		InstanceType: "m4",
		VCPU:         40,
		MemoryMb:     0,
		GPU:          0,
	},
	"m4.10xlarge": {
		InstanceType: "m4.10xlarge",
		VCPU:         40,
		MemoryMb:     163840,
		GPU:          0,
	},
	"m4.16xlarge": {
		InstanceType: "m4.16xlarge",
		VCPU:         64,
		MemoryMb:     262144,
		GPU:          0,
	},
	"m4.2xlarge": {
		InstanceType: "m4.2xlarge",
		VCPU:         8,
		MemoryMb:     32768,
		GPU:          0,
	},
	"m4.4xlarge": {
		InstanceType: "m4.4xlarge",
		VCPU:         16,
		MemoryMb:     65536,
		GPU:          0,
	},
	"m4.large": {
		InstanceType: "m4.large",
		VCPU:         2,
		MemoryMb:     8192,
		GPU:          0,
	},
	"m4.xlarge": {
		InstanceType: "m4.xlarge",
		VCPU:         4,
		MemoryMb:     16384,
		GPU:          0,
	},
	"p2": {
		InstanceType: "p2",
		VCPU:         64,
		MemoryMb:     0,
		GPU:          16,
	},
	"p2.16xlarge": {
		InstanceType: "p2.16xlarge",
		VCPU:         64,
		MemoryMb:     786432,
		GPU:          16,
	},
	"p2.8xlarge": {
		InstanceType: "p2.8xlarge",
		VCPU:         32,
		MemoryMb:     499712,
		GPU:          0,
	},
	"p2.xlarge": {
		InstanceType: "p2.xlarge",
		VCPU:         4,
		MemoryMb:     62464,
		GPU:          0,
	},
	"r3": {
		InstanceType: "r3",
		VCPU:         32,
		MemoryMb:     0,
		GPU:          0,
	},
	"r3.2xlarge": {
		InstanceType: "r3.2xlarge",
		VCPU:         8,
		MemoryMb:     62464,
		GPU:          0,
	},
	"r3.4xlarge": {
		InstanceType: "r3.4xlarge",
		VCPU:         16,
		MemoryMb:     124928,
		GPU:          0,
	},
	"r3.8xlarge": {
		InstanceType: "r3.8xlarge",
		VCPU:         32,
		MemoryMb:     249856,
		GPU:          0,
	},
	"r3.large": {
		InstanceType: "r3.large",
		VCPU:         2,
		MemoryMb:     15616,
		GPU:          0,
	},
	"r3.xlarge": {
		InstanceType: "r3.xlarge",
		VCPU:         4,
		MemoryMb:     31232,
		GPU:          0,
	},
	"r4": {
		InstanceType: "r4",
		VCPU:         64,
		MemoryMb:     0,
		GPU:          0,
	},
	"r4.16xlarge": {
		InstanceType: "r4.16xlarge",
		VCPU:         64,
		MemoryMb:     499712,
		GPU:          0,
	},
	"r4.2xlarge": {
		InstanceType: "r4.2xlarge",
		VCPU:         8,
		MemoryMb:     62464,
		GPU:          0,
	},
	"r4.4xlarge": {
		InstanceType: "r4.4xlarge",
		VCPU:         16,
		MemoryMb:     124928,
		GPU:          0,
	},
	"r4.8xlarge": {
		InstanceType: "r4.8xlarge",
		VCPU:         32,
		MemoryMb:     249856,
		GPU:          0,
	},
	"r4.large": {
		InstanceType: "r4.large",
		VCPU:         2,
		MemoryMb:     15616,
		GPU:          0,
	},
	"r4.xlarge": {
		InstanceType: "r4.xlarge",
		VCPU:         4,
		MemoryMb:     31232,
		GPU:          0,
	},
	"t1.micro": {
		InstanceType: "t1.micro",
		VCPU:         1,
		MemoryMb:     627,
		GPU:          0,
	},
	"t2.2xlarge": {
		InstanceType: "t2.2xlarge",
		VCPU:         8,
		MemoryMb:     32768,
		GPU:          0,
	},
	"t2.large": {
		InstanceType: "t2.large",
		VCPU:         2,
		MemoryMb:     8192,
		GPU:          0,
	},
	"t2.medium": {
		InstanceType: "t2.medium",
		VCPU:         2,
		MemoryMb:     4096,
		GPU:          0,
	},
	"t2.micro": {
		InstanceType: "t2.micro",
		VCPU:         1,
		MemoryMb:     1024,
		GPU:          0,
	},
	"t2.nano": {
		InstanceType: "t2.nano",
		VCPU:         1,
		MemoryMb:     512,
		GPU:          0,
	},
	"t2.small": {
		InstanceType: "t2.small",
		VCPU:         1,
		MemoryMb:     2048,
		GPU:          0,
	},
	"t2.xlarge": {
		InstanceType: "t2.xlarge",
		VCPU:         4,
		MemoryMb:     16384,
		GPU:          0,
	},
	"x1": {
		InstanceType: "x1",
		VCPU:         128,
		MemoryMb:     0,
		GPU:          0,
	},
	"x1.16xlarge": {
		InstanceType: "x1.16xlarge",
		VCPU:         64,
		MemoryMb:     999424,
		GPU:          0,
	},
	"x1.32xlarge": {
		InstanceType: "x1.32xlarge",
		VCPU:         128,
		MemoryMb:     1998848,
		GPU:          0,
	},
}

InstanceTypes is a map of ec2 resources

Functions

func BuildAwsCloudProvider

func BuildAwsCloudProvider(awsManager *AwsManager, discoveryOpts cloudprovider.NodeGroupDiscoveryOptions) (cloudprovider.CloudProvider, error)

BuildAwsCloudProvider builds CloudProvider implementation for AWS.

Types

type Asg

type Asg struct {
	AwsRef
	// contains filtered or unexported fields
}

Asg implements NodeGroup interface.

func (*Asg) Autoprovisioned

func (asg *Asg) Autoprovisioned() bool

Autoprovisioned returns true if the node group is autoprovisioned.

func (*Asg) Belongs

func (asg *Asg) Belongs(node *apiv1.Node) (bool, error)

Belongs returns true if the given node belongs to the NodeGroup.

func (*Asg) Create

func (asg *Asg) Create() error

Create creates the node group on the cloud provider side.

func (*Asg) Debug

func (asg *Asg) Debug() string

Debug returns a debug string for the Asg.

func (*Asg) DecreaseTargetSize

func (asg *Asg) DecreaseTargetSize(delta int) error

DecreaseTargetSize decreases the target size of the node group. This function doesn't permit to delete any existing node and can be used only to reduce the request for new nodes that have not been yet fulfilled. Delta should be negative. It is assumed that cloud provider will not delete the existing nodes if the size when there is an option to just decrease the target.

func (*Asg) Delete

func (asg *Asg) Delete() error

Delete deletes the node group on the cloud provider side. This will be executed only for autoprovisioned node groups, once their size drops to 0.

func (*Asg) DeleteNodes

func (asg *Asg) DeleteNodes(nodes []*apiv1.Node) error

DeleteNodes deletes the nodes from the group.

func (*Asg) Exist

func (asg *Asg) Exist() bool

Exist checks if the node group really exists on the cloud provider side. Allows to tell the theoretical node group from the real one.

func (*Asg) Id

func (asg *Asg) Id() string

Id returns asg id.

func (*Asg) IncreaseSize

func (asg *Asg) IncreaseSize(delta int) error

IncreaseSize increases Asg size

func (*Asg) MaxSize

func (asg *Asg) MaxSize() int

MaxSize returns maximum size of the node group.

func (*Asg) MinSize

func (asg *Asg) MinSize() int

MinSize returns minimum size of the node group.

func (*Asg) Nodes

func (asg *Asg) Nodes() ([]string, error)

Nodes returns a list of all nodes that belong to this node group.

func (*Asg) TargetSize

func (asg *Asg) TargetSize() (int, error)

TargetSize returns the current TARGET size of the node group. It is possible that the number is different from the number of nodes registered in Kubernetes.

func (*Asg) TemplateNodeInfo

func (asg *Asg) TemplateNodeInfo() (*schedulercache.NodeInfo, error)

TemplateNodeInfo returns a node template for this node group.

type AwsManager

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

AwsManager is handles aws communication and data caching.

func CreateAwsManager

func CreateAwsManager(configReader io.Reader) (*AwsManager, error)

CreateAwsManager constructs awsManager object.

func (*AwsManager) DeleteInstances

func (m *AwsManager) DeleteInstances(instances []*AwsRef) error

DeleteInstances deletes the given instances. All instances must be controlled by the same ASG.

func (*AwsManager) GetAsgForInstance

func (m *AwsManager) GetAsgForInstance(instance *AwsRef) (*Asg, error)

GetAsgForInstance returns AsgConfig of the given Instance

func (*AwsManager) GetAsgNodes

func (m *AwsManager) GetAsgNodes(asg *Asg) ([]string, error)

GetAsgNodes returns Asg nodes.

func (*AwsManager) GetAsgSize

func (m *AwsManager) GetAsgSize(asgConfig *Asg) (int64, error)

GetAsgSize gets ASG size.

func (*AwsManager) RegisterAsg

func (m *AwsManager) RegisterAsg(asg *Asg)

RegisterAsg registers asg in Aws Manager.

func (*AwsManager) RestartInstances

func (m *AwsManager) RestartInstances(instances []*AwsRef) error

When desiredCapacity hits MinSize, awsmanager does not allow to delete the VM. RestartInstance should delete the instance anyhow and let ASG recreate it.

func (*AwsManager) SetAsgSize

func (m *AwsManager) SetAsgSize(asg *Asg, size int64) error

SetAsgSize sets ASG size.

type AwsRef

type AwsRef struct {
	Name string
}

AwsRef contains a reference to some entity in AWS/GKE world.

func AwsRefFromProviderId

func AwsRefFromProviderId(id string) (*AwsRef, error)

AwsRefFromProviderId creates InstanceConfig object from provider id which must be in format: aws:///zone/name

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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