Skip to content

Commit ca6fa18

Browse files
authored
feat: support for network type (#72)
* feat: support for network type * example for --network=fakeroot Signed-off-by: vsoch <[email protected]>
1 parent 088bd96 commit ca6fa18

File tree

5 files changed

+30
-2
lines changed

5 files changed

+30
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ and **Merged pull requests**. Critical items to know are:
1414
The versions coincide with releases on pypi.
1515

1616
## [0.1.x](https://github.com/singularityhub/singularity-compose/tree/master) (0.1.x)
17+
- support for custom network type (0.1.19)
1718
- fix 'bridge' option for 'up' command (0.1.18)
1819
- add support for instance replicas (0.1.17)
1920
- fix check command validation (0.1.16)

docs/commands.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
The following commands are currently supported. Remember, you must be in the
44
present working directory of the compose file to reference the correct instances.
5+
Along with the below, you can find more details and examples for singularity-compose.yaml
6+
syntax under the [current spec](spec/spec-2.0.md)
57

68
## check
79

docs/spec/spec-2.0.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,26 @@ The example below will disable the network features:
149149
enable: true | false
150150
```
151151

152+
### Custom Network
153+
154+
If you want to add your own customized string of network types for `--network`, just do that:
155+
156+
```yaml
157+
instance1:
158+
...
159+
network:
160+
type: bridge
161+
```
162+
163+
You might also want `--network=fakeroot`:
164+
165+
```yaml
166+
instance1:
167+
...
168+
network:
169+
type: fakeroot
170+
```
171+
152172

153173
## Start Group
154174

scompose/project/instance.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,13 @@ def _get_network_commands(self, ip_address=None):
226226
# Fakeroot means not needing sudo
227227
fakeroot = "--fakeroot" in self.start_opts or "-f" in self.start_opts
228228

229+
# Do we have a custom type?
230+
network_type = self.network.get("type")
231+
if network_type is not None:
232+
ports += ["--network", network_type]
233+
229234
# If not sudo or fakeroot, we need --network none
230-
if not self.sudo and not fakeroot:
235+
elif not self.sudo and not fakeroot:
231236
ports += ["--network", "none"]
232237

233238
for pair in self.ports:

scompose/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
99
"""
1010

11-
__version__ = "0.1.18"
11+
__version__ = "0.1.19"
1212
AUTHOR = "Vanessa Sochat"
1313
AUTHOR_EMAIL = "[email protected]"
1414
NAME = "singularity-compose"

0 commit comments

Comments
 (0)