aws

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AutoScalingGroup

type AutoScalingGroup struct {
	Instances        AwsInstances
	DesiredInstances int
	MinInstances     int
	MaxInstances     int
	AsgName          string
}

TODO: Improve the modelling of cluster and awsinstances to be in the appropriate packages.

type AutoScalingGroupClient

type AutoScalingGroupClient struct {
	Asg AutoScalingGroup
}

func (*AutoScalingGroupClient) UpdateAutoScalingGroupCount

func (a *AutoScalingGroupClient) UpdateAutoScalingGroupCount(ctx context.Context, cfg aws.Config) (*autoscaling.UpdateAutoScalingGroupOutput, error)

type AutoscalingGroupUpdater

type AutoscalingGroupUpdater struct {
	UpdateAutoscalingGroupInterface
}

func (*AutoscalingGroupUpdater) Update

Update method updates the current ASG count for max to the current desired count to prevent the ASG being drained and tainted to prevent from getting autoscaled during the upgrade process TODO make this general purpose instead of just updating the Max size to current desired size which it is doing right now

type AwsInstance

type AwsInstance struct {
	InstanceId string
	PrivateDNS string
	AsgName    string
}

TODO: Make the domain modelling cleaner and compose the types together which are created alongside one another

type AwsInstances

type AwsInstances []AwsInstance

func (*AwsInstances) AppendInstance

func (a *AwsInstances) AppendInstance(o AwsInstance)

TODO Add a spec for this

func (AwsInstances) Count

func (a AwsInstances) Count() int

Count returns the number of AWS instances currently running in the ASG, a quick way to gather the desired count from instance map created already

func (AwsInstances) DrainNodes

func (a AwsInstances) DrainNodes() error

TODO Add a spec for this

func (*AwsInstances) GetInstancesForASG

func (a *AwsInstances) GetInstancesForASG(cfg aws.Config, asgName string, awsRegion string, awsProfile string)

GetInstancesForASG is a helper function, which interacts with the AWS SDK taking the input of the asgname, awsregion and awsprofile and then calls the DescribeAutoScalingGroups API to get the instances of the ASG and then calling the DescribeInstances API to map the private DNS of the instances and then store it, which will then be used to feed kubectl drain command TODO have this method use the generic config getter helper created in internal/api/aws package to reduce duplication TODO break this method into two helper methods TODO add specs for this

func (AwsInstances) PrettyPrint

func (a AwsInstances) PrettyPrint()

TODO Add a spec for this

func (AwsInstances) TaintNodes

func (a AwsInstances) TaintNodes() error

TODO Add a spec for this

type Config

type Config struct{}

func (*Config) LoadDefaultConfig

func (a *Config) LoadDefaultConfig(ctx context.Context, optFns ...func(*config.LoadOptions) error) (aws.Config, error)

type ConfigClientInterface

type ConfigClientInterface interface {
	LoadDefaultConfig(ctx context.Context, optFns ...func(*config.LoadOptions) error) (aws.Config, error)
}

type ConfigGetter

type ConfigGetter struct {
	ConfigClientInterface
}

func (*ConfigGetter) GetConfig

func (a *ConfigGetter) GetConfig(ctx context.Context, optFns ...func(*config.LoadOptions) error) (aws.Config, error)

type UpdateAutoscalingGroupInterface

type UpdateAutoscalingGroupInterface interface {
	UpdateAutoScalingGroupCount(ctx context.Context, cfg aws.Config) (*autoscaling.UpdateAutoScalingGroupOutput, error)
}

Jump to

Keyboard shortcuts

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