Skip to content

Commit

Permalink
fix: do not set network aliases for host or bridge networks (#295)
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Dean <[email protected]>
  • Loading branch information
b-dean authored Nov 25, 2023
1 parent ff6b25c commit 02e6f23
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
8 changes: 8 additions & 0 deletions kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,11 @@ suites:
- centos
driver:
ipv6: true

- name: bridge
driver:
network_mode: bridge

- name: host
driver:
network_mode: host
18 changes: 12 additions & 6 deletions lib/kitchen/driver/dokken.rb
Original file line number Diff line number Diff line change
Expand Up @@ -319,14 +319,16 @@ def start_runner_container(state)
"Tmpfs" => dokken_tmpfs,
"Memory" => self[:memory_limit],
},
"NetworkingConfig" => {
}
unless %w{host bridge}.include?(self[:network_mode])
config["NetworkingConfig"] = {
"EndpointsConfig" => {
self[:network_mode] => {
"Aliases" => Array(self[:hostname]).concat(Array(self[:hostname_aliases])),
},
},
},
}
}
end
unless self[:entrypoint].to_s.empty?
config["Entrypoint"] = self[:entrypoint]
end
Expand Down Expand Up @@ -360,19 +362,23 @@ def start_data_container(state)
"PublishAllPorts" => true,
"NetworkMode" => "bridge",
},
"NetworkingConfig" => {
}
unless %w{host bridge}.include?(self[:network_mode])
config["NetworkingConfig"] = {
"EndpointsConfig" => {
self[:network_mode] => {
"Aliases" => Array(self[:hostname]),
},
},
},
}
}
end
data_container = run_container(config)
state[:data_container] = data_container.json
end

def make_dokken_network
return unless self[:network_mode] == "dokken"

lockfile = Lockfile.new "#{home_dir}/.dokken-network.lock"
begin
lockfile.lock
Expand Down

0 comments on commit 02e6f23

Please sign in to comment.