Example #1
0
File: ecs.go Project: mhahn/empire
func newScheduler(config Config) *Scheduler {
	c := ecsutil.NewClient(config.AWS)

	return &Scheduler{
		cluster:          config.Cluster,
		serviceRole:      config.ServiceRole,
		ecs:              c,
		logConfiguration: config.LogConfiguration,
	}
}
Example #2
0
File: ecs.go Project: 4eek/empire
// NewScheduler returns a new Scehduler implementation that:
//
// * Creates services with ECS.
func NewScheduler(config Config) (*Scheduler, error) {
	c := ecsutil.NewClient(config.AWS)

	// Create the ECS Scheduler
	var pm ProcessManager = &ecsProcessManager{
		cluster:     config.Cluster,
		serviceRole: config.ServiceRole,
		ecs:         c,
	}

	return &Scheduler{
		cluster:        config.Cluster,
		ProcessManager: pm,
		ecs:            c,
	}, nil
}
Example #3
0
File: ecs.go Project: intfrr/empire
// 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 NewLoadBalancedScheduler(config Config) (*Scheduler, error) {
	if err := validateLoadBalancedConfig(config); err != nil {
		return nil, err
	}

	c := ecsutil.NewClient(config.AWS)

	// Create the ECS Scheduler
	var pm ProcessManager = &ecsProcessManager{
		cluster:          config.Cluster,
		serviceRole:      config.ServiceRole,
		ecs:              c,
		logConfiguration: config.LogConfiguration,
	}

	// Create the ELB Manager
	elb := lb.NewELBManager(config.AWS)
	elb.InternalSecurityGroupID = config.InternalSecurityGroupID
	elb.ExternalSecurityGroupID = config.ExternalSecurityGroupID
	elb.InternalSubnetIDs = config.InternalSubnetIDs
	elb.ExternalSubnetIDs = config.ExternalSubnetIDs

	// Compose the LB Manager
	var lbm lb.Manager = elb

	n := lb.NewRoute53Nameserver(config.AWS)
	n.ZoneID = config.ZoneID

	lbm = lb.WithCNAME(lbm, n)
	lbm = lb.WithLogging(lbm)

	pm = &LBProcessManager{
		ProcessManager: pm,
		lb:             lbm,
	}

	return &Scheduler{
		cluster:        config.Cluster,
		ProcessManager: pm,
		ecs:            c,
	}, nil
}