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
- Variables
- type Adapter
- func (a *Adapter) AutoScalingGroupName() string
- func (a *Adapter) ClusterID() string
- func (a *Adapter) CreateStack(certificateARN string) (string, error)
- func (a *Adapter) DeleteStack(stack *Stack) error
- func (a *Adapter) FindManagedStacks() ([]*Stack, error)
- func (a *Adapter) GetStack(stackID string) (*Stack, error)
- func (a *Adapter) InstanceID() string
- func (a *Adapter) MarkToDeleteStack(stack *Stack) (time.Time, error)
- func (a *Adapter) NewACMCertificateProvider() certs.CertificatesProvider
- func (a *Adapter) NewIAMCertificateProvider() certs.CertificatesProvider
- func (a *Adapter) PrivateSubnetIDs() []string
- func (a *Adapter) PublicSubnetIDs() []string
- func (a *Adapter) SecurityGroupID() string
- func (a *Adapter) UpdateStack(certificateARN string) (string, error)
- func (a *Adapter) VpcID() string
- func (a *Adapter) WithCreationTimeout(interval time.Duration) *Adapter
- func (a *Adapter) WithCustomTemplate(template string) *Adapter
- func (a *Adapter) WithHealthCheckInterval(interval time.Duration) *Adapter
- func (a *Adapter) WithHealthCheckPath(path string) *Adapter
- func (a *Adapter) WithHealthCheckPort(port uint) *Adapter
- type Namer
- type Stack
Constants ¶
Variables ¶
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 ¶
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 ¶
AutoScalingGroupName returns the name of the Auto Scaling Group the current node belongs to
func (*Adapter) ClusterID ¶
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
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
DeleteStack deletes the CloudFormation stack with the given name
func (*Adapter) FindManagedStacks ¶ added in v0.3.0
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
GetStack returns the CloudFormation stack details with the name or ID from the argument
func (*Adapter) InstanceID ¶
InstanceID returns the instance ID the current node is running on.
func (*Adapter) MarkToDeleteStack ¶ added in v0.3.6
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 ¶
PrivateSubnetIDs returns a slice with the private subnet IDs discovered by the adapter.
func (*Adapter) PublicSubnetIDs ¶
PublicSubnetIDs returns a slice with the public subnet IDs discovered by the adapter.
func (*Adapter) SecurityGroupID ¶
SecurityGroupID returns the security group ID that should be used to create Load Balancers.
func (*Adapter) UpdateStack ¶ added in v0.3.8
func (*Adapter) WithCreationTimeout ¶ added in v0.3.0
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
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
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
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
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 (*Stack) IsDeleteInProgress ¶ added in v0.3.6
IsDeleteInProgress returns true if the stack has already a tag deleteScheduled.
func (*Stack) ShouldDelete ¶ added in v0.3.6
ShouldDelete returns true if stack is marked to delete and the deleteScheduled tag is after time.Now(). In all other cases it returns false.