remove mesos.go to move it to it's own PR

Signed-off-by: Victor Vieux <vieux@docker.com>
This commit is contained in:
Victor Vieux 2015-02-26 17:59:22 -08:00
parent a8885ab997
commit 8b7afe2c73
3 changed files with 2 additions and 93 deletions

View File

@ -318,6 +318,7 @@ func proxyRandom(c *context, w http.ResponseWriter, r *http.Request) {
candidates := []cluster.Node{}
// FIXME: doesn't work if there are no container in the cluster
// remove proxyRandom and implemente the features locally
for _, container := range c.cluster.Containers() {
candidates = append(candidates, container.Node)
}

View File

@ -1,82 +0,0 @@
package mesos
import (
"errors"
"sync"
log "github.com/Sirupsen/logrus"
"github.com/docker/swarm/cluster"
"github.com/docker/swarm/scheduler"
"github.com/samalba/dockerclient"
)
var ErrNotImplemented = errors.New("not implemented in the mesos cluster")
type MesosCluster struct {
sync.Mutex
//TODO: list of mesos masters
//TODO: list of offers
scheduler *scheduler.Scheduler
options *cluster.Options
}
func NewCluster(scheduler *scheduler.Scheduler, options *cluster.Options) cluster.Cluster {
log.WithFields(log.Fields{"name": "mesos"}).Debug("Initializing cluster")
//TODO: get the list of mesos masters using options.Discovery (zk://<ip1>,<ip2>,<ip3>/mesos)
return &MesosCluster{
scheduler: scheduler,
options: options,
}
}
// Schedule a brand new container into the cluster.
func (s *MesosCluster) CreateContainer(config *dockerclient.ContainerConfig, name string) (*cluster.Container, error) {
s.Lock()
defer s.Unlock()
//TODO: pick the right offer (using strategy & filters)
//offer, err := s.scheduler.SelectNodeForContainer(s.offers, config)
//TODO: LaunchTask on the Mesos cluster and get container
//TODO: Store container in store ??
return nil, ErrNotImplemented
}
// Remove a container from the cluster. Containers should always be destroyed
// through the scheduler to guarantee atomicity.
func (s *MesosCluster) RemoveContainer(container *cluster.Container, force bool) error {
s.Lock()
defer s.Unlock()
//TODO: KillTask
//TODO: remove container from store ??
return ErrNotImplemented
}
func (s *MesosCluster) Images() []*cluster.Image {
return nil
}
func (s *MesosCluster) Image(IdOrName string) *cluster.Image {
return nil
}
func (s *MesosCluster) Containers() []*cluster.Container {
return nil
}
func (s *MesosCluster) Container(IdOrName string) *cluster.Container {
return nil
}
func (s *MesosCluster) Info() [][2]string {
return nil
}

View File

@ -11,7 +11,6 @@ import (
"github.com/codegangsta/cli"
"github.com/docker/swarm/api"
"github.com/docker/swarm/cluster"
"github.com/docker/swarm/cluster/mesos"
"github.com/docker/swarm/cluster/swarm"
"github.com/docker/swarm/scheduler"
"github.com/docker/swarm/scheduler/filter"
@ -128,16 +127,7 @@ func manage(c *cli.Context) {
Heartbeat: c.Int("heartbeat"),
}
var cluster cluster.Cluster
switch c.String("cluster") {
case "swarm":
cluster = swarm.NewCluster(sched, store, eventsHandler, options)
case "mesos":
cluster = mesos.NewCluster(sched, options)
default:
log.Fatalf("cluster %q not supported", c.String("cluster"))
}
cluster := swarm.NewCluster(sched, store, eventsHandler, options)
// see https://github.com/codegangsta/cli/issues/160
hosts := c.StringSlice("host")