Class DockerRunner
- java.lang.Object
-
- uk.co.ractf.polaris.node.runner.docker.DockerRunner
-
-
Constructor Summary
Constructors Constructor Description DockerRunner(com.github.dockerjava.api.DockerClient dockerClient, Node node, ClusterState state, AuthConfigFactory authConfigFactory, NotificationFacade notifications)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canStartPod(uk.co.ractf.polaris.api.pod.Container pod)
Returns if the runner is currently able to start thisPod
void
createNetwork(java.util.List<uk.co.ractf.polaris.api.pod.Container> pods, uk.co.ractf.polaris.api.task.Task task, uk.co.ractf.polaris.api.instance.Instance instance)
Creates a network between a list of pods.void
createPod(uk.co.ractf.polaris.api.task.Task task, uk.co.ractf.polaris.api.pod.Container container, uk.co.ractf.polaris.api.instance.Instance instance)
Creates aPod
with givenInstance
detailsvoid
forceUpdatePod(uk.co.ractf.polaris.api.task.Task task, uk.co.ractf.polaris.api.pod.Container pod, uk.co.ractf.polaris.api.instance.Instance instance)
Forcefully update a specificInstance
of aPod
void
garbageCollect()
Clean up after pods that are currently deadjava.util.List<java.lang.String>
getImages()
Returns the images that can be used by this runner and are stored locally on the node.java.lang.String
getName()
Gets the name of the runner.java.lang.Class<uk.co.ractf.polaris.api.pod.Container>
getType()
Returns a class of type T where T is the type ofPod
this runner can runboolean
isPodStarted(uk.co.ractf.polaris.api.pod.Container pod, uk.co.ractf.polaris.api.instance.Instance instance)
Returns if the runner has started thisInstance
of thisPod
void
killOrphans()
Find orphaned pods that are not tracked in theController
and kill themvoid
preparePod(uk.co.ractf.polaris.api.task.Task task, uk.co.ractf.polaris.api.pod.Container pod)
Prepares aPod
that currently cannot be started so it can be started in the future (e.g.void
restartPod(uk.co.ractf.polaris.api.pod.Container pod, uk.co.ractf.polaris.api.instance.Instance instance)
Restart a specificInstance
of aPod
void
startPod(uk.co.ractf.polaris.api.task.Task task, uk.co.ractf.polaris.api.pod.Container container, uk.co.ractf.polaris.api.instance.Instance instance)
Starts aPod
with givenInstance
detailsvoid
stopPod(uk.co.ractf.polaris.api.pod.Container pod, uk.co.ractf.polaris.api.instance.Instance instance)
Stops aPod
with givenInstance
detailsvoid
updatePod(uk.co.ractf.polaris.api.task.Task task, uk.co.ractf.polaris.api.pod.Container pod)
Update aPod
if an update is available.
-
-
-
Constructor Detail
-
DockerRunner
@Inject public DockerRunner(com.github.dockerjava.api.DockerClient dockerClient, Node node, ClusterState state, AuthConfigFactory authConfigFactory, NotificationFacade notifications)
-
-
Method Detail
-
createPod
public void createPod(uk.co.ractf.polaris.api.task.Task task, uk.co.ractf.polaris.api.pod.Container container, uk.co.ractf.polaris.api.instance.Instance instance)
Description copied from interface:Runner
Creates aPod
with givenInstance
details
-
startPod
public void startPod(uk.co.ractf.polaris.api.task.Task task, uk.co.ractf.polaris.api.pod.Container container, uk.co.ractf.polaris.api.instance.Instance instance)
Description copied from interface:Runner
Starts aPod
with givenInstance
details
-
stopPod
public void stopPod(uk.co.ractf.polaris.api.pod.Container pod, uk.co.ractf.polaris.api.instance.Instance instance)
Description copied from interface:Runner
Stops aPod
with givenInstance
details
-
forceUpdatePod
public void forceUpdatePod(uk.co.ractf.polaris.api.task.Task task, uk.co.ractf.polaris.api.pod.Container pod, uk.co.ractf.polaris.api.instance.Instance instance)
Description copied from interface:Runner
Forcefully update a specificInstance
of aPod
- Specified by:
forceUpdatePod
in interfaceRunner<uk.co.ractf.polaris.api.pod.Container>
pod
- the podinstance
- the instance to update
-
updatePod
public void updatePod(uk.co.ractf.polaris.api.task.Task task, uk.co.ractf.polaris.api.pod.Container pod)
Description copied from interface:Runner
Update aPod
if an update is available.
-
restartPod
public void restartPod(uk.co.ractf.polaris.api.pod.Container pod, uk.co.ractf.polaris.api.instance.Instance instance)
Description copied from interface:Runner
Restart a specificInstance
of aPod
- Specified by:
restartPod
in interfaceRunner<uk.co.ractf.polaris.api.pod.Container>
- Parameters:
pod
- the podinstance
- the instance to restart
-
canStartPod
public boolean canStartPod(uk.co.ractf.polaris.api.pod.Container pod)
Description copied from interface:Runner
Returns if the runner is currently able to start thisPod
- Specified by:
canStartPod
in interfaceRunner<uk.co.ractf.polaris.api.pod.Container>
- Parameters:
pod
- the pod- Returns:
- can it be started
-
isPodStarted
public boolean isPodStarted(uk.co.ractf.polaris.api.pod.Container pod, uk.co.ractf.polaris.api.instance.Instance instance)
Description copied from interface:Runner
Returns if the runner has started thisInstance
of thisPod
- Specified by:
isPodStarted
in interfaceRunner<uk.co.ractf.polaris.api.pod.Container>
- Parameters:
pod
- the podinstance
- the instance- Returns:
- if its started
-
preparePod
public void preparePod(uk.co.ractf.polaris.api.task.Task task, uk.co.ractf.polaris.api.pod.Container pod)
Description copied from interface:Runner
Prepares aPod
that currently cannot be started so it can be started in the future (e.g.DockerRunner
will pull the docker image)- Specified by:
preparePod
in interfaceRunner<uk.co.ractf.polaris.api.pod.Container>
- Parameters:
task
- the task the pod belongs topod
- the pod to prepare
-
garbageCollect
public void garbageCollect()
Description copied from interface:Runner
Clean up after pods that are currently dead- Specified by:
garbageCollect
in interfaceRunner<uk.co.ractf.polaris.api.pod.Container>
-
killOrphans
public void killOrphans()
Description copied from interface:Runner
Find orphaned pods that are not tracked in theController
and kill them- Specified by:
killOrphans
in interfaceRunner<uk.co.ractf.polaris.api.pod.Container>
-
getType
public java.lang.Class<uk.co.ractf.polaris.api.pod.Container> getType()
Description copied from interface:Runner
Returns a class of type T where T is the type ofPod
this runner can run
-
getName
public java.lang.String getName()
Description copied from interface:Runner
Gets the name of the runner.
-
getImages
public java.util.List<java.lang.String> getImages()
Description copied from interface:Runner
Returns the images that can be used by this runner and are stored locally on the node.
-
createNetwork
public void createNetwork(java.util.List<uk.co.ractf.polaris.api.pod.Container> pods, uk.co.ractf.polaris.api.task.Task task, uk.co.ractf.polaris.api.instance.Instance instance)
Description copied from interface:Runner
Creates a network between a list of pods.- Specified by:
createNetwork
in interfaceRunner<uk.co.ractf.polaris.api.pod.Container>
- Parameters:
pods
- the pods to networktask
- the task the pods belong to.instance
- the instance
-
-