Re: Mesos Flocker - Custom Isolator and Docker

2015-11-25 Thread Phil Winder

Thanks Stephan.

Do you have a rough estimate on that feature?

In the mean time, is overriding the DockerContainerizer to manually call 
the isolator methods a viable option?


Phil

On 25/11/2015 12:03, Erb, Stephan wrote:

Hi Frank,

the way I understand it, it will soon be possible to use custom and default 
Mesos isolators together with Docker via the unified container support in 
Mesos. Basically, goal is is to support docker image format without relying on 
docker daemon.

https://issues.apache.org/jira/browse/MESOS-2840

Best Regards,
Stephan

From: Frank Scholten 
Sent: Wednesday, November 25, 2015 11:50 AM
To: modules@mesos.apache.org
Subject: Mesos Flocker - Custom Isolator and Docker

Hi all,

We (Frank Scholten and Phil Winder) are currently developing the Mesos
Flocker framework. As part of this framework we want to develop a
custom isolator module which interacts with the Flocker Control
Service.

After creating a simple stub isolator and installing it on one of the
agents we noticed it gets picked up we run a regular task but it does
not get picked up when we run a Docker container.

To us it seems that this is because isolators can only be used by the
MesosContainerizer. The MesosContainerizer configures isolation in its
create factory method while the DockerContainerizes does not:

MesosContainerizer

Try MesosContainerizer::create(
 const Flags& flags,
 bool local,
 Fetcher* fetcher)
{
   string isolation;

   if (flags.isolation == "process") {
 LOG(WARNING) << "The 'process' isolation flag is deprecated, "
  << "please update your flags to"
  << " '--isolation=posix/cpu,posix/mem'.";

 isolation = "posix/cpu,posix/mem";
   } else if (flags.isolation == "cgroups") {
 LOG(WARNING) << "The 'cgroups' isolation flag is deprecated, "
  << "please update your flags to"
  << " '--isolation=cgroups/cpu,cgroups/mem'.";

 isolation = "cgroups/cpu,cgroups/mem";
   } else {
 isolation = flags.isolation;
   }

DockerContainerizer

Try DockerContainerizer::create(
 const Flags& flags,
 Fetcher* fetcher)
{
   Try create = Docker::create(flags.docker, flags.docker_socket, 
true);
   if (create.isError()) {
 return Error("Failed to create docker: " + create.error());
   }

   Shared docker(create.get());

   if (flags.docker_mesos_image.isSome()) {
 Try validateResult = docker->validateVersion(Version(1, 5, 0));
 if (validateResult.isError()) {
   string message = "Docker with mesos images requires docker 1.5+";
   message += validateResult.error();
   return Error(message);
 }
   }

   return new DockerContainerizer(flags, fetcher, docker);
}

The question now is how can we create an isolator to work together
with the DockerContainerizer. Should we subclass the
DockerContainerizer and create a FlockerContainerizer instead? Any
other suggestions?

Thanks in advance.

Cheers,

Frank and Phil




Re: Mesos Flocker - Custom Isolator and Docker

2015-11-25 Thread Erb, Stephan
Hi Frank,

the way I understand it, it will soon be possible to use custom and default 
Mesos isolators together with Docker via the unified container support in 
Mesos. Basically, goal is is to support docker image format without relying on 
docker daemon.

https://issues.apache.org/jira/browse/MESOS-2840

Best Regards,
Stephan

From: Frank Scholten 
Sent: Wednesday, November 25, 2015 11:50 AM
To: modules@mesos.apache.org
Subject: Mesos Flocker - Custom Isolator and Docker

Hi all,

We (Frank Scholten and Phil Winder) are currently developing the Mesos
Flocker framework. As part of this framework we want to develop a
custom isolator module which interacts with the Flocker Control
Service.

After creating a simple stub isolator and installing it on one of the
agents we noticed it gets picked up we run a regular task but it does
not get picked up when we run a Docker container.

To us it seems that this is because isolators can only be used by the
MesosContainerizer. The MesosContainerizer configures isolation in its
create factory method while the DockerContainerizes does not:

MesosContainerizer

Try MesosContainerizer::create(
const Flags& flags,
bool local,
Fetcher* fetcher)
{
  string isolation;

  if (flags.isolation == "process") {
LOG(WARNING) << "The 'process' isolation flag is deprecated, "
 << "please update your flags to"
 << " '--isolation=posix/cpu,posix/mem'.";

isolation = "posix/cpu,posix/mem";
  } else if (flags.isolation == "cgroups") {
LOG(WARNING) << "The 'cgroups' isolation flag is deprecated, "
 << "please update your flags to"
 << " '--isolation=cgroups/cpu,cgroups/mem'.";

isolation = "cgroups/cpu,cgroups/mem";
  } else {
isolation = flags.isolation;
  }

DockerContainerizer

Try DockerContainerizer::create(
const Flags& flags,
Fetcher* fetcher)
{
  Try create = Docker::create(flags.docker, flags.docker_socket, true);
  if (create.isError()) {
return Error("Failed to create docker: " + create.error());
  }

  Shared docker(create.get());

  if (flags.docker_mesos_image.isSome()) {
Try validateResult = docker->validateVersion(Version(1, 5, 0));
if (validateResult.isError()) {
  string message = "Docker with mesos images requires docker 1.5+";
  message += validateResult.error();
  return Error(message);
}
  }

  return new DockerContainerizer(flags, fetcher, docker);
}

The question now is how can we create an isolator to work together
with the DockerContainerizer. Should we subclass the
DockerContainerizer and create a FlockerContainerizer instead? Any
other suggestions?

Thanks in advance.

Cheers,

Frank and Phil