Documentation ¶
Index ¶
- func AddCockroachSecurityGroupIngress(region string, cockroachPort int64, securityGroupID string) error
- func AddNodeToELB(region string, instanceID string) error
- func CreateCockroachELB(region string, cockroachPort int64, zone string, securityGroupID string) (string, error)
- func FindCockroachELB(region string) (string, error)
- func FindDefaultVPC(region string) (string, error)
- func FindOrCreateLoadBalancer(region string, cockroachPort int64, zone string, securityGroupID string) (string, error)
- func FindSecurityGroup(region string) (string, error)
- func IsAWSErrorCode(err error, code string) bool
- func LoadAWSCredentials() (string, string, error)
- func RemoveNodeFromELB(region string, instanceID string) error
- type Amazon
- func (a *Amazon) AfterFirstNode() error
- func (a *Amazon) Context() *base.Context
- func (a *Amazon) DockerMachineCreateArgs() []string
- func (a *Amazon) DockerMachineDriver() string
- func (a *Amazon) GetNodeConfig(name string) (*drivers.HostConfig, error)
- func (a *Amazon) Init() error
- func (a *Amazon) PrintStatus()
- func (a *Amazon) StartNode(name string, cfg *drivers.HostConfig) error
- func (a *Amazon) StopNode(name string, cfg *drivers.HostConfig) error
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
NewDriver returns an initialized Amazon driver. TODO(marc): we should keep initialized services (eg: elb, ec2).
func (*Amazon) AfterFirstNode ¶
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) DockerMachineCreateArgs ¶
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 ¶
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) 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.