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) FindBestMatchingCertificate(certs []*CertDetail, hostname string) (*CertDetail, error)
- func (a *Adapter) FindLoadBalancerWithCertificateID(certificateARN string) (*LoadBalancer, error)
- func (a *Adapter) FindManagedLoadBalancers() ([]*LoadBalancer, error)
- func (a *Adapter) GetCerts() []*CertDetail
- 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 CertDetail
- type CertificatesProvider
- type LoadBalancer
Constants ¶
This section is empty.
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") // 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 ¶
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) 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 ¶
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 CertDetail ¶ added in v0.1.2
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) 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.