Documentation
¶
Overview ¶
Package stopped describes what a nap of each backend stops.
Item ports the StoppedItem union of manager packages/fleet/src/prices.ts.
Index ¶
- Constants
- func StrategyCounts(strategy []CapacityProviderStrategyItem, desired int) map[string]int
- type Allocatable
- type AwsvpcConfiguration
- type Backend
- type CapacityProviderStrategyItem
- type DBCluster
- type DBInstance
- type DescribeDBClustersInput
- type DescribeDBClustersOutput
- type DescribeDBInstancesInput
- type DescribeDBInstancesOutput
- type DescribeInstancesInput
- type DescribeInstancesOutput
- type DescribeServicesInput
- type DescribeServicesOutput
- type DescribeTaskDefinitionInput
- type DescribeTaskDefinitionOutput
- type EC2Port
- type ECSPort
- type Filter
- type GroupIdentifier
- type Instance
- type InstanceState
- type Item
- type NetworkConfiguration
- type Ports
- type RDSPort
- type Reservation
- type RuntimePlatform
- type ServerlessV2Scaling
- type Service
- type Tag
- type TaskDefinition
- type VpcSecurityGroup
Constants ¶
const ( BackendInstance = "instance" BackendASG = "asg" BackendECS = "ecs" BackendK8s = "k8s" BackendRDSInstance = "rds-instance" BackendRDSCluster = "rds-cluster" )
Kinds of Backend.
const ( KindEC2 = "ec2" KindFargate = "fargate" KindRDS = "rds" KindAuroraServerless = "aurora-serverless" KindK8sPods = "k8s-pods" KindUnknown = "unknown" )
Kinds of Item.
Variables ¶
This section is empty.
Functions ¶
func StrategyCounts ¶
func StrategyCounts(strategy []CapacityProviderStrategyItem, desired int) map[string]int
StrategyCounts splits a desired count by a capacity provider strategy, as ECS places tasks (R9.5a): the provider with a base gets that many first, the rest is shared by weight, rounded with the largest remainder so the counts add up; without any weight, the base's provider (else the first) takes the rest.
Types ¶
type Allocatable ¶
Allocatable is a node's allocatable CPU and memory (k8s-pods).
type AwsvpcConfiguration ¶
type AwsvpcConfiguration struct {
SecurityGroups []string `json:"securityGroups,omitempty"`
}
AwsvpcConfiguration holds the security groups of an awsvpc service.
type Backend ¶
type Backend struct {
Kind string `json:"kind"`
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Desired int `json:"desired,omitempty"`
Instances []string `json:"instances,omitempty"`
Cluster string `json:"cluster,omitempty"`
Namespace string `json:"namespace,omitempty"`
Owner kubernetes.Owner `json:"owner,omitzero"`
Autoscaler kubernetes.Autoscaler `json:"autoscaler,omitempty"`
}
Backend is what a nap stops: the union as one struct, Kind saying which fields it carries (JSON names as Node's).
instance: id asg: name, desired, instances ecs: id, cluster, desired k8s: id, cluster, namespace, owner, autoscaler rds-instance, rds-cluster: id
type CapacityProviderStrategyItem ¶
type CapacityProviderStrategyItem struct {
CapacityProvider string `json:"capacityProvider"`
Base int `json:"base,omitempty"`
Weight int `json:"weight,omitempty"`
}
CapacityProviderStrategyItem is one entry of a service's strategy.
type DBCluster ¶
type DBCluster struct {
DBClusterIdentifier string `json:"DBClusterIdentifier,omitempty"`
Engine string `json:"Engine,omitempty"`
ServerlessV2ScalingConfiguration *ServerlessV2Scaling `json:"ServerlessV2ScalingConfiguration,omitempty"`
// What discovery's databases read.
Status string `json:"Status,omitempty"`
EngineMode string `json:"EngineMode,omitempty"`
VpcSecurityGroups []VpcSecurityGroup `json:"VpcSecurityGroups,omitempty"`
TagList []Tag `json:"TagList,omitempty"`
}
DBCluster is the part of an Aurora cluster Describe reads.
type DBInstance ¶
type DBInstance struct {
DBInstanceIdentifier string `json:"DBInstanceIdentifier,omitempty"`
DBInstanceClass string `json:"DBInstanceClass,omitempty"`
Engine string `json:"Engine,omitempty"`
MultiAZ bool `json:"MultiAZ,omitempty"`
DBClusterIdentifier string `json:"DBClusterIdentifier,omitempty"`
// What discovery's databases read.
DBInstanceStatus string `json:"DBInstanceStatus,omitempty"`
ReadReplicaSourceDBInstanceIdentifier string `json:"ReadReplicaSourceDBInstanceIdentifier,omitempty"`
ReadReplicaDBInstanceIdentifiers []string `json:"ReadReplicaDBInstanceIdentifiers,omitempty"`
VpcSecurityGroups []VpcSecurityGroup `json:"VpcSecurityGroups,omitempty"`
TagList []Tag `json:"TagList,omitempty"`
}
DBInstance is the part of an RDS instance Describe reads.
type DescribeDBClustersInput ¶
type DescribeDBClustersInput struct {
DBClusterIdentifier string `json:"DBClusterIdentifier,omitempty"`
Marker string `json:"Marker,omitempty"`
}
DescribeDBClustersInput is RDS DescribeDBClusters' input.
type DescribeDBClustersOutput ¶
type DescribeDBClustersOutput struct {
DBClusters []DBCluster `json:"DBClusters,omitempty"`
Marker string `json:"Marker,omitempty"`
}
DescribeDBClustersOutput is its answer.
type DescribeDBInstancesInput ¶
type DescribeDBInstancesInput struct {
DBInstanceIdentifier string `json:"DBInstanceIdentifier,omitempty"`
Filters []Filter `json:"Filters,omitempty"`
Marker string `json:"Marker,omitempty"` // the page after it (discovery's databases)
}
DescribeDBInstancesInput is RDS DescribeDBInstances' input: one instance by identifier, or the instances of a cluster by filter.
type DescribeDBInstancesOutput ¶
type DescribeDBInstancesOutput struct {
DBInstances []DBInstance `json:"DBInstances,omitempty"`
Marker string `json:"Marker,omitempty"`
}
DescribeDBInstancesOutput is its answer.
type DescribeInstancesInput ¶
type DescribeInstancesInput struct {
InstanceIds []string `json:"InstanceIds"`
}
DescribeInstancesInput is EC2 DescribeInstances' input (the ids asked).
type DescribeInstancesOutput ¶
type DescribeInstancesOutput struct {
Reservations []Reservation `json:"Reservations,omitempty"`
}
DescribeInstancesOutput is its answer.
type DescribeServicesInput ¶
type DescribeServicesInput struct {
Cluster string `json:"cluster"`
Services []string `json:"services"`
}
DescribeServicesInput is ECS DescribeServices' input.
type DescribeServicesOutput ¶
type DescribeServicesOutput struct {
Services []Service `json:"services,omitempty"`
}
DescribeServicesOutput is its answer.
type DescribeTaskDefinitionInput ¶
type DescribeTaskDefinitionInput struct {
TaskDefinition string `json:"taskDefinition"`
}
DescribeTaskDefinitionInput is ECS DescribeTaskDefinition's input.
type DescribeTaskDefinitionOutput ¶
type DescribeTaskDefinitionOutput struct {
TaskDefinition *TaskDefinition `json:"taskDefinition,omitempty"`
}
DescribeTaskDefinitionOutput is its answer.
type EC2Port ¶
type EC2Port interface {
DescribeInstances(ctx context.Context, in DescribeInstancesInput) (DescribeInstancesOutput, error)
}
EC2Port is EC2 (DescribeInstances).
type ECSPort ¶
type ECSPort interface {
DescribeServices(ctx context.Context, in DescribeServicesInput) (DescribeServicesOutput, error)
DescribeTaskDefinition(ctx context.Context, in DescribeTaskDefinitionInput) (DescribeTaskDefinitionOutput, error)
}
ECSPort is ECS (DescribeServices, DescribeTaskDefinition).
type GroupIdentifier ¶
type GroupIdentifier struct {
GroupId string `json:"GroupId,omitempty"`
}
GroupIdentifier is a security group an instance is in.
type Instance ¶
type Instance struct {
InstanceID string `json:"InstanceId,omitempty"`
InstanceType string `json:"InstanceType,omitempty"`
PlatformDetails string `json:"PlatformDetails,omitempty"`
InstanceLifecycle string `json:"InstanceLifecycle,omitempty"`
// State and SecurityGroups: what discovery reads of an instance.
State *InstanceState `json:"State,omitempty"`
SecurityGroups []GroupIdentifier `json:"SecurityGroups,omitempty"`
}
Instance is the part of an EC2 instance Describe reads.
type InstanceState ¶
type InstanceState struct {
Name string `json:"Name,omitempty"`
}
InstanceState is an instance's state.
type Item ¶
type Item struct {
Kind string `json:"kind"`
Type string `json:"type,omitempty"`
Count int `json:"count,omitempty"`
OS string `json:"os,omitempty"`
Spot bool `json:"spot,omitempty"`
VCPU float64 `json:"vcpu,omitempty"`
MemoryGb float64 `json:"memoryGb,omitempty"`
Arch string `json:"arch,omitempty"`
Class string `json:"class,omitempty"`
Engine string `json:"engine,omitempty"`
MultiAZ bool `json:"multiAz,omitempty"`
ACU float64 `json:"acu,omitempty"`
CPU float64 `json:"cpu,omitempty"`
NodeType *string `json:"nodeType,omitempty"`
Autoscaled bool `json:"autoscaled,omitempty"`
Allocatable *Allocatable `json:"allocatable,omitempty"`
Backend string `json:"backend,omitempty"`
Reason string `json:"reason,omitempty"`
}
Item is one thing a nap stops: the StoppedItem union as one struct. Kind says which fields it carries; it marshals to the JSON of Node's item of that kind (fields the kind does not carry are absent, those it carries always present, a zero count included).
ec2: type, count, os, spot? fargate: vcpu, memoryGb, count, arch, os, spot? rds: class, engine, multiAz aurora-serverless: engine, acu k8s-pods: count, cpu, memoryGb, nodeType (or null), os, spot?, autoscaled, allocatable unknown: backend, reason
func Describe ¶
Describe says what a nap of each backend stops, in order, at most 50 items. A backend that cannot be described (a port's error, a recorded one included) is an unknown item with the error's message; Describe itself fails only when ctx is done.
func (Item) MarshalJSON ¶
MarshalJSON writes the fields of the item's kind, in Node's order.
type NetworkConfiguration ¶
type NetworkConfiguration struct {
AwsvpcConfiguration *AwsvpcConfiguration `json:"awsvpcConfiguration,omitempty"`
}
NetworkConfiguration is a service's network (awsvpc).
type Ports ¶
type Ports struct {
EC2 EC2Port
ECS ECSPort
RDS RDSPort
KubernetesOf func(ctx context.Context, cluster string) (kubernetes.Client, error)
}
Ports are what Describe reads through. A port a backend kind does not need may be nil. KubernetesOf gives the client of a cluster by name.
type RDSPort ¶
type RDSPort interface {
DescribeDBInstances(ctx context.Context, in DescribeDBInstancesInput) (DescribeDBInstancesOutput, error)
DescribeDBClusters(ctx context.Context, in DescribeDBClustersInput) (DescribeDBClustersOutput, error)
}
RDSPort is RDS (DescribeDBInstances, DescribeDBClusters).
type Reservation ¶
type Reservation struct {
Instances []Instance `json:"Instances,omitempty"`
}
Reservation groups instances.
type RuntimePlatform ¶
type RuntimePlatform struct {
CPUArchitecture string `json:"cpuArchitecture,omitempty"`
OperatingSystemFamily string `json:"operatingSystemFamily,omitempty"`
}
RuntimePlatform is a task definition's platform.
type ServerlessV2Scaling ¶
type ServerlessV2Scaling struct {
MinCapacity *float64 `json:"MinCapacity,omitempty"`
MaxCapacity *float64 `json:"MaxCapacity,omitempty"`
}
ServerlessV2Scaling is an Aurora Serverless v2 cluster's scaling range.
type Service ¶
type Service struct {
ServiceArn string `json:"serviceArn,omitempty"`
ClusterArn string `json:"clusterArn,omitempty"`
TaskDefinition string `json:"taskDefinition,omitempty"`
LaunchType string `json:"launchType,omitempty"`
DesiredCount int `json:"desiredCount,omitempty"`
NetworkConfiguration *NetworkConfiguration `json:"networkConfiguration,omitempty"`
CapacityProviderStrategy []CapacityProviderStrategyItem `json:"capacityProviderStrategy,omitempty"`
}
Service is the part of an ECS service Describe reads.
type TaskDefinition ¶
type TaskDefinition struct {
CPU string `json:"cpu,omitempty"`
Memory string `json:"memory,omitempty"`
RuntimePlatform *RuntimePlatform `json:"runtimePlatform,omitempty"`
}
TaskDefinition is the part of a task definition Describe reads (the task's size, as strings: "512", "1024").
type VpcSecurityGroup ¶
type VpcSecurityGroup struct {
VpcSecurityGroupId string `json:"VpcSecurityGroupId,omitempty"`
Status string `json:"Status,omitempty"`
}
VpcSecurityGroup is a database's security group and its status.