moby-derp 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -0
- data/lib/moby_derp/mount.rb +1 -1
- data/lib/moby_derp/pod_config.rb +9 -0
- data/lib/moby_derp/system_config.rb +11 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bdc70ac81fc8576afb34eaca6fe1faa74beeada5c176647e178f9c73cc02d96d
|
4
|
+
data.tar.gz: 369be36ae46d2ec386fe067dfa185ca3bf2526afafbb5ff6b547821f27ee1dc6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1019db159382b95296300d4c2cecf9dadb808c796a3c5bb44d5eb2596361e962a6613cdd454865f86579a2575712ffeeb8eac55957aa8aca293c29da035dd3f5
|
7
|
+
data.tar.gz: af0a5315ea9320da3964e8ce7e76c6515529aea6fddba6a786c21002af434fc6aff84adcdda0cf556a23e826b42b5073c15b4ab6ed63d361dba3d57f90d0bc07
|
data/README.md
CHANGED
@@ -107,6 +107,23 @@ The keys are:
|
|
107
107
|
mapped by a pod, and only the pod named in the mapping can publish on the
|
108
108
|
specified port.
|
109
109
|
|
110
|
+
* **`network_name`**: specify a network name to attach all pods to, if you
|
111
|
+
don't like Moby's default `bridge` network.
|
112
|
+
|
113
|
+
* **`use_host_resolv_conf`**: Moby has some... strange ideas about what
|
114
|
+
constitutes DNS records (like thinking that PTR records can only be for
|
115
|
+
rDNS). At the same time, you cannot, by purely Moby-sanctioned means,
|
116
|
+
disable the spectacularly broken DNS proxy that is inflicted on you if you
|
117
|
+
decide to use a custom network. The only feasible workaround that I have
|
118
|
+
discovered is to straight-up bind mount the host's `/etc/resolv.conf` into
|
119
|
+
every single container. If you, too, like your DNS resolution to work
|
120
|
+
properly when you use a non-default network, set this option to true.
|
121
|
+
|
122
|
+
Bear in mind, when constructing your host's `/etc/resolv.conf` file, that the
|
123
|
+
host's conception of "localhost" is different to each container's
|
124
|
+
"localhost"; so pointing to your local caching resolver using `127.0.0.1`
|
125
|
+
will not end in happiness and puppies.
|
126
|
+
|
110
127
|
If you wish to modify the location of the `moby-derp` system-wide configuration
|
111
128
|
file, you can do so by setting the `MOBY_DERP_SYSTEM_CONFIG_FILE` environment
|
112
129
|
variable. Note, however, that it is a terrible idea to let ordinary users control
|
data/lib/moby_derp/mount.rb
CHANGED
data/lib/moby_derp/pod_config.rb
CHANGED
@@ -55,6 +55,15 @@ module MobyDerp
|
|
55
55
|
@common_mounts = @config.fetch("common_mounts", [])
|
56
56
|
@expose = @config.fetch("expose", [])
|
57
57
|
@publish = @config.fetch("publish", [])
|
58
|
+
|
59
|
+
if @system_config.use_host_resolv_conf
|
60
|
+
@common_mounts << {
|
61
|
+
"source" => "/etc/resolv.conf",
|
62
|
+
"target" => "/etc/resolv.conf",
|
63
|
+
"readonly" => true
|
64
|
+
}
|
65
|
+
end
|
66
|
+
|
58
67
|
validate_common_mounts
|
59
68
|
validate_expose
|
60
69
|
validate_publish
|
@@ -4,16 +4,18 @@ require "safe_yaml"
|
|
4
4
|
|
5
5
|
module MobyDerp
|
6
6
|
class SystemConfig < ConfigFile
|
7
|
-
attr_reader :mount_root, :port_whitelist, :network_name, :
|
7
|
+
attr_reader :mount_root, :port_whitelist, :network_name, :use_host_resolv_conf,
|
8
|
+
:cpu_count, :cpu_bits
|
8
9
|
|
9
10
|
def initialize(filename, moby_info, logger)
|
10
11
|
@logger = logger
|
11
12
|
|
12
13
|
super(filename)
|
13
14
|
|
14
|
-
@mount_root
|
15
|
-
@port_whitelist
|
16
|
-
@network_name
|
15
|
+
@mount_root = @config["mount_root"]
|
16
|
+
@port_whitelist = stringify_keys(@config["port_whitelist"] || {})
|
17
|
+
@network_name = @config["network_name"] || "bridge"
|
18
|
+
@use_host_resolv_conf = @config["use_host_resolv_conf"] || false
|
17
19
|
|
18
20
|
@cpu_count = moby_info["NCPU"]
|
19
21
|
# As far as I can tell, the only 32-bit platform Moby supports is
|
@@ -35,6 +37,11 @@ module MobyDerp
|
|
35
37
|
"network_name must be a string"
|
36
38
|
end
|
37
39
|
|
40
|
+
unless [true, false].include?(@use_host_resolv_conf)
|
41
|
+
raise ConfigurationError,
|
42
|
+
"use_host_resolv_conf must be true or false"
|
43
|
+
end
|
44
|
+
|
38
45
|
unless File.directory?(@mount_root)
|
39
46
|
raise ConfigurationError,
|
40
47
|
"mount_root #{@mount_root} must exist and be a directory"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moby-derp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Palmer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docker-api
|