Documentation ¶
Overview ¶
Pacakge ecs provides an implementation of the Scheduler interface that uses Amazon EC2 Container Service.
Index ¶
- Variables
- type Config
- type LBProcessManager
- type LoadBalancerExposureError
- type LoadBalancerPortMismatchError
- type ProcessManager
- type Scheduler
- func (m *Scheduler) Instances(ctx context.Context, appID string) ([]*scheduler.Instance, error)
- func (m *Scheduler) Remove(ctx context.Context, appID string) error
- func (m *Scheduler) Stop(ctx context.Context, instanceID string) error
- func (m *Scheduler) Submit(ctx context.Context, app *scheduler.App) error
Constants ¶
This section is empty.
Variables ¶
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 ¶
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 ¶
func (e *LoadBalancerPortMismatchError) Error() string
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 ¶
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 ¶
NewScheduler returns a new Scehduler implementation that:
* Creates services with ECS.
func (*Scheduler) Instances ¶
Instances returns all instances that are currently running, pending or draining.
func (*Scheduler) Submit ¶
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.