aws

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: May 16, 2017 License: MIT Imports: 26 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), and Auto Scaling (ASG).

Index

Constants

This section is empty.

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")
	// ErrLoadBalancerNotFound is used to signal that a given load balancer was not found.
	ErrLoadBalancerNotFound = errors.New("load balancer not found")
	// 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`)
	// ErrNoMatchingCertificateFound is used if there is no matching ACM certificate found
	ErrNoMatchingCertificateFound = errors.New("no matching ACM certificate found")
	// 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 matched the DescribeInstances request")
)

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(healthCheckPath string, healthCheckPort uint16, certUpdateInterval time.Duration) (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 TargetGroup and Security Group that should be used for newly created LoadBalancers. 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

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

func (*Adapter) CreateLoadBalancer

func (a *Adapter) CreateLoadBalancer(certificateARN string) (*LoadBalancer, error)

CreateLoadBalancer creates a new Application Load Balancer with an HTTPS listener using the certificate with the certificateARN argument. It will forward all requests to the target group discovered by the Adapter.

func (*Adapter) DeleteLoadBalancer

func (a *Adapter) DeleteLoadBalancer(loadBalancer *LoadBalancer) error

func (*Adapter) FindBestMatchingCertificate added in v0.1.2

func (a *Adapter) FindBestMatchingCertificate(certs []*CertDetail, hostname string) (*CertDetail, error)

FindBestMatchingCertificate returns the best matching certificate dependent on string match (required), NotBefore and NotAfter attributes of certificates. If there are more than one equally matching certifactes are found, then the best is most of the time the newest certificate, such that you can update and revoke your certificates.

func (*Adapter) FindLoadBalancerWithCertificateID

func (a *Adapter) FindLoadBalancerWithCertificateID(certificateARN string) (*LoadBalancer, error)

FindLoadBalancerWithCertificateID looks up for the first Application Load Balancer with, at least, 1 listener with the certificateARN. Order is not guaranteed and depends only on the AWS SDK result order.

func (*Adapter) FindManagedLoadBalancers

func (a *Adapter) FindManagedLoadBalancers() ([]*LoadBalancer, error)

FindManagedLoadBalancers returns all ALBs containing the controller management tags for the current cluster.

func (*Adapter) GetCerts added in v0.1.2

func (a *Adapter) GetCerts() []*CertDetail

GetCerts returns the list of certificates. It's taken from a cache. Right now only ACM certifcates are supported.

func (*Adapter) InstanceID

func (a *Adapter) InstanceID() string

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

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) StackName

func (a *Adapter) StackName() string

StackName returns the Name tag that all resources created by the same CloudFormation stack share. It's taken from The current ec2 instance.

func (*Adapter) VpcID

func (a *Adapter) VpcID() string

VpcID returns the VPC ID the current node belongs to.

type CertDetail added in v0.1.2

type CertDetail struct {
	Arn       string
	AltNames  []string
	NotBefore time.Time
	NotAfter  time.Time
}

CertDetail is the business object for Certificates

func FindBestMatchingCertificate added in v0.1.2

func FindBestMatchingCertificate(certs []*CertDetail, hostname string) (*CertDetail, error)

FindBestMatchingCertificate get all ACM certificates and use a suffix search best match operation in order to find the best matching certificate ARN.

We don't need to validate the Revocation here, because we only pull ISSUED certificates.

type CertificatesProvider added in v0.2.0

type CertificatesProvider interface {
	GetCertificates() ([]*CertDetail, error)
}

CertificatesProvider interface for Certificate Provider like local, AWS IAM or AWS ACM

type LoadBalancer

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

LoadBalancer is a simple wrapper around an AWS Load Balancer details.

func (*LoadBalancer) ARN

func (lb *LoadBalancer) ARN() string

ARN returns the load balancer ARN.

func (*LoadBalancer) CertificateARN

func (lb *LoadBalancer) CertificateARN() string

func (*LoadBalancer) DNSName

func (lb *LoadBalancer) DNSName() string

DNSName returns the FQDN for the load balancer. It's usually prefixed by its Name.

func (*LoadBalancer) Name

func (lb *LoadBalancer) Name() string

Name returns the load balancer friendly name.

Jump to

Keyboard shortcuts

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