amazon

package
v0.0.0-...-6dffcca Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2015 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCockroachSecurityGroupIngress

func AddCockroachSecurityGroupIngress(region string, cockroachPort int64, securityGroupID string) error

AddCockroachSecurityGroupIngress takes in a nodeInfo and adds the cockroach port ingress rules to the security group. The To and From ports are set to 'cockroachPort'. Duplicates are technically errors according to the AWS API, but we check for the duplicate error code and return ok.

func AddNodeToELB

func AddNodeToELB(region string, instanceID string) error

AddNodeToELB adds the specified node to the cockroach load balancer. This can only succeed if the cockroach ELB exists.

func CreateCockroachELB

func CreateCockroachELB(region string, cockroachPort int64, zone string, securityGroupID string) (string, error)

CreateCockroachELB creates a new load balancer in the given region. It uses the nodeInfo and cockroachPort to fill in the request. Returns the external DNS name of the created load balancer. We cannot specify health check parameters at creation time, but AWS uses the following defaults: target: TCP:instance_port timeout: 5s interval: 30s thresholds: unhealthy:2, heathy:10 TODO(marc): we should call ConfigureHealthCheck

func FindCockroachELB

func FindCockroachELB(region string) (string, error)

FindCockroachELB looks for the cockroach ELB in the given region and returns its external DNS name if found. If not found, err=nil and dnsName="".

func FindDefaultVPC

func FindDefaultVPC(region string) (string, error)

FindDefaultVPC looks for the default VPC in a given region and returns its ID if found.

func FindOrCreateLoadBalancer

func FindOrCreateLoadBalancer(region string, cockroachPort int64, zone string,
	securityGroupID string) (string, error)

FindOrCreateLoadBalancer looks for the cockroach load balancer and creates it if it does not exist. Returns the external DNS name of the load balancer.

func FindSecurityGroup

func FindSecurityGroup(region string) (string, error)

FindSecurityGroup looks for the security group created by docker-machine. We needs its ID for other EC2 tasks (eg: create load balancer). Not finding the security group is an error.

func IsAWSErrorCode

func IsAWSErrorCode(err error, code string) bool

IsAWSErrorCode takes a AWS error code string (eg: InvalidPermission.Duplicate) and returns true if the given error matches. Returns false on any of the following conditions: - err is nil - err does not implement awserr.Error - err.Code() does not match

func LoadAWSCredentials

func LoadAWSCredentials() (string, string, error)

LoadAWSCredentials loads the credentials using the AWS api. This automatically loads from ENV, or from the .aws/credentials file. Returns the key-id and secret-key.

func RemoveNodeFromELB

func RemoveNodeFromELB(region string, instanceID string) error

RemoveNodeFromELB removes the specified node from the cockroach load balancer. This can only succeed if the cockroach ELB exists.

Types

type Amazon

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

Amazon implements a driver for AWS. This is not synchronized: be careful.

func NewDriver

func NewDriver(context *base.Context, region string) *Amazon

NewDriver returns an initialized Amazon driver. TODO(marc): we should keep initialized services (eg: elb, ec2).

func (*Amazon) AfterFirstNode

func (a *Amazon) AfterFirstNode() error

AfterFirstNode runs any steps needed after the first node was created. This tweaks the security group to allow cockroach ports and creates the load balancer.

func (*Amazon) Context

func (a *Amazon) Context() *base.Context

Context returns the base context.

func (*Amazon) DockerMachineCreateArgs

func (a *Amazon) DockerMachineCreateArgs() []string

DockerMachineCreateArgs returns the list of driver-specific arguments to pass to 'docker-machine create' TODO(marc): there are many other flags, see 'docker-machine help create'

func (*Amazon) DockerMachineDriver

func (a *Amazon) DockerMachineDriver() string

DockerMachineDriver returns the name of the docker-machine driver.

func (*Amazon) GetNodeConfig

func (a *Amazon) GetNodeConfig(name string) (*drivers.HostConfig, error)

GetNodeConfig takes a node name and reads its docker-machine config. The LoadBalancerAddress is looked up and filled in.

func (*Amazon) Init

func (a *Amazon) Init() error

Init looks for AWS credentials.

func (*Amazon) PrintStatus

func (a *Amazon) PrintStatus()

PrintStatus prints the load balancer address to stdout. Do not call the "getOrInit*" methods here, we only want to look things up.

func (*Amazon) StartNode

func (a *Amazon) StartNode(name string, cfg *drivers.HostConfig) error

StartNode adds the node to the load balancer. ELB takes forever checking a stopped and started node, so we have to remove it at stopping time, and re-register it start time.

func (*Amazon) StopNode

func (a *Amazon) StopNode(name string, cfg *drivers.HostConfig) error

StopNode removes the node from the load balancer. ELB takes forever checking a stopped and started node, so we have to remove it at stopping time, and re-register it start time.

Jump to

Keyboard shortcuts

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