ecs

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2016 License: BSD-2-Clause Imports: 16 Imported by: 0

Documentation

Overview

Pacakge ecs provides an implementation of the Scheduler interface that uses Amazon EC2 Container Service.

Index

Constants

This section is empty.

Variables

View Source
var DefaultDelimiter = "-"

Functions

This section is empty.

Types

type Config

type Config struct {
	// The ECS cluster to create services and task definitions in.
	Cluster string

	// The IAM role to use for ECS services with ELBs attached.
	ServiceRole string

	// VPC controls what subnets to attach to ELBs that are created.
	VPC string

	// The hosted zone id to create internal DNS records in
	ZoneID string

	// The ID of the security group to assign to internal load balancers.
	InternalSecurityGroupID string

	// The ID of the security group to assign to external load balancers.
	ExternalSecurityGroupID string

	// The Subnet IDs to assign when creating internal load balancers.
	InternalSubnetIDs []string

	// The Subnet IDs to assign when creating external load balancers.
	ExternalSubnetIDs []string

	// AWS configuration.
	AWS client.ConfigProvider
}

Config holds configuration for generating a new ECS backed Scheduler implementation.

type LBProcessManager

type LBProcessManager struct {
	ProcessManager
	// contains filtered or unexported fields
}

LBProcessManager is an implementation of the ProcessManager interface that creates LoadBalancers when a Process is created.

func (*LBProcessManager) CreateProcess

func (m *LBProcessManager) CreateProcess(ctx context.Context, app *scheduler.App, p *scheduler.Process) error

CreateProcess ensures that there is a load balancer for the process, then creates it. It uses the following algorithm:

* Attempt to find existing load balancer. * If the load balancer exists, check that the exposure is appropriate for the process. * If the load balancer's External attribute doesn't match what we want. Delete the process, also deleting the load balancer. * Create the load balancer * Attach it to the process.

func (*LBProcessManager) RemoveProcess

func (m *LBProcessManager) RemoveProcess(ctx context.Context, app string, p string) error

RemoveProcess removes the process then removes the associated LoadBalancer.

type LoadBalancerExposureError

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

LoadBalancerExposureError is returned when the exposure of the process in the data store does not match the exposure of the ELB

func (*LoadBalancerExposureError) Error

func (e *LoadBalancerExposureError) Error() string

type LoadBalancerPortMismatchError

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

LoadBalancerPortMismatchError is returned when the port stored in the data store does not match the ELB instance port

func (*LoadBalancerPortMismatchError) Error

type ProcessManager

type ProcessManager interface {
	scheduler.Scaler
	scheduler.Runner

	// CreateProcess creates a process for the app.
	CreateProcess(ctx context.Context, app *scheduler.App, process *scheduler.Process) error

	// RemoveProcess removes a process for the app.
	RemoveProcess(ctx context.Context, app string, process string) error

	// Processes returns all processes for the app.
	Processes(ctx context.Context, app string) ([]*scheduler.Process, error)
}

ProcessManager is a lower level interface than Scheduler, that provides direct control over individual processes.

type Scheduler

type Scheduler struct {
	ProcessManager
	// contains filtered or unexported fields
}

Scheduler is an implementation of the ServiceManager interface that is backed by Amazon ECS.

func NewLoadBalancedScheduler

func NewLoadBalancedScheduler(config Config) (*Scheduler, error)

NewLoadBalancedScheduler returns a new Scheduler instance that:

* Creates services with ECS. * Creates internal or external ELBs for ECS services. * Creates a CNAME record in route53 under the internal TLD.

func NewScheduler

func NewScheduler(config Config) (*Scheduler, error)

NewScheduler returns a new Scehduler implementation that:

* Creates services with ECS.

func (*Scheduler) Instances

func (m *Scheduler) Instances(ctx context.Context, appID string) ([]*scheduler.Instance, error)

Instances returns all instances that are currently running, pending or draining.

func (*Scheduler) Remove

func (m *Scheduler) Remove(ctx context.Context, appID string) error

Remove removes any ECS services that belong to this app.

func (*Scheduler) Stop

func (m *Scheduler) Stop(ctx context.Context, instanceID string) error

func (*Scheduler) Submit

func (m *Scheduler) Submit(ctx context.Context, app *scheduler.App) error

Submit will create an ECS service for each individual process in the App. New task definitions will be created based on the information with each process.

If the app was previously submitted with different process than what are provided, any process types that don't exist in the new release will be removed from ECS. For example, if you previously submitted an app with a `web` and `worker` process, then submit an app with the `web` process, the ECS service for the old `worker` process will be removed.

Jump to

Keyboard shortcuts

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