Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove legacy ECS scheduler #1001

Merged
merged 1 commit into from
Oct 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 0 additions & 56 deletions cmd/empire/factories.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"github.com/remind101/empire/scheduler"
"github.com/remind101/empire/scheduler/cloudformation"
"github.com/remind101/empire/scheduler/docker"
"github.com/remind101/empire/scheduler/ecs"
"github.com/remind101/empire/stats"
"github.com/remind101/pkg/reporter"
"github.com/remind101/pkg/reporter/hb"
Expand Down Expand Up @@ -97,10 +96,6 @@ func newScheduler(db *empire.DB, c *Context) (scheduler.Scheduler, error) {
)

switch c.String(FlagScheduler) {
case "ecs":
s, err = newECSScheduler(db, c)
case "cloudformation-migration":
s, err = newMigrationScheduler(db, c)
case "cloudformation":
s, err = newCloudFormationScheduler(db, c)
default:
Expand All @@ -121,22 +116,6 @@ func newScheduler(db *empire.DB, c *Context) (scheduler.Scheduler, error) {
return a, nil
}

func newMigrationScheduler(db *empire.DB, c *Context) (*cloudformation.MigrationScheduler, error) {
log.Println("Using the CloudFormation Migration backend")

es, err := newECSScheduler(db, c)
if err != nil {
return nil, fmt.Errorf("error creating ecs scheduler: %v", err)
}

cs, err := newCloudFormationScheduler(db, c)
if err != nil {
return nil, fmt.Errorf("error creating cloudformation scheduler: %v", err)
}

return cloudformation.NewMigrationScheduler(db.DB.DB(), cs, es), nil
}

func newCloudFormationScheduler(db *empire.DB, c *Context) (*cloudformation.Scheduler, error) {
logDriver := c.String(FlagECSLogDriver)
logOpts := c.StringSlice(FlagECSLogOpts)
Expand Down Expand Up @@ -199,41 +178,6 @@ func prefixedStackName(prefix string) *template.Template {
return template.Must(template.New("stack_name").Parse(t))
}

func newECSScheduler(db *empire.DB, c *Context) (*ecs.Scheduler, error) {
logDriver := c.String(FlagECSLogDriver)
logOpts := c.StringSlice(FlagECSLogOpts)
logConfiguration := ecsutil.NewLogConfiguration(logDriver, logOpts)

config := ecs.Config{
AWS: c,
Cluster: c.String(FlagECSCluster),
ServiceRole: c.String(FlagECSServiceRole),
InternalSecurityGroupID: c.String(FlagELBSGPrivate),
ExternalSecurityGroupID: c.String(FlagELBSGPublic),
InternalSubnetIDs: c.StringSlice(FlagEC2SubnetsPrivate),
ExternalSubnetIDs: c.StringSlice(FlagEC2SubnetsPublic),
ZoneID: c.String(FlagRoute53InternalZoneID),
LogConfiguration: logConfiguration,
}

s, err := ecs.NewLoadBalancedScheduler(db.DB.DB(), config)
if err != nil {
return nil, err
}

log.Println("Using ECS backend with the following configuration:")
log.Println(fmt.Sprintf(" Cluster: %v", config.Cluster))
log.Println(fmt.Sprintf(" ServiceRole: %v", config.ServiceRole))
log.Println(fmt.Sprintf(" InternalSecurityGroupID: %v", config.InternalSecurityGroupID))
log.Println(fmt.Sprintf(" ExternalSecurityGroupID: %v", config.ExternalSecurityGroupID))
log.Println(fmt.Sprintf(" InternalSubnetIDs: %v", config.InternalSubnetIDs))
log.Println(fmt.Sprintf(" ExternalSubnetIDs: %v", config.ExternalSubnetIDs))
log.Println(fmt.Sprintf(" ZoneID: %v", config.ZoneID))
log.Println(fmt.Sprintf(" LogConfiguration: %v", logConfiguration))

return s, nil
}

// DockerClient ========================

func newDockerClient(c *Context) (*dockerutil.Client, error) {
Expand Down
4 changes: 2 additions & 2 deletions cmd/empire/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ var Commands = []cli.Command{
},
cli.StringFlag{
Name: FlagScheduler,
Value: "cloudformation-migration",
Usage: "The scheduling backend to use. Current options are `ecs`, `cloudformation-migration`, and `cloudformation`.",
Value: "cloudformation",
Usage: "The scheduling backend to use. Current options are `cloudformation`.",
EnvVar: "EMPIRE_SCHEDULER",
},
cli.StringFlag{
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ server:
environment:
EMPIRE_DATABASE_URL: postgres://postgres:postgres@db/postgres?sslmode=disable
DOCKER_HOST: unix:///var/run/docker.sock
EMPIRE_SCHEDULER: cloudformation-migration
EMPIRE_X_SHOW_ATTACHED: 'true'
db:
image: postgres
214 changes: 0 additions & 214 deletions scheduler/cloudformation/migration.go

This file was deleted.

Loading