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 ¶
- Variables
- type Adapter
- func (a *Adapter) AutoScalingGroupName() string
- func (a *Adapter) ClusterID() string
- func (a *Adapter) CreateLoadBalancer(certificateARN string) (*LoadBalancer, error)
- func (a *Adapter) DeleteLoadBalancer(loadBalancer *LoadBalancer) error
- func (a *Adapter) FindLoadBalancerWithCertificateID(certificateARN string) (*LoadBalancer, error)
- func (a *Adapter) FindManagedLoadBalancers() ([]*LoadBalancer, error)
- func (a *Adapter) InstanceID() string
- func (a *Adapter) PrivateSubnetIDs() []string
- func (a *Adapter) PublicSubnetIDs() []string
- func (a *Adapter) SecurityGroupID() string
- func (a *Adapter) StackName() string
- func (a *Adapter) VpcID() string
- type LoadBalancer
Constants ¶
This section is empty.
Variables ¶
var ( // ErrSecurityGroupNotFound 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`) )
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 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 ¶
AutoScalingGroupName returns the name of the Auto Scaling Group the current node belongs to
func (*Adapter) ClusterID ¶
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) 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) InstanceID ¶
InstanceID returns the instance ID the current node is running on.
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.
type LoadBalancer ¶
type LoadBalancer struct {
// contains filtered or unexported fields
}
LoadBalancer is a simple wrapper around an AWS Load Balancer details.
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.