instances

package
v0.0.0-...-9ec3720 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CpuPower

func CpuPower(power uint64) *uint64

Types

type ByName

type ByName []InstanceType

func (ByName) Len

func (bt ByName) Len() int

func (ByName) Less

func (bt ByName) Less(i, j int) bool

func (ByName) Swap

func (bt ByName) Swap(i, j int)

type Image

type Image struct {
	Id   string
	Arch string
	// The type of virtualisation supported by this image.
	VirtType string
}

Image holds the attributes that vary amongst relevant images for a given series in a given region.

func ImageMetadataToImages

func ImageMetadataToImages(inputs []*imagemetadata.ImageMetadata) []Image

ImageMetadataToImages converts an array of ImageMetadata pointers (as returned by imagemetadata.Fetch) to an array of Image objects (as required by instances.FindInstanceSpec).

type Instance

type Instance interface {
	// Id returns a provider-generated identifier for the Instance.
	Id() instance.Id

	// Status returns the provider-specific status for the instance.
	Status(context.ProviderCallContext) instance.Status

	// Addresses returns a list of hostnames or ip addresses
	// associated with the instance.
	Addresses(context.ProviderCallContext) (corenetwork.ProviderAddresses, error)
}

Instance represents the the realization of a machine in state.

type InstanceConstraint

type InstanceConstraint struct {
	Region      string
	Series      string
	Arches      []string
	Constraints constraints.Value

	// Storage specifies a list of storage types, in order of preference.
	// eg ["ssd", "ebs"] means find images with ssd storage, but if none
	// exist, find those with ebs instead.
	Storage []string
}

InstanceConstraint constrains the possible instances that may be chosen by the environment provider.

func (*InstanceConstraint) String

func (ic *InstanceConstraint) String() string

String returns a human readable form of this InstanceConstraint.

type InstanceFirewaller

type InstanceFirewaller interface {
	// OpenPorts opens the given port ranges on the instance, which
	// should have been started with the given machine id.
	OpenPorts(ctx context.ProviderCallContext, machineId string, rules firewall.IngressRules) error

	// ClosePorts closes the given port ranges on the instance, which
	// should have been started with the given machine id.
	ClosePorts(ctx context.ProviderCallContext, machineId string, rules firewall.IngressRules) error

	// IngressRules returns the set of ingress rules for the instance,
	// which should have been applied to the given machine id. The
	// rules are returned as sorted by network.SortIngressRules().
	// It is expected that there be only one ingress rule result for a given
	// port range - the rule's SourceCIDRs will contain all applicable source
	// address rules for that port range.
	IngressRules(ctx context.ProviderCallContext, machineId string) (firewall.IngressRules, error)
}

InstanceFirewaller provides instance-level firewall functionality

type InstanceSpec

type InstanceSpec struct {
	InstanceType InstanceType
	Image        Image
	// contains filtered or unexported fields
}

InstanceSpec holds an instance type name and the chosen image info.

func FindInstanceSpec

func FindInstanceSpec(possibleImages []Image, ic *InstanceConstraint, allInstanceTypes []InstanceType) (*InstanceSpec, error)

FindInstanceSpec returns an InstanceSpec satisfying the supplied InstanceConstraint. possibleImages contains a list of images matching the InstanceConstraint. allInstanceTypes provides information on every known available instance type (name, memory, cpu cores etc) on which instances can be run. The InstanceConstraint is used to filter allInstanceTypes and then a suitable image compatible with the matching instance types is returned.

type InstanceType

type InstanceType struct {
	Id       string
	Name     string
	Arches   []string
	CpuCores uint64
	Mem      uint64
	Cost     uint64
	RootDisk uint64
	// These attributes are not supported by all clouds.
	VirtType   *string // The type of virtualisation used by the hypervisor, must match the image.
	CpuPower   *uint64
	Tags       []string
	Deprecated bool
}

InstanceType holds all relevant attributes of the various instance types.

func MatchingInstanceTypes

func MatchingInstanceTypes(allInstanceTypes []InstanceType, region string, cons constraints.Value) ([]InstanceType, error)

MatchingInstanceTypes returns all instance types matching constraints and available in region, sorted by increasing region-specific cost (if known).

type InstanceTypesWithCostMetadata

type InstanceTypesWithCostMetadata struct {
	// InstanceTypes holds the array of InstanceTypes affected by this cost scheme.
	InstanceTypes []InstanceType
	// CostUnit holds the unit in which the InstanceType.Cost is expressed.
	CostUnit string
	// CostCurrency holds the currency in which InstanceType.Cost is expressed.
	CostCurrency string
	// CostDivisor indicates a number that must be applied to InstanceType.Cost to obtain
	// a number that is in CostUnit.
	// If 0 it means that InstanceType.Cost is already expressed in CostUnit.
	CostDivisor uint64
}

InstanceTypesWithCostMetadata holds an array of InstanceType and metadata about their cost.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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