Package uk.co.ractf.polaris.api.pod
Class Container
- java.lang.Object
-
- uk.co.ractf.polaris.api.common.JsonRepresentable
-
- uk.co.ractf.polaris.api.pod.Pod
-
- uk.co.ractf.polaris.api.pod.Container
-
- All Implemented Interfaces:
AutoUpdatable
,PodWithAffinity
,PodWithPorts
,ResourceLimited
public class Container extends Pod implements ResourceLimited, PodWithPorts, PodWithAffinity, AutoUpdatable
An implementation ofPod
that represents a Docker container{ "type": "container", "id": "example1", "image": "docker.io/bfirsh/reticulate-splines", "repo": "dockerhub", "entrypoint": [], "env": { "aaa": "bbb" }, "randomEnv": { "test": { "type": "string", "length": 6, "alphabet": "1234567890abcdef" }, "test2": { "type": "int", "min": 69, "max": 420 } }, "labels": { "key": "value" }, "affinity": ["aslr"], "antiaffinity": ["ARM"], "resourceQuota": { "memory": 536870912, "swap": 0, "nanocpu": 10000000 }, "capDrop": ["BLOCK_SUSPEND"], "capAdd": ["MKNOD"], "restartPolicy": "always", "healthcheck": [ { "id": "tcpconnect", "type": "tcp", "port": 6000, "timeout": 5 }, { "id": "flagcheck", "type": "tcppayload", "payloads": [ { "type": "send", "hex": "deadbeef" }, { "type": "receiveexact", "hex": "deadbeef" }, { "type": "receiveregex", "hex": ".*" } ] }, { "id": "web", "type": "http", "path": "/test", "port": 80, "vhost": "dave.lc" } ], "terminationTimeout": 5, "metadata": { "aaa": "bbb" }, "portMappings": [ { "port": 6000, "protocol": "tcp", "advertise": true } ] }
-
-
Constructor Summary
Constructors Constructor Description Container(java.lang.String type, java.lang.String id, java.lang.String image, java.lang.String repo, NamespacedId repoCredentials, java.util.List<java.lang.String> entrypoint, java.util.Map<java.lang.String,java.lang.String> env, java.util.Map<java.lang.String,RandomEnv> randomEnv, java.util.Map<java.lang.String,java.lang.String> labels, java.util.Map<java.lang.String,java.lang.String> affinity, java.util.Map<java.lang.String,java.lang.String> antiaffinity, ResourceQuota resourceQuota, java.lang.String restartPolicy, java.util.List<java.lang.String> capDrop, java.util.List<java.lang.String> capAdd, java.util.List<HealthCheck> healthChecks, java.lang.Integer terminationTimeout, java.util.List<PortMapping> portMappings, java.util.Map<java.lang.String,java.lang.String> metadata, boolean autoUpdate, java.util.List<java.lang.String> securityOptions)
Creates a container
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canUseRunner(java.lang.String runner)
boolean
equals(java.lang.Object o)
java.util.Map<java.lang.String,java.lang.String>
getAffinity()
java.util.Map<java.lang.String,java.lang.String>
getAntiaffinity()
java.util.List<java.lang.String>
getCapAdd()
java.util.List<java.lang.String>
getCapDrop()
java.util.List<java.lang.String>
getEntrypoint()
java.util.Map<java.lang.String,java.lang.String>
getEnv()
java.util.List<java.lang.String>
getFullEnv()
java.util.Map<java.lang.String,java.lang.String>
getGeneratedRandomEnv()
java.util.List<HealthCheck>
getHealthChecks()
java.lang.String
getImage()
java.util.Map<java.lang.String,java.lang.String>
getLabels()
java.util.Map<java.lang.String,java.lang.String>
getMetadata()
java.util.List<PortMapping>
getPorts()
java.util.Map<java.lang.String,RandomEnv>
getRandomEnv()
java.lang.String
getRepo()
NamespacedId
getRepoCredentials()
ResourceQuota
getResourceQuota()
java.lang.String
getRestartPolicy()
java.util.List<java.lang.String>
getSecurityOptions()
java.lang.String
getTag()
java.lang.Integer
getTerminationTimeout()
int
hashCode()
boolean
isAutoUpdate()
-
Methods inherited from class uk.co.ractf.polaris.api.common.JsonRepresentable
parse, toJsonString
-
-
-
-
Constructor Detail
-
Container
public Container(java.lang.String type, java.lang.String id, java.lang.String image, java.lang.String repo, NamespacedId repoCredentials, java.util.List<java.lang.String> entrypoint, java.util.Map<java.lang.String,java.lang.String> env, java.util.Map<java.lang.String,RandomEnv> randomEnv, java.util.Map<java.lang.String,java.lang.String> labels, java.util.Map<java.lang.String,java.lang.String> affinity, java.util.Map<java.lang.String,java.lang.String> antiaffinity, ResourceQuota resourceQuota, java.lang.String restartPolicy, java.util.List<java.lang.String> capDrop, java.util.List<java.lang.String> capAdd, java.util.List<HealthCheck> healthChecks, java.lang.Integer terminationTimeout, java.util.List<PortMapping> portMappings, java.util.Map<java.lang.String,java.lang.String> metadata, boolean autoUpdate, java.util.List<java.lang.String> securityOptions)
Creates a container- Parameters:
type
- the type of the pod (container)id
- the id of the containerimage
- the image to userepo
- the repository idrepoCredentials
- the credentials to use for the repositoryentrypoint
- the container entrypointenv
- the environment variables to setrandomEnv
- the randomised environment variables to setlabels
- labels to add to the containeraffinity
- which types of host a pod should be preferentially scheduled onantiaffinity
- which types of host a pod should avoid being scheduled onresourceQuota
- the resource quota of the containerrestartPolicy
- the restart policy of the containercapDrop
- capabilities to dropcapAdd
- capabilities to addhealthChecks
- healthchecks for the podterminationTimeout
- the timeout to use when the pod is terminatedportMappings
- ports to exposemetadata
- other metadataautoUpdate
- if the container should be automatically updatedsecurityOptions
-
-
-
Method Detail
-
getImage
public java.lang.String getImage()
-
getRepo
public java.lang.String getRepo()
-
getRepoCredentials
public NamespacedId getRepoCredentials()
-
getEntrypoint
public java.util.List<java.lang.String> getEntrypoint()
-
getEnv
public java.util.Map<java.lang.String,java.lang.String> getEnv()
-
getRandomEnv
public java.util.Map<java.lang.String,RandomEnv> getRandomEnv()
-
getLabels
public java.util.Map<java.lang.String,java.lang.String> getLabels()
-
getAffinity
public java.util.Map<java.lang.String,java.lang.String> getAffinity()
- Specified by:
getAffinity
in interfacePodWithAffinity
-
getAntiaffinity
public java.util.Map<java.lang.String,java.lang.String> getAntiaffinity()
- Specified by:
getAntiaffinity
in interfacePodWithAffinity
-
getResourceQuota
public ResourceQuota getResourceQuota()
- Specified by:
getResourceQuota
in interfaceResourceLimited
-
getRestartPolicy
public java.lang.String getRestartPolicy()
-
getCapDrop
public java.util.List<java.lang.String> getCapDrop()
-
getCapAdd
public java.util.List<java.lang.String> getCapAdd()
-
getHealthChecks
public java.util.List<HealthCheck> getHealthChecks()
-
getTerminationTimeout
public java.lang.Integer getTerminationTimeout()
-
getMetadata
public java.util.Map<java.lang.String,java.lang.String> getMetadata()
-
getSecurityOptions
public java.util.List<java.lang.String> getSecurityOptions()
-
getPorts
public java.util.List<PortMapping> getPorts()
- Specified by:
getPorts
in interfacePodWithPorts
-
isAutoUpdate
public boolean isAutoUpdate()
- Specified by:
isAutoUpdate
in interfaceAutoUpdatable
-
getFullEnv
public java.util.List<java.lang.String> getFullEnv()
-
getGeneratedRandomEnv
public java.util.Map<java.lang.String,java.lang.String> getGeneratedRandomEnv()
-
canUseRunner
public boolean canUseRunner(java.lang.String runner)
- Specified by:
canUseRunner
in classPod
-
getTag
public java.lang.String getTag()
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-