aws

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2017 License: MIT Imports: 27 Imported by: 2

Documentation

Overview

Package aws provides some higher level Amazon Web Services abstractions for access to common resources.

The exported Adapter can be used to orchestrate and obtain information about Elastic Compute Cloud (EC2), EC2 Metadata, Elastic Load Balancing (ELB v2, also known as Application Load Balancer - ALB), Auto Scaling (ASG) and CloudFormation.

Index

Constants

View Source
const (
	DefaultHealthCheckPath           = "/kube-system/healthz"
	DefaultHealthCheckPort           = 9999
	DefaultHealthCheckInterval       = 10 * time.Second
	DefaultCertificateUpdateInterval = 30 * time.Minute
	DefaultCreationTimeout           = 5 * time.Minute
	DefaultStackTTL                  = 5 * time.Minute
)

Variables

View Source
var (
	// ErrMissingSecurityGroup is used to signal that the required security group couldn't be found.
	ErrMissingSecurityGroup = errors.New("required security group was not found")
	// ErrLoadBalancerStackNotFound is used to signal that a given load balancer CF stack was not found.
	ErrLoadBalancerStackNotFound = errors.New("load balancer stack not found")
	// ErrLoadBalancerStackNotReady is used to signal that a given load balancer CF stack is not ready to be used.
	ErrLoadBalancerStackNotReady = errors.New("existing load balancer stack not ready")
	// ErrMissingNameTag is used to signal that the Name tag on a given resource is missing.
	ErrMissingNameTag = errors.New("Name tag not found")
	// ErrMissingTag is used to signal that a tag on a given resource is missing.
	ErrMissingTag = errors.New("missing tag")
	// ErrNoSubnets is used to signal that no subnets were found in the current VPC
	ErrNoSubnets = errors.New("unable to find VPC subnets")
	// ErrMissingAutoScalingGroupTag is used to signal that the auto scaling group tag is not present in the list of tags.
	ErrMissingAutoScalingGroupTag = errors.New(`instance is missing the "` + autoScalingGroupNameTag + `" tag`)
	// ErrNoRunningInstances is used to signal that no instances were found in the running state
	ErrNoRunningInstances = errors.New("no reservations or instances in the running state")
	// ErrFailedToParsePEM is used to signal that the PEM block for a certificate failed to be parsed
	ErrFailedToParsePEM = errors.New("failed to parse certificate PEM")
)

Functions

This section is empty.

Types

type Adapter

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

An Adapter can be used to orchestrate and obtain information from Amazon Web Services.

func NewAdapter

func NewAdapter() (adapter *Adapter, err error)

NewAdapter returns a new Adapter that can be used to orchestrate and obtain information from Amazon Web Services. Before returning there is a discovery process for VPC and EC2 details. It tries to find the Auto Scaling Group and Security Group that should be used for newly created Load Balancers. If any of those critical steps fail an appropriate error is returned.

func (*Adapter) AutoScalingGroupName

func (a *Adapter) AutoScalingGroupName() string

AutoScalingGroupName returns the name of the Auto Scaling Group the current node belongs to

func (*Adapter) ClusterID

func (a *Adapter) ClusterID() string

ClusterStackName returns the ClusterID tag that all resources from the same Kubernetes cluster share. It's taken from the current ec2 instance.

func (*Adapter) CreateStack added in v0.3.0

func (a *Adapter) CreateStack(certificateARN string) (string, error)

CreateStack creates a new Application Load Balancer using CloudFormation. The stack name is derived from the Cluster ID and the certificate ARN (when available). All the required resources (listeners and target group) are created in a transactional fashion. Failure to create the stack causes it to be deleted automatically.

func (*Adapter) DeleteStack added in v0.3.0

func (a *Adapter) DeleteStack(stack *Stack) error

DeleteStack deletes the CloudFormation stack with the given name

func (*Adapter) FindManagedStacks added in v0.3.0

func (a *Adapter) FindManagedStacks() ([]*Stack, error)

FindManagedStacks returns all CloudFormation stacks containing the controller management tags that match the current cluster and are ready to be used. The stack status is used to filter.

func (*Adapter) GetStack added in v0.3.0

func (a *Adapter) GetStack(stackID string) (*Stack, error)

GetStack returns the CloudFormation stack details with the name or ID from the argument

func (*Adapter) InstanceID

func (a *Adapter) InstanceID() string

InstanceID returns the instance ID the current node is running on.

func (*Adapter) MarkToDeleteStack added in v0.3.6

func (a *Adapter) MarkToDeleteStack(stack *Stack) (time.Time, error)

MarkToDeleteStack adds a "deleteScheduled" Tag to the CloudFormation stack with the given name

func (*Adapter) NewACMCertificateProvider added in v0.3.0

func (a *Adapter) NewACMCertificateProvider() certs.CertificatesProvider

func (*Adapter) NewIAMCertificateProvider added in v0.3.0

func (a *Adapter) NewIAMCertificateProvider() certs.CertificatesProvider

func (*Adapter) PrivateSubnetIDs

func (a *Adapter) PrivateSubnetIDs() []string

PrivateSubnetIDs returns a slice with the private subnet IDs discovered by the adapter.

func (*Adapter) PublicSubnetIDs

func (a *Adapter) PublicSubnetIDs() []string

PublicSubnetIDs returns a slice with the public subnet IDs discovered by the adapter.

func (*Adapter) SecurityGroupID

func (a *Adapter) SecurityGroupID() string

SecurityGroupID returns the security group ID that should be used to create Load Balancers.

func (*Adapter) UpdateStack added in v0.3.8

func (a *Adapter) UpdateStack(certificateARN string) (string, error)

func (*Adapter) VpcID

func (a *Adapter) VpcID() string

VpcID returns the VPC ID the current node belongs to.

func (*Adapter) WithCreationTimeout added in v0.3.0

func (a *Adapter) WithCreationTimeout(interval time.Duration) *Adapter

WithCreationTimeout returns the receiver adapter after changing the creation timeout that is used as the max wait time for the creation of all the required AWS resources for a given Ingress

func (*Adapter) WithCustomTemplate added in v0.3.0

func (a *Adapter) WithCustomTemplate(template string) *Adapter

WithCustomTemplate returns the receiver adapter after changing the CloudFormation template that should be used to create Load Balancer stacks

func (*Adapter) WithHealthCheckInterval added in v0.3.0

func (a *Adapter) WithHealthCheckInterval(interval time.Duration) *Adapter

WithHealthCheckInterval returns the receiver adapter after changing the health check interval that will be used by the resources created by the adapter

func (*Adapter) WithHealthCheckPath added in v0.3.0

func (a *Adapter) WithHealthCheckPath(path string) *Adapter

WithHealthCheckPath returns the receiver adapter after changing the health check path that will be used by the resources created by the adapter.

func (*Adapter) WithHealthCheckPort added in v0.3.0

func (a *Adapter) WithHealthCheckPort(port uint) *Adapter

WithHealthCheckPort returns the receiver adapter after changing the health check port that will be used by the resources created by the adapter

type Namer added in v0.3.0

type Namer interface {
	// Returns a normalized name from the combination of both arguments
	Normalize(clusterID, certificateARN string) string
}

The Namer interface defines the behavior of types that are able to apply custom constraints to names of resources

type Stack added in v0.3.0

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

Stack is a simple wrapper around a CloudFormation Stack.

func (*Stack) CertificateARN added in v0.3.0

func (s *Stack) CertificateARN() string

func (*Stack) DNSName added in v0.3.0

func (s *Stack) DNSName() string

func (*Stack) IsDeleteInProgress added in v0.3.6

func (s *Stack) IsDeleteInProgress() bool

IsDeleteInProgress returns true if the stack has already a tag deleteScheduled.

func (*Stack) Name added in v0.3.0

func (s *Stack) Name() string

func (*Stack) ShouldDelete added in v0.3.6

func (s *Stack) ShouldDelete() bool

ShouldDelete returns true if stack is marked to delete and the deleteScheduled tag is after time.Now(). In all other cases it returns false.

func (*Stack) TargetGroupARN added in v0.3.0

func (s *Stack) TargetGroupARN() string

Jump to

Keyboard shortcuts

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