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 booleancanStartPod(uk.co.ractf.polaris.api.pod.Container pod)Returns if the runner is currently able to start thisPodvoidcreateNetwork(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.voidcreatePod(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 aPodwith givenInstancedetailsvoidforceUpdatePod(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 specificInstanceof aPodvoidgarbageCollect()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.StringgetName()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 ofPodthis runner can runbooleanisPodStarted(uk.co.ractf.polaris.api.pod.Container pod, uk.co.ractf.polaris.api.instance.Instance instance)Returns if the runner has started thisInstanceof thisPodvoidkillOrphans()Find orphaned pods that are not tracked in theControllerand kill themvoidpreparePod(uk.co.ractf.polaris.api.task.Task task, uk.co.ractf.polaris.api.pod.Container pod)Prepares aPodthat currently cannot be started so it can be started in the future (e.g.voidrestartPod(uk.co.ractf.polaris.api.pod.Container pod, uk.co.ractf.polaris.api.instance.Instance instance)Restart a specificInstanceof aPodvoidstartPod(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 aPodwith givenInstancedetailsvoidstopPod(uk.co.ractf.polaris.api.pod.Container pod, uk.co.ractf.polaris.api.instance.Instance instance)Stops aPodwith givenInstancedetailsvoidupdatePod(uk.co.ractf.polaris.api.task.Task task, uk.co.ractf.polaris.api.pod.Container pod)Update aPodif 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:RunnerCreates aPodwith givenInstancedetails
-
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:RunnerStarts aPodwith givenInstancedetails
-
stopPod
public void stopPod(uk.co.ractf.polaris.api.pod.Container pod, uk.co.ractf.polaris.api.instance.Instance instance)Description copied from interface:RunnerStops aPodwith givenInstancedetails
-
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:RunnerForcefully update a specificInstanceof aPod- Specified by:
forceUpdatePodin 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:RunnerUpdate aPodif 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:RunnerRestart a specificInstanceof aPod- Specified by:
restartPodin 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:RunnerReturns if the runner is currently able to start thisPod- Specified by:
canStartPodin 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:RunnerReturns if the runner has started thisInstanceof thisPod- Specified by:
isPodStartedin 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:RunnerPrepares aPodthat currently cannot be started so it can be started in the future (e.g.DockerRunnerwill pull the docker image)- Specified by:
preparePodin 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:RunnerClean up after pods that are currently dead- Specified by:
garbageCollectin interfaceRunner<uk.co.ractf.polaris.api.pod.Container>
-
killOrphans
public void killOrphans()
Description copied from interface:RunnerFind orphaned pods that are not tracked in theControllerand kill them- Specified by:
killOrphansin 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:RunnerReturns a class of type T where T is the type ofPodthis runner can run
-
getName
public java.lang.String getName()
Description copied from interface:RunnerGets the name of the runner.
-
getImages
public java.util.List<java.lang.String> getImages()
Description copied from interface:RunnerReturns 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:RunnerCreates a network between a list of pods.- Specified by:
createNetworkin interfaceRunner<uk.co.ractf.polaris.api.pod.Container>- Parameters:
pods- the pods to networktask- the task the pods belong to.instance- the instance
-
-