-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
netavark ,aardvark: accept and populate custom dns_servers
for containers
#452
Merged
openshift-merge-robot
merged 1 commit into
containers:main
from
flouthoc:container-dns-servers
Oct 18, 2022
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -148,6 +148,39 @@ fw_driver=iptables | |
run_netavark --file ${TESTSDIR}/testfiles/ipv6-bridge.json teardown $(get_container_netns_path) | ||
} | ||
|
||
@test "$fw_driver - bridge driver must generate config for aardvark with custom dns server" { | ||
# TODO !!! Unkip after https://github.com/containers/aardvark-dns/pull/240 | ||
skip "unskip after https://github.com/containers/aardvark-dns/pull/240" | ||
# get a random port directly to avoid low ports e.g. 53 would not create iptables | ||
flouthoc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
dns_port=$((RANDOM+10000)) | ||
|
||
# hack to make aardvark-dns run when really root or when running as user with | ||
# podman unshare --rootless-netns; since netavark runs aardvark with systemd-run | ||
# it needs to know if it should use systemd user instance or not. | ||
# iptables are still setup identically. | ||
rootless=false | ||
if [[ ! -e "/run/dbus/system_bus_socket" ]]; then | ||
rootless=true | ||
fi | ||
|
||
mkdir -p "$NETAVARK_TMPDIR/config" | ||
|
||
NETAVARK_DNS_PORT="$dns_port" run_netavark --file ${TESTSDIR}/testfiles/dualstack-bridge-custom-dns-server.json \ | ||
--rootless "$rootless" --config "$NETAVARK_TMPDIR/config" \ | ||
setup $(get_container_netns_path) | ||
|
||
# check aardvark config and running | ||
run_helper cat "$NETAVARK_TMPDIR/config/aardvark-dns/podman1" | ||
assert "${lines[0]}" =~ "10.89.3.1,fd10:88:a::1" "aardvark set to listen to all IPs" | ||
assert "${lines[1]}" =~ "^[0-9a-f]{64} 10.89.3.2 fd10:88:a::2 somename 8.8.8.8$" "aardvark config's container" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should also test at least two custom servers but since we cannot test it right now I fine with keeping like this and add a second test for this once aardvark is ready |
||
assert "${#lines[@]}" = 2 "too many lines in aardvark config" | ||
|
||
aardvark_pid=$(cat "$NETAVARK_TMPDIR/config/aardvark-dns/aardvark.pid") | ||
assert "$ardvark_pid" =~ "[0-9]*" "aardvark pid not found" | ||
run_helper ps "$aardvark_pid" | ||
assert "${lines[1]}" =~ ".*aardvark-dns --config $NETAVARK_TMPDIR/config/aardvark-dns -p $dns_port run" "aardvark not running or bad options" | ||
} | ||
|
||
@test "$fw_driver - dual stack dns with alt port" { | ||
# get a random port directly to avoid low ports e.g. 53 would not create iptables | ||
dns_port=$((RANDOM+10000)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"container_id": "f031bf33eecba75d0d84952337b1ceef6a239eb8e94b48aee0993d0791345325", | ||
"container_name": "somename", | ||
"dns_servers": ["8.8.8.8"], | ||
"networks": { | ||
"podman1": { | ||
"static_ips": [ | ||
"10.89.3.2", | ||
"fd10:88:a::2" | ||
], | ||
"interface_name": "eth0" | ||
} | ||
}, | ||
"network_info": { | ||
"podman1": { | ||
"name": "podman1", | ||
"id": "ec79dd0cad82083c8ac5cc23e9542e4ddea813dff60d68258d36e84f6393b63b", | ||
"driver": "bridge", | ||
"network_interface": "podman1", | ||
"subnets": [ | ||
{ | ||
"subnet": "10.89.3.0/24", | ||
"gateway": "10.89.3.1" | ||
}, | ||
{ | ||
"subnet": "fd10:88:a::/64", | ||
"gateway": "fd10:88:a::1" | ||
} | ||
], | ||
"ipv6_enabled": true, | ||
"internal": false, | ||
"dns_enabled": true, | ||
"ipam_options": { | ||
"driver": "host-local" | ||
} | ||
} | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where are we prepending a space so that this is separated from the previous field?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mheon Here https://github.com/containers/netavark/pull/452/files#diff-6307ba066c1817023f2a53b2c7c6a64d35bde6cf7f443cf5b07f34b9f163513bR260
format!(" {}", dns_server_collected)