mirror of
https://github.com/kemko/nomad.git
synced 2026-01-07 10:55:42 +03:00
Add support for storage opt
This commit is contained in:
@@ -263,6 +263,7 @@ var (
|
||||
"readonly_rootfs": hclspec.NewAttr("readonly_rootfs", "bool", false),
|
||||
"security_opt": hclspec.NewAttr("security_opt", "list(string)", false),
|
||||
"shm_size": hclspec.NewAttr("shm_size", "number", false),
|
||||
"storage_opt": hclspec.NewBlockAttrs("storage_opt", "string", false),
|
||||
"sysctl": hclspec.NewBlockAttrs("sysctl", "string", false),
|
||||
"tty": hclspec.NewAttr("tty", "bool", false),
|
||||
"ulimit": hclspec.NewBlockAttrs("ulimit", "string", false),
|
||||
@@ -319,6 +320,7 @@ type TaskConfig struct {
|
||||
ReadonlyRootfs bool `codec:"readonly_rootfs"`
|
||||
SecurityOpt []string `codec:"security_opt"`
|
||||
ShmSize int64 `codec:"shm_size"`
|
||||
StorageOpt map[string]string `codec:"storage_opt"`
|
||||
Sysctl map[string]string `codec:"sysctl"`
|
||||
TTY bool `codec:"tty"`
|
||||
Ulimit map[string]string `codec:"ulimit"`
|
||||
|
||||
@@ -627,6 +627,7 @@ func (d *Driver) createContainerConfig(task *drivers.TaskConfig, driverConfig *T
|
||||
// used to share data between different tasks in the same task group.
|
||||
Binds: binds,
|
||||
|
||||
StorageOpt: driverConfig.StorageOpt,
|
||||
VolumeDriver: driverConfig.VolumeDriver,
|
||||
|
||||
PidsLimit: driverConfig.PidsLimit,
|
||||
|
||||
@@ -1122,6 +1122,25 @@ func TestDockerDriver_SecurityOpt(t *testing.T) {
|
||||
require.Exactly(t, cfg.SecurityOpt, container.HostConfig.SecurityOpt)
|
||||
}
|
||||
|
||||
func TestDockerDriver_CreateContainerConfig(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
task, cfg, _ := dockerTask(t)
|
||||
opt := map[string]string{"size": "120G"}
|
||||
|
||||
cfg.StorageOpt = opt
|
||||
require.NoError(t, task.EncodeConcreteDriverConfig(cfg))
|
||||
|
||||
dh := dockerDriverHarness(t, nil)
|
||||
driver := dh.Impl().(*Driver)
|
||||
|
||||
c, err := driver.createContainerConfig(task, cfg, "org/repo:0.1")
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, "org/repo:0.1", c.Config.Image)
|
||||
require.EqualValues(t, opt, c.HostConfig.StorageOpt)
|
||||
}
|
||||
|
||||
func TestDockerDriver_Capabilities(t *testing.T) {
|
||||
if !tu.IsTravis() {
|
||||
t.Parallel()
|
||||
|
||||
Reference in New Issue
Block a user