Skip to content

Commit

Permalink
api: sync BindOptions
Browse files Browse the repository at this point in the history
Pulls in:
- CreateMountpoint (moby/moby PR 43484)
- ReadOnlyNonRecursive, ReadOnlyForceRecursive (moby/moby PR 45278)

Signed-off-by: Akihiro Suda <[email protected]>
  • Loading branch information
AkihiroSuda committed Jun 1, 2023
1 parent 03d4df7 commit 159601b
Show file tree
Hide file tree
Showing 4 changed files with 521 additions and 396 deletions.
5 changes: 4 additions & 1 deletion agent/exec/dockerapi/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,10 @@ func convertMount(m api.Mount) enginemount.Mount {

if m.BindOptions != nil {
mount.BindOptions = &enginemount.BindOptions{
NonRecursive: m.BindOptions.NonRecursive,
NonRecursive: m.BindOptions.NonRecursive,
CreateMountpoint: m.BindOptions.CreateMountpoint,
ReadOnlyNonRecursive: m.BindOptions.ReadOnlyNonRecursive,
ReadOnlyForceRecursive: m.BindOptions.ReadOnlyForceRecursive,
}
switch m.BindOptions.Propagation {
case api.MountPropagationRPrivate:
Expand Down
9 changes: 5 additions & 4 deletions agent/exec/dockerapi/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
containertypes "github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/events"
"github.com/docker/docker/api/types/network"
gogotypes "github.com/gogo/protobuf/types"
Expand Down Expand Up @@ -42,12 +43,12 @@ func TestControllerPrepare(t *testing.T) {
panic("unexpected call of ImagePull")
}

client.ContainerCreateFn = func(_ context.Context, cConfig *container.Config, hConfig *container.HostConfig, nConfig *network.NetworkingConfig, platform *v1.Platform, containerName string) (container.CreateResponse, error) {
client.ContainerCreateFn = func(_ context.Context, cConfig *containertypes.Config, hConfig *containertypes.HostConfig, nConfig *network.NetworkingConfig, platform *v1.Platform, containerName string) (containertypes.CreateResponse, error) {
if reflect.DeepEqual(*cConfig, *config.config()) &&
reflect.DeepEqual(*hConfig, *config.hostConfig()) &&
reflect.DeepEqual(*nConfig, *config.networkingConfig()) &&
containerName == config.name() {
return container.CreateResponse{ID: "container-id-" + task.ID}, nil
return containertypes.CreateResponse{ID: "container-id-" + task.ID}, nil
}
panic("unexpected call to ContainerCreate")
}
Expand All @@ -72,11 +73,11 @@ func TestControllerPrepareAlreadyPrepared(t *testing.T) {
panic("unexpected call of ImagePull")
}

client.ContainerCreateFn = func(_ context.Context, cConfig *container.Config, hostConfig *container.HostConfig, networking *network.NetworkingConfig, platform *v1.Platform, containerName string) (container.CreateResponse, error) {
client.ContainerCreateFn = func(_ context.Context, cConfig *containertypes.Config, hostConfig *containertypes.HostConfig, networking *network.NetworkingConfig, platform *v1.Platform, containerName string) (containertypes.CreateResponse, error) {
if reflect.DeepEqual(*cConfig, *config.config()) &&
reflect.DeepEqual(*networking, *config.networkingConfig()) &&
containerName == config.name() {
return container.CreateResponse{}, fmt.Errorf("Conflict. The name")
return containertypes.CreateResponse{}, fmt.Errorf("Conflict. The name")
}
panic("unexpected call of ContainerCreate")
}
Expand Down
Loading

0 comments on commit 159601b

Please sign in to comment.