Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2019-06-26 18:53:39 -0400
committerJeff Johnston2019-06-27 14:06:31 -0400
commita16ab327881261db01b3ca364a126e7f6e88090a (patch)
tree6f1c5e770501ed1808720cc6a2b9fa6535af019f
parentf241b5f8eccb20f21d5afe4fd9a8eec41698f437 (diff)
downloadorg.eclipse.linuxtools-a16ab327881261db01b3ca364a126e7f6e88090a.tar.gz
org.eclipse.linuxtools-a16ab327881261db01b3ca364a126e7f6e88090a.tar.xz
org.eclipse.linuxtools-a16ab327881261db01b3ca364a126e7f6e88090a.zip
Update DockerHostConfig and add new fields
- update DockerHostConfig to include missing fields that have already been added to the com.spotify.docker.HostConfig class - create new IDockerBlkioDeviceRate, IDockerBlkioWeightDevice, IDockerLogConfig, IDockerDevice, IDockerRestartPolicy, and IDockerUlimit interfaces - create new internal Docker classes for the new interfaces Change-Id: I6322c82f4fb766069e0c0d6fc9011c94c936530e Reviewed-on: https://git.eclipse.org/r/144961 Tested-by: Linux Tools Bot <linuxtools-bot@eclipse.org> Reviewed-by: Jeff Johnston <jjohnstn@redhat.com>
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerBlkioDeviceRate.java21
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerBlkioWeightDevice.java21
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerDevice.java23
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerLogConfig.java23
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerRestartPolicy.java21
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerUlimit.java23
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerBlkioDeviceRate.java56
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerBlkioWeightDevice.java68
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerDevice.java83
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerHostConfig.java493
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerLogConfig.java70
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerRestartPolicy.java69
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerUlimit.java83
13 files changed, 1031 insertions, 23 deletions
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerBlkioDeviceRate.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerBlkioDeviceRate.java
new file mode 100644
index 0000000000..08774e43bb
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerBlkioDeviceRate.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Red Hat.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Red Hat - Initial Contribution
+ *******************************************************************************/
+package org.eclipse.linuxtools.docker.core;
+
+public interface IDockerBlkioDeviceRate {
+
+ public String path();
+
+ public Integer rate();
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerBlkioWeightDevice.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerBlkioWeightDevice.java
new file mode 100644
index 0000000000..36e198b450
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerBlkioWeightDevice.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Red Hat.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Red Hat - Initial Contribution
+ *******************************************************************************/
+package org.eclipse.linuxtools.docker.core;
+
+public interface IDockerBlkioWeightDevice {
+
+ public String path();
+
+ public Integer weight();
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerDevice.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerDevice.java
new file mode 100644
index 0000000000..cd0b73b8fc
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerDevice.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Red Hat.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Red Hat - Initial Contribution
+ *******************************************************************************/
+package org.eclipse.linuxtools.docker.core;
+
+public interface IDockerDevice {
+
+ public String pathOnHost();
+
+ public String pathInContainer();
+
+ public String cgroupPermissions();
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerLogConfig.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerLogConfig.java
new file mode 100644
index 0000000000..0765fe9b6a
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerLogConfig.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Red Hat.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Red Hat - Initial Contribution
+ *******************************************************************************/
+package org.eclipse.linuxtools.docker.core;
+
+import java.util.Map;
+
+public interface IDockerLogConfig {
+
+ public String logType();
+
+ public Map<String, String> logOptions();
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerRestartPolicy.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerRestartPolicy.java
new file mode 100644
index 0000000000..e4e4e70091
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerRestartPolicy.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Red Hat.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Red Hat - Initial Contribution
+ *******************************************************************************/
+package org.eclipse.linuxtools.docker.core;
+
+public interface IDockerRestartPolicy {
+
+ public String name();
+
+ public Integer maxRetryCount();
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerUlimit.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerUlimit.java
new file mode 100644
index 0000000000..322deb482c
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerUlimit.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Red Hat.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Red Hat - Initial Contribution
+ *******************************************************************************/
+package org.eclipse.linuxtools.docker.core;
+
+public interface IDockerUlimit {
+
+ public String name();
+
+ public Long soft();
+
+ public Long hard();
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerBlkioDeviceRate.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerBlkioDeviceRate.java
new file mode 100644
index 0000000000..5699f1f48e
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerBlkioDeviceRate.java
@@ -0,0 +1,56 @@
+package org.eclipse.linuxtools.internal.docker.core;
+
+import org.eclipse.linuxtools.docker.core.IDockerBlkioDeviceRate;
+
+import com.spotify.docker.client.messages.HostConfig.BlkioDeviceRate;
+
+public class DockerBlkioDeviceRate implements IDockerBlkioDeviceRate {
+
+ private final String path;
+ private final Integer rate;
+
+ public DockerBlkioDeviceRate(final BlkioDeviceRate blkioDeviceRate) {
+ this.path = blkioDeviceRate.path();
+ this.rate = blkioDeviceRate.rate();
+ }
+
+ private DockerBlkioDeviceRate(final Builder builder) {
+ this.path = builder.path;
+ this.rate = builder.rate;
+ }
+
+ @Override
+ public String path() {
+ return path;
+ }
+
+ @Override
+ public Integer rate() {
+ return rate;
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public static class Builder {
+
+ private String path;
+ private Integer rate;
+
+ public Builder path(String path) {
+ this.path = path;
+ return this;
+ }
+
+ public Builder rate(Integer rate) {
+ this.rate = rate;
+ return this;
+ }
+
+ public IDockerBlkioDeviceRate build() {
+ return new DockerBlkioDeviceRate(this);
+ }
+ }
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerBlkioWeightDevice.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerBlkioWeightDevice.java
new file mode 100644
index 0000000000..b9306aff53
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerBlkioWeightDevice.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Red Hat.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Red Hat - Initial Contribution
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.docker.core;
+
+import org.eclipse.linuxtools.docker.core.IDockerBlkioWeightDevice;
+
+import com.spotify.docker.client.messages.HostConfig.BlkioWeightDevice;
+
+public class DockerBlkioWeightDevice implements IDockerBlkioWeightDevice {
+
+ private final String path;
+ private final Integer weight;
+
+ public DockerBlkioWeightDevice(final BlkioWeightDevice blkioWeightDevice) {
+ this.path = blkioWeightDevice.path();
+ this.weight = blkioWeightDevice.weight();
+ }
+
+ private DockerBlkioWeightDevice(final Builder builder) {
+ this.path = builder.path;
+ this.weight = builder.weight;
+ }
+
+ @Override
+ public String path() {
+ return path;
+ }
+
+ @Override
+ public Integer weight() {
+ return weight;
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public static class Builder {
+
+ private String path;
+ private Integer weight;
+
+ public Builder path(String path) {
+ this.path = path;
+ return this;
+ }
+
+ public Builder weight(Integer weight) {
+ this.weight = weight;
+ return this;
+ }
+
+ public IDockerBlkioWeightDevice build() {
+ return new DockerBlkioWeightDevice(this);
+ }
+ }
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerDevice.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerDevice.java
new file mode 100644
index 0000000000..52aecc34cc
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerDevice.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Red Hat.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Red Hat - Initial Contribution
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.docker.core;
+
+import org.eclipse.linuxtools.docker.core.IDockerDevice;
+
+import com.spotify.docker.client.messages.Device;
+
+public class DockerDevice implements IDockerDevice {
+
+ private final String pathOnHost;
+ private final String pathInContainer;
+ private final String cgroupPermissions;
+
+ public DockerDevice(final Device device) {
+ this.pathOnHost = device.pathOnHost();
+ this.pathInContainer = device.pathInContainer();
+ this.cgroupPermissions = device.cgroupPermissions();
+ }
+
+ private DockerDevice(final Builder builder) {
+ this.pathOnHost = builder.pathOnHost;
+ this.pathInContainer = builder.pathInContainer;
+ this.cgroupPermissions = builder.cgroupPermissions;
+ }
+
+ @Override
+ public String pathOnHost() {
+ return pathOnHost;
+ }
+
+ @Override
+ public String pathInContainer() {
+ return pathInContainer;
+ }
+
+ @Override
+ public String cgroupPermissions() {
+ return cgroupPermissions;
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public static class Builder {
+
+ private String pathOnHost;
+ private String pathInContainer;
+ private String cgroupPermissions;
+
+ public Builder pathOnHost(String pathOnHost) {
+ this.pathOnHost = pathOnHost;
+ return this;
+ }
+
+ public Builder pathInContainer(String pathInContainer) {
+ this.pathInContainer = pathInContainer;
+ return this;
+ }
+
+ public Builder cgroupsPermission(String cgroupsPermission) {
+ this.cgroupPermissions = cgroupsPermission;
+ return this;
+ }
+
+ public IDockerDevice build() {
+ return new DockerDevice(this);
+ }
+
+ }
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerHostConfig.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerHostConfig.java
index 7ddc1341b2..9f43fe1be5 100644
--- a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerHostConfig.java
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerHostConfig.java
@@ -19,12 +19,22 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import org.eclipse.linuxtools.docker.core.IDockerBlkioDeviceRate;
+import org.eclipse.linuxtools.docker.core.IDockerBlkioWeightDevice;
import org.eclipse.linuxtools.docker.core.IDockerConfParameter;
+import org.eclipse.linuxtools.docker.core.IDockerDevice;
import org.eclipse.linuxtools.docker.core.IDockerHostConfig;
+import org.eclipse.linuxtools.docker.core.IDockerLogConfig;
import org.eclipse.linuxtools.docker.core.IDockerPortBinding;
+import org.eclipse.linuxtools.docker.core.IDockerRestartPolicy;
+import org.eclipse.linuxtools.docker.core.IDockerUlimit;
+import com.spotify.docker.client.messages.Device;
import com.spotify.docker.client.messages.HostConfig;
+import com.spotify.docker.client.messages.HostConfig.BlkioDeviceRate;
+import com.spotify.docker.client.messages.HostConfig.BlkioWeightDevice;
import com.spotify.docker.client.messages.HostConfig.LxcConfParameter;
+import com.spotify.docker.client.messages.HostConfig.Ulimit;
import com.spotify.docker.client.messages.PortBinding;
public class DockerHostConfig implements IDockerHostConfig {
@@ -40,13 +50,42 @@ public class DockerHostConfig implements IDockerHostConfig {
private final boolean publishAllPorts;
private final List<String> dns;
private final List<String> dnsSearch;
+ private final List<String> dnsOptions;
+ private final List<String> extraHosts;
+ private final List<IDockerDevice> devices;
private final List<String> volumesFrom;
private final List<String> securityOpt;
private final List<String> capAdd;
private final List<String> capDrop;
private final String networkMode;
+ private final String cgroupParent;
private final Long memory;
private final Long cpuShares;
+ private final Long memorySwap;
+ private final Integer memorySwappiness;
+ private final Long memoryReservation;
+ private final Long nanoCpus;
+ private final Long cpuPeriod;
+ private final String cpusetCpus;
+ private final String cpusetMems;
+ private final Long cpuQuota;
+ private final String ipcMode;
+ private final String pidMode;
+ private final Long shmSize;
+ private final boolean oomKillDisable;
+ private final Integer oomScoreAdj;
+ private final boolean autoRemove;
+ private final Integer pidsLimit;
+ private final IDockerRestartPolicy restartPolicy;
+ private final List<IDockerUlimit> ulimits;
+ private final IDockerLogConfig logConfig;
+ private final Map<String, String> storageOpt;
+ private final Integer blkioWeight;
+ private final List<IDockerBlkioWeightDevice> blkioWeightDevice;
+ private final List<IDockerBlkioDeviceRate> blkioDeviceReadBps;
+ private final List<IDockerBlkioDeviceRate> blkioDeviceWriteBps;
+ private final List<IDockerBlkioDeviceRate> blkioDeviceReadIOps;
+ private final List<IDockerBlkioDeviceRate> blkioDeviceWriteIOps;
public DockerHostConfig(final HostConfig hostConfig) {
this.binds = hostConfig.binds();
@@ -85,6 +124,78 @@ public class DockerHostConfig implements IDockerHostConfig {
this.securityOpt = hostConfig.securityOpt();
this.capAdd = hostConfig.capAdd();
this.capDrop = hostConfig.capDrop();
+ this.dnsOptions = hostConfig.dnsOptions();
+ this.extraHosts = hostConfig.extraHosts();
+ this.devices = new ArrayList<>();
+ if (hostConfig != null && hostConfig.devices() != null) {
+ for (Device device : hostConfig.devices()) {
+ this.devices.add(new DockerDevice(device));
+ }
+ }
+ this.cgroupParent = hostConfig.cgroupParent();
+ this.memorySwap = hostConfig.memorySwap();
+ this.memorySwappiness = hostConfig.memorySwappiness();
+ this.memoryReservation = hostConfig.memoryReservation();
+ this.nanoCpus = hostConfig.nanoCpus();
+ this.cpuPeriod = hostConfig.cpuPeriod();
+ this.cpusetCpus = hostConfig.cpusetCpus();
+ this.cpusetMems = hostConfig.cpusetMems();
+ this.cpuQuota = hostConfig.cpuQuota();
+ this.ipcMode = hostConfig.ipcMode();
+ this.pidMode = hostConfig.pidMode();
+ this.shmSize = hostConfig.shmSize();
+ this.oomKillDisable = hostConfig.oomKillDisable() != null
+ ? hostConfig.oomKillDisable()
+ : false;
+ this.oomScoreAdj = hostConfig.oomScoreAdj();
+ this.autoRemove = hostConfig.autoRemove() != null
+ ? hostConfig.autoRemove()
+ : false;
+ this.pidsLimit = hostConfig.pidsLimit();
+ this.restartPolicy = hostConfig.restartPolicy() != null
+ ? new DockerRestartPolicy(hostConfig.restartPolicy())
+ : null;
+ this.ulimits = new ArrayList<>();
+ if (hostConfig.ulimits() != null) {
+ for (Ulimit ulimit : hostConfig.ulimits()) {
+ this.ulimits.add(new DockerUlimit(ulimit));
+ }
+ }
+ this.logConfig = hostConfig.logConfig() != null
+ ? new DockerLogConfig(hostConfig.logConfig())
+ : null;
+ this.storageOpt = hostConfig.storageOpt();
+ this.blkioWeight = hostConfig.blkioWeight();
+ this.blkioWeightDevice = new ArrayList<>();
+ if (hostConfig.blkioWeightDevice() != null) {
+ for (BlkioWeightDevice device : hostConfig.blkioWeightDevice()) {
+ blkioWeightDevice.add(new DockerBlkioWeightDevice(device));
+ }
+ }
+ this.blkioDeviceReadBps = new ArrayList<>();
+ if (hostConfig.blkioDeviceReadBps() != null) {
+ for (BlkioDeviceRate rate : hostConfig.blkioDeviceReadBps()) {
+ blkioDeviceReadBps.add(new DockerBlkioDeviceRate(rate));
+ }
+ }
+ this.blkioDeviceWriteBps = new ArrayList<>();
+ if (hostConfig.blkioDeviceReadBps() != null) {
+ for (BlkioDeviceRate rate : hostConfig.blkioDeviceWriteBps()) {
+ blkioDeviceWriteBps.add(new DockerBlkioDeviceRate(rate));
+ }
+ }
+ this.blkioDeviceReadIOps = new ArrayList<>();
+ if (hostConfig.blkioDeviceReadBps() != null) {
+ for (BlkioDeviceRate rate : hostConfig.blkioDeviceReadIOps()) {
+ blkioDeviceReadIOps.add(new DockerBlkioDeviceRate(rate));
+ }
+ }
+ this.blkioDeviceWriteIOps = new ArrayList<>();
+ if (hostConfig.blkioDeviceReadBps() != null) {
+ for (BlkioDeviceRate rate : hostConfig.blkioDeviceWriteIOps()) {
+ blkioDeviceWriteIOps.add(new DockerBlkioDeviceRate(rate));
+ }
+ }
}
private DockerHostConfig(final Builder builder) {
@@ -110,7 +221,38 @@ public class DockerHostConfig implements IDockerHostConfig {
this.securityOpt = builder.securityOpt;
this.capAdd = builder.capAdd;
this.capDrop = builder.capDrop;
-
+ this.dnsOptions = builder.dnsOptions;
+ this.extraHosts = builder.extraHosts;
+ this.devices = builder.devices;
+ this.cgroupParent = builder.cgroupParent;
+ this.memorySwap = builder.memorySwap;
+ this.memorySwappiness = builder.memorySwappiness;
+ this.memoryReservation = builder.memoryReservation;
+ this.nanoCpus = builder.nanoCpus;
+ this.cpuPeriod = builder.cpuPeriod;
+ this.cpusetCpus = builder.cpusetCpus;
+ this.cpusetMems = builder.cpusetMems;
+ this.cpuQuota = builder.cpuQuota;
+ this.ipcMode = builder.ipcMode;
+ this.pidMode = builder.pidMode;
+ this.shmSize = builder.shmSize;
+ this.oomKillDisable = builder.oomKillDisable != null
+ ? builder.oomKillDisable
+ : false;
+ this.oomScoreAdj = builder.oomScoreAdj;
+ this.autoRemove = builder.autoRemove != null ? builder.autoRemove
+ : false;
+ this.pidsLimit = builder.pidsLimit;
+ this.restartPolicy = builder.restartPolicy;
+ this.ulimits = builder.ulimits;
+ this.logConfig = builder.logConfig;
+ this.storageOpt = builder.storageOpt;
+ this.blkioWeight = builder.blkioWeight;
+ this.blkioWeightDevice = builder.blkioWeightDevice;
+ this.blkioDeviceReadBps = builder.blkioDeviceReadBps;
+ this.blkioDeviceWriteBps = builder.blkioDeviceWriteBps;
+ this.blkioDeviceReadIOps = builder.blkioDeviceReadIOps;
+ this.blkioDeviceWriteIOps = builder.blkioDeviceWriteIOps;
}
@Override
@@ -166,6 +308,14 @@ public class DockerHostConfig implements IDockerHostConfig {
return dnsSearch;
}
+ public List<String> dnsOptions() {
+ return dnsOptions;
+ }
+
+ public List<IDockerDevice> devices() {
+ return devices;
+ }
+
@Override
public List<String> volumesFrom() {
return volumesFrom;
@@ -184,6 +334,14 @@ public class DockerHostConfig implements IDockerHostConfig {
return capDrop;
}
+ public List<String> extraHosts() {
+ return extraHosts;
+ }
+
+ public String cgroupParent() {
+ return cgroupParent;
+ }
+
@Override
public String networkMode() {
return networkMode;
@@ -197,6 +355,106 @@ public class DockerHostConfig implements IDockerHostConfig {
return cpuShares;
}
+ public Long memorySwap() {
+ return memorySwap;
+ }
+
+ public Integer memorySwappiness() {
+ return memorySwappiness;
+ }
+
+ public Long memoryReservation() {
+ return memoryReservation;
+ }
+
+ public Long nanoCpus() {
+ return nanoCpus;
+ }
+
+ public Long cpuPeriod() {
+ return cpuPeriod;
+ }
+
+ public String cpusetCpus() {
+ return cpusetCpus;
+ }
+
+ public String cpusetMems() {
+ return cpusetMems;
+ }
+
+ public Long cpuQuota() {
+ return cpuQuota;
+ }
+
+ public String ipcMode() {
+ return ipcMode;
+ }
+
+ public String pidMode() {
+ return pidMode;
+ }
+
+ public Long shmSize() {
+ return shmSize;
+ }
+
+ public boolean oomKillDisable() {
+ return oomKillDisable;
+ }
+
+ public Integer oomScoreAdj() {
+ return oomScoreAdj;
+ }
+
+ public boolean autoRemove() {
+ return autoRemove;
+ }
+
+ public Integer pidsLimit() {
+ return pidsLimit;
+ }
+
+ public IDockerRestartPolicy restartPolicy() {
+ return restartPolicy;
+ }
+
+ public List<IDockerUlimit> ulimits() {
+ return ulimits;
+ }
+
+ public IDockerLogConfig logConfig() {
+ return logConfig;
+ }
+
+ public Map<String, String> storageOpt() {
+ return storageOpt;
+ }
+
+ public Integer blkioWeight() {
+ return blkioWeight;
+ }
+
+ public List<IDockerBlkioWeightDevice> blkioWeightDevice() {
+ return blkioWeightDevice;
+ }
+
+ public List<IDockerBlkioDeviceRate> blkioDeviceReadBps() {
+ return blkioDeviceReadBps;
+ }
+
+ public List<IDockerBlkioDeviceRate> blkioDeviceWriteBps() {
+ return blkioDeviceWriteBps;
+ }
+
+ public List<IDockerBlkioDeviceRate> blkioDeviceReadIOps() {
+ return blkioDeviceReadIOps;
+ }
+
+ public List<IDockerBlkioDeviceRate> blkioDeviceWriteIOps() {
+ return blkioDeviceWriteIOps;
+ }
+
public static Builder builder() {
return new Builder();
}
@@ -212,15 +470,44 @@ public class DockerHostConfig implements IDockerHostConfig {
private Map<String, List<IDockerPortBinding>> portBindings;
private List<String> links;
private Boolean publishAllPorts;
- private List<String> dns;
- private List<String> dnsSearch;
+ private List<String> dns = new ArrayList<>();
+ private List<String> dnsSearch = new ArrayList<>();
private List<String> volumesFrom;
private List<String> securityOpt;
private List<String> capAdd;
private List<String> capDrop;
+ private List<String> dnsOptions = new ArrayList<>();
+ private List<String> extraHosts;
+ private List<IDockerDevice> devices = new ArrayList<>();
+ private String cgroupParent = "";
private String networkMode;
private Long memory;
private Long cpuShares;
+ private Long memorySwap;
+ private Integer memorySwappiness;
+ private Long memoryReservation;
+ private Long nanoCpus;
+ private Long cpuPeriod;
+ private String cpusetCpus = "";
+ private String cpusetMems = "";
+ private Long cpuQuota;
+ private String ipcMode = "";
+ private String pidMode = "";
+ private Long shmSize;
+ private Boolean oomKillDisable;
+ private Integer oomScoreAdj;
+ private Boolean autoRemove;
+ private Integer pidsLimit;
+ private IDockerRestartPolicy restartPolicy;
+ private List<IDockerUlimit> ulimits;
+ private IDockerLogConfig logConfig;
+ private Map<String, String> storageOpt;
+ private Integer blkioWeight;
+ private List<IDockerBlkioWeightDevice> blkioWeightDevice;
+ private List<IDockerBlkioDeviceRate> blkioDeviceReadBps;
+ private List<IDockerBlkioDeviceRate> blkioDeviceWriteBps;
+ private List<IDockerBlkioDeviceRate> blkioDeviceReadIOps;
+ private List<IDockerBlkioDeviceRate> blkioDeviceWriteIOps;
public Builder binds(final List<String> binds) {
this.binds = new ArrayList<>(binds);
@@ -291,26 +578,6 @@ public class DockerHostConfig implements IDockerHostConfig {
return this;
}
- public Builder dns(final List<String> dns) {
- this.dns = new ArrayList<>(dns);
- return this;
- }
-
- public Builder dns(final String... dns) {
- this.dns = Arrays.asList(dns);
- return this;
- }
-
- public Builder dnsSearch(final List<String> dnsSearch) {
- this.dnsSearch = new ArrayList<>(dnsSearch);
- return this;
- }
-
- public Builder dnsSearch(final String... dnsSearch) {
- this.dnsSearch = Arrays.asList(dnsSearch);
- return this;
- }
-
public Builder volumesFrom(final List<String> volumesFrom) {
this.volumesFrom = new ArrayList<>(volumesFrom);
return this;
@@ -351,6 +618,56 @@ public class DockerHostConfig implements IDockerHostConfig {
return this;
}
+ public Builder dns(final List<String> dns) {
+ this.dns = new ArrayList<>(dns);
+ return this;
+ }
+
+ public Builder dns(final String... dns) {
+ this.dns = Arrays.asList(dns);
+ return this;
+ }
+
+ public Builder dnsOptions(final List<String> dnsOptions) {
+ this.dnsOptions = new ArrayList<>(dnsOptions);
+ return this;
+ }
+
+ public Builder dnsOptions(final String... dnsOptions) {
+ this.dnsOptions = Arrays.asList(dnsOptions);
+ return this;
+ }
+
+ public Builder dnsSearch(final List<String> dnsSearch) {
+ this.dnsSearch = new ArrayList<>(dnsSearch);
+ return this;
+ }
+
+ public Builder dnsSearch(final String... dnsSearch) {
+ this.dnsSearch = Arrays.asList(dnsSearch);
+ return this;
+ }
+
+ public Builder extraHosts(final List<String> extraHosts) {
+ this.extraHosts = new ArrayList<>(extraHosts);
+ return this;
+ }
+
+ public Builder extraHosts(final String... extraHosts) {
+ this.extraHosts = Arrays.asList(extraHosts);
+ return this;
+ }
+
+ public Builder devices(final List<IDockerDevice> devices) {
+ this.devices = new ArrayList<>(devices);
+ return this;
+ }
+
+ public Builder cgroupParent(final String cgroupParent) {
+ this.cgroupParent = cgroupParent;
+ return this;
+ }
+
public Builder networkMode(final String networkMode) {
this.networkMode = networkMode;
return this;
@@ -366,6 +683,136 @@ public class DockerHostConfig implements IDockerHostConfig {
return this;
}
+ public Builder memorySwap(final Long memorySwap) {
+ this.memorySwap = memorySwap;
+ return this;
+ }
+
+ public Builder memorySwappiness(final Integer memorySwappiness) {
+ this.memorySwappiness = memorySwappiness;
+ return this;
+ }
+
+ public Builder memoryReservation(final Long memoryReservation) {
+ this.memoryReservation = memoryReservation;
+ return this;
+ }
+
+ public Builder nanoCpus(final Long nanoCpus) {
+ this.nanoCpus = nanoCpus;
+ return this;
+ }
+
+ public Builder cpuPeriod(final Long cpuPeriod) {
+ this.cpuPeriod = cpuPeriod;
+ return this;
+ }
+
+ public Builder cpusetCpus(final String cpusetCpus) {
+ this.cpusetCpus = cpusetCpus;
+ return this;
+ }
+
+ public Builder cpusetMems(final String cpusetMems) {
+ this.cpusetMems = cpusetMems;
+ return this;
+ }
+
+ public Builder cpuQuota(final Long cpuQuota) {
+ this.cpuQuota = cpuQuota;
+ return this;
+ }
+
+ public Builder ipcMode(final String ipcMode) {
+ this.ipcMode = ipcMode;
+ return this;
+ }
+
+ public Builder pidMode(final String pidMode) {
+ this.pidMode = pidMode;
+ return this;
+ }
+
+ public Builder shmSize(final Long shmSize) {
+ this.shmSize = shmSize;
+ return this;
+ }
+
+ public Builder oomKillDisable(final Boolean oomKillDisable) {
+ this.oomKillDisable = oomKillDisable;
+ return this;
+ }
+
+ public Builder oomScoreAdj(final Integer oomScoreAdj) {
+ this.oomScoreAdj = oomScoreAdj;
+ return this;
+ }
+
+ public Builder autoRemove(final Boolean autoRemove) {
+ this.autoRemove = autoRemove;
+ return this;
+ }
+
+ public Builder pidsLimit(final Integer pidsLimit) {
+ this.pidsLimit = pidsLimit;
+ return this;
+ }
+
+ public Builder restartPolicy(final IDockerRestartPolicy restartPolicy) {
+ this.restartPolicy = restartPolicy;
+ return this;
+ }
+
+ public Builder ulimits(final List<IDockerUlimit> ulimits) {
+ this.ulimits = ulimits;
+ return this;
+ }
+
+ public Builder logConfig(final IDockerLogConfig logConfig) {
+ this.logConfig = logConfig;
+ return this;
+ }
+
+ public Builder storageOpt(final Map<String, String> storageOpt) {
+ this.storageOpt = storageOpt;
+ return this;
+ }
+
+ public Builder blkioWeight(final Integer blkioWeight) {
+ this.blkioWeight = blkioWeight;
+ return this;
+ }
+
+ public Builder blkioWeightDevice(
+ final List<IDockerBlkioWeightDevice> blkioWeightDevice) {
+ this.blkioWeightDevice = blkioWeightDevice;
+ return this;
+ }
+
+ public Builder blkioDeviceReadBps(
+ final List<IDockerBlkioDeviceRate> blkioDeviceReadBps) {
+ this.blkioDeviceReadBps = blkioDeviceReadBps;
+ return this;
+ }
+
+ public Builder blkioDeviceWriteBps(
+ final List<IDockerBlkioDeviceRate> blkioDeviceWriteBps) {
+ this.blkioDeviceWriteBps = blkioDeviceWriteBps;
+ return this;
+ }
+
+ public Builder blkioDeviceReadIOps(
+ final List<IDockerBlkioDeviceRate> blkioDeviceReadIOps) {
+ this.blkioDeviceReadIOps = blkioDeviceReadIOps;
+ return this;
+ }
+
+ public Builder blkioDeviceWriteIOps(
+ final List<IDockerBlkioDeviceRate> blkioDeviceWriteIOps) {
+ this.blkioDeviceWriteIOps = blkioDeviceWriteIOps;
+ return this;
+ }
+
public IDockerHostConfig build() {
return new DockerHostConfig(this);
}
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerLogConfig.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerLogConfig.java
new file mode 100644
index 0000000000..6c6bedf30b
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerLogConfig.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Red Hat.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Red Hat - Initial Contribution
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.docker.core;
+
+import java.util.Map;
+
+import org.eclipse.linuxtools.docker.core.IDockerLogConfig;
+
+import com.spotify.docker.client.messages.LogConfig;
+
+public class DockerLogConfig implements IDockerLogConfig {
+
+ private final String logType;
+ private final Map<String, String> logOptions;
+
+ public DockerLogConfig(final LogConfig config) {
+ this.logType = config.logType();
+ this.logOptions = config.logOptions();
+ }
+
+ private DockerLogConfig(final Builder builder) {
+ this.logType = builder.logType;
+ this.logOptions = builder.logOptions;
+ }
+
+ @Override
+ public String logType() {
+ return logType;
+ }
+
+ @Override
+ public Map<String, String> logOptions() {
+ return logOptions;
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public static class Builder {
+
+ private String logType;
+ private Map<String, String> logOptions;
+
+ public Builder logType(String logType) {
+ this.logType = logType;
+ return this;
+ }
+
+ public Builder logOptions(Map<String, String> logOptions) {
+ this.logOptions = logOptions;
+ return this;
+ }
+
+ public IDockerLogConfig build() {
+ return new DockerLogConfig(this);
+ }
+
+ }
+}
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerRestartPolicy.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerRestartPolicy.java
new file mode 100644
index 0000000000..a591e759fa
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerRestartPolicy.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Red Hat.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Red Hat - Initial Contribution
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.docker.core;
+
+import org.eclipse.linuxtools.docker.core.IDockerRestartPolicy;
+
+import com.spotify.docker.client.messages.HostConfig.RestartPolicy;
+
+public class DockerRestartPolicy implements IDockerRestartPolicy {
+
+ private final String name;
+ private final Integer maxRetryCount;
+
+ public DockerRestartPolicy(final RestartPolicy policy) {
+ this.name = policy.name();
+ this.maxRetryCount = policy.maxRetryCount();
+ }
+
+ private DockerRestartPolicy(final Builder builder) {
+ this.name = builder.name;
+ this.maxRetryCount = builder.maxRetryCount;
+ }
+
+ @Override
+ public String name() {
+ return name;
+ }
+
+ @Override
+ public Integer maxRetryCount() {
+ return maxRetryCount;
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public static class Builder {
+
+ private String name;
+ private Integer maxRetryCount;
+
+ public Builder pathOnHost(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public Builder maxRetryCount(Integer maxRetryCount) {
+ this.maxRetryCount = maxRetryCount;
+ return this;
+ }
+
+ public IDockerRestartPolicy build() {
+ return new DockerRestartPolicy(this);
+ }
+
+ }
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerUlimit.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerUlimit.java
new file mode 100644
index 0000000000..75b4d49368
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerUlimit.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Red Hat.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Red Hat - Initial Contribution
+ *******************************************************************************/
+package org.eclipse.linuxtools.internal.docker.core;
+
+import org.eclipse.linuxtools.docker.core.IDockerUlimit;
+
+import com.spotify.docker.client.messages.HostConfig.Ulimit;
+
+public class DockerUlimit implements IDockerUlimit {
+
+ private final String name;
+ private final Long soft;
+ private final Long hard;
+
+ public DockerUlimit(final Ulimit ulimit) {
+ this.name = ulimit.name();
+ this.soft = ulimit.soft();
+ this.hard = ulimit.hard();
+ }
+
+ private DockerUlimit(final Builder builder) {
+ this.name = builder.name;
+ this.soft = builder.soft;
+ this.hard = builder.hard;
+ }
+
+ @Override
+ public String name() {
+ return name;
+ }
+
+ @Override
+ public Long soft() {
+ return soft;
+ }
+
+ @Override
+ public Long hard() {
+ return hard;
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public static class Builder {
+
+ private String name;
+ private Long soft;
+ private Long hard;
+
+ public Builder name(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public Builder soft(Long soft) {
+ this.soft = soft;
+ return this;
+ }
+
+ public Builder hard(Long hard) {
+ this.hard = hard;
+ return this;
+ }
+
+ public IDockerUlimit build() {
+ return new DockerUlimit(this);
+ }
+
+ }
+
+}

Back to the top