Documentation
¶
Index ¶
- Constants
- func CalculateUsage(clusterInfo *structs.ClusterAllocation)
- func CheckClusterScalingTimeThreshold(cooldown float64, asgName string, svc *autoscaling.AutoScaling) error
- func DescribeAWSRegion() (region string, err error)
- func DescribeScalingGroup(asgName string, svc *autoscaling.AutoScaling) (asg *autoscaling.DescribeAutoScalingGroupsOutput, err error)
- func MaxAllowedClusterUtilization(capacity *structs.ClusterAllocation, nodeFaultTolerance int, scaleIn bool) (maxAllowedUtilization int)
- func NewAWSAsgService(region string) (Session *autoscaling.AutoScaling)
- func NewConsulClient(addr string) (structs.ConsulClient, error)
- func NewNomadClient(addr string) (structs.NomadClient, error)
- func ScaleInCluster(asgName, instanceIP string, svc *autoscaling.AutoScaling) error
- func ScaleOutCluster(asgName string, svc *autoscaling.AutoScaling) error
Constants ¶
const ( ScalingMetricNone = "None" // All supported allocation resources are unutilized. ScalingMetricDisk = "Disk" ScalingMetricMemory = "Memory" ScalingMetricProcessor = "CPU" )
Scaling metric types indicate the most-utilized resource across the cluster. When evaluating scaling decisions, the most-utilized resource will be prioritized.
const ( ScalingDirectionOut = "Out" ScalingDirectionIn = "In" ScalingDirectionNone = "None" )
Scaling direction types indicate the allowed scaling actions.
Variables ¶
This section is empty.
Functions ¶
func CalculateUsage ¶
func CalculateUsage(clusterInfo *structs.ClusterAllocation)
CalculateUsage determines the percentage of overall cluster resources consumed and calculates the amount of those resources consumed by each worker node.
func CheckClusterScalingTimeThreshold ¶
func CheckClusterScalingTimeThreshold(cooldown float64, asgName string, svc *autoscaling.AutoScaling) error
CheckClusterScalingTimeThreshold checks the last cluster scaling event time and compares against the cooldown period to determine whether or not a cluster scaling event can happen.
func DescribeAWSRegion ¶
DescribeAWSRegion uses the EC2 InstanceMetaData endpoint to discover the AWS region in which the instance is running.
func DescribeScalingGroup ¶
func DescribeScalingGroup(asgName string, svc *autoscaling.AutoScaling) (asg *autoscaling.DescribeAutoScalingGroupsOutput, err error)
DescribeScalingGroup returns the AWS ASG information of the specified ASG.
func MaxAllowedClusterUtilization ¶
func MaxAllowedClusterUtilization(capacity *structs.ClusterAllocation, nodeFaultTolerance int, scaleIn bool) (maxAllowedUtilization int)
MaxAllowedClusterUtilization calculates the maximum allowed cluster utilization after taking into consideration node fault-tolerance and scaling overhead.
func NewAWSAsgService ¶
func NewAWSAsgService(region string) (Session *autoscaling.AutoScaling)
NewAWSAsgService creates a new AWS API Session and ASG service connection for use across all calls as required.
func NewConsulClient ¶
func NewConsulClient(addr string) (structs.ConsulClient, error)
NewConsulClient is used to construct a new Consul client using the default configuration and supporting the ability to specify a Consul API address endpoint in the form of address:port.
func NewNomadClient ¶
func NewNomadClient(addr string) (structs.NomadClient, error)
NewNomadClient is used to create a new client to interact with Nomad. The client implements the NomadClient interface.
func ScaleInCluster ¶
func ScaleInCluster(asgName, instanceIP string, svc *autoscaling.AutoScaling) error
ScaleInCluster scales the cluster size by 1 by using the DetachInstances call to target an instance to remove from the ASG.
func ScaleOutCluster ¶
func ScaleOutCluster(asgName string, svc *autoscaling.AutoScaling) error
ScaleOutCluster scales the Nomad worker pool by 1 instance, using the current configuration as the basis for undertaking the work.
Types ¶
This section is empty.