Skip to content

Commit

Permalink
Don't use shared bind mounts
Browse files Browse the repository at this point in the history
Currently podman is invoked with options to mount both the workspace
directory and some of the files it contains. For example, if the
workspace is `/root`:

```
-v /root/.netrc:/root/.netrc:ro
-v /root:/root:rw,shared
```

The workspace directory is mounted using the _shared_ option. This
results in leaking mount points at an exponential rate, as descrived in
this _podman_ issue (no closed, as it is the expected behaviour):

  containers/podman#15671

This _shared_ option is not really needed. This patch removes it.

Signed-off-by: Juan Hernandez <[email protected]>
  • Loading branch information
jhernand authored and eranco74 committed Sep 8, 2022
1 parent d8587cc commit c04428a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion skipper/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def handle_volumes_bind_mount(docker_cmd, homedir, volumes, workspace):

if utils.get_runtime_command() == utils.PODMAN:
volumes.extend([
'%(workspace)s:%(workspace)s:rw,shared' % dict(workspace=workspace),
'%(workspace)s:%(workspace)s:rw' % dict(workspace=workspace),
'%s:/opt/skipper/skipper-entrypoint.sh:rw' % utils.get_extra_file("skipper-entrypoint.sh"),
])
if os.path.exists('/var/run/docker.sock'):
Expand Down
10 changes: 5 additions & 5 deletions tests/test_runner_podman.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def test_run_simple_command_nested_network_exist(self, resource_filename_mock, c
'-v', get_volume_mapping('%(homedir)s/.gitconfig:%(homedir)s/.gitconfig:ro' % dict(homedir=HOME_DIR)),
'-v', get_volume_mapping('%(homedir)s/.docker/config.json:%(homedir)s/.docker/config.json:ro' % dict(homedir=HOME_DIR)),
'-v', get_volume_mapping('/etc/docker:/etc/docker:ro'),
'-v', get_volume_mapping('%(workdir)s:%(workdir)s:rw,shared' % dict(workdir=WORKDIR)),
'-v', get_volume_mapping('%(workdir)s:%(workdir)s:rw' % dict(workdir=WORKDIR)),
'-v', get_volume_mapping('entrypoint.sh:/opt/skipper/skipper-entrypoint.sh:rw'),
'-v', get_volume_mapping('/var/run/docker.sock:/var/run/docker.sock:rw'),
'-v', get_volume_mapping('/var/lib/osmosis:/var/lib/osmosis:rw'),
Expand Down Expand Up @@ -127,7 +127,7 @@ def test_run_simple_command_nested_network_not_exist(self, resource_filename_moc
'-v', get_volume_mapping('%(homedir)s/.gitconfig:%(homedir)s/.gitconfig:ro' % dict(homedir=HOME_DIR)),
'-v', get_volume_mapping('%(homedir)s/.docker/config.json:%(homedir)s/.docker/config.json:ro' % dict(homedir=HOME_DIR)),
'-v', get_volume_mapping('/etc/docker:/etc/docker:ro'),
'-v', get_volume_mapping('%(workdir)s:%(workdir)s:rw,shared' % dict(workdir=WORKDIR)),
'-v', get_volume_mapping('%(workdir)s:%(workdir)s:rw' % dict(workdir=WORKDIR)),
'-v', get_volume_mapping('entrypoint.sh:/opt/skipper/skipper-entrypoint.sh:rw'),
'-v', get_volume_mapping('/var/run/docker.sock:/var/run/docker.sock:rw'),
'-v', get_volume_mapping('/var/lib/osmosis:/var/lib/osmosis:rw'),
Expand Down Expand Up @@ -168,7 +168,7 @@ def test_run_complex_command_nested(self, resource_filename_mock, check_output_m
'-v', get_volume_mapping('%(homedir)s/.gitconfig:%(homedir)s/.gitconfig:ro' % dict(homedir=HOME_DIR)),
'-v', get_volume_mapping('%(homedir)s/.docker/config.json:%(homedir)s/.docker/config.json:ro' % dict(homedir=HOME_DIR)),
'-v', get_volume_mapping('/etc/docker:/etc/docker:ro'),
'-v', get_volume_mapping('%(workdir)s:%(workdir)s:rw,shared' % dict(workdir=WORKDIR)),
'-v', get_volume_mapping('%(workdir)s:%(workdir)s:rw' % dict(workdir=WORKDIR)),
'-v', get_volume_mapping('entrypoint.sh:/opt/skipper/skipper-entrypoint.sh:rw'),
'-v', get_volume_mapping('/var/run/docker.sock:/var/run/docker.sock:rw'),
'-v', get_volume_mapping('/var/lib/osmosis:/var/lib/osmosis:rw'),
Expand Down Expand Up @@ -213,7 +213,7 @@ def test_run_non_existent_unauthorized_volume(self, resource_filename_mock,
'-v', get_volume_mapping('%(homedir)s/.gitconfig:%(homedir)s/.gitconfig:ro' % dict(homedir=HOME_DIR)),
'-v', get_volume_mapping('%(homedir)s/.docker/config.json:%(homedir)s/.docker/config.json:ro' % dict(homedir=HOME_DIR)),
'-v', get_volume_mapping('/etc/docker:/etc/docker:ro'),
'-v', get_volume_mapping('%(workdir)s:%(workdir)s:rw,shared' % dict(workdir=WORKDIR)),
'-v', get_volume_mapping('%(workdir)s:%(workdir)s:rw' % dict(workdir=WORKDIR)),
'-v', get_volume_mapping('entrypoint.sh:/opt/skipper/skipper-entrypoint.sh:rw'),
'-v', get_volume_mapping('/var/run/docker.sock:/var/run/docker.sock:rw'),
'-v', get_volume_mapping('/var/lib/osmosis:/var/lib/osmosis:rw'),
Expand Down Expand Up @@ -256,7 +256,7 @@ def test_run_complex_command_nested_with_env(self, resource_filename_mock, check
'-v', get_volume_mapping('%(homedir)s/.gitconfig:%(homedir)s/.gitconfig:ro' % dict(homedir=HOME_DIR)),
'-v', get_volume_mapping('%(homedir)s/.docker/config.json:%(homedir)s/.docker/config.json:ro' % dict(homedir=HOME_DIR)),
'-v', get_volume_mapping('/etc/docker:/etc/docker:ro'),
'-v', get_volume_mapping('%(workdir)s:%(workdir)s:rw,shared' % dict(workdir=WORKDIR)),
'-v', get_volume_mapping('%(workdir)s:%(workdir)s:rw' % dict(workdir=WORKDIR)),
'-v', get_volume_mapping('entrypoint.sh:/opt/skipper/skipper-entrypoint.sh:rw'),
'-v', get_volume_mapping('/var/run/docker.sock:/var/run/docker.sock:rw'),
'-v', get_volume_mapping('/var/lib/osmosis:/var/lib/osmosis:rw'),
Expand Down

0 comments on commit c04428a

Please sign in to comment.