Skip to content

Commit

Permalink
Merge pull request #538 from Luap99/v1.13
Browse files Browse the repository at this point in the history
[v1.13] Backports for 1.13.1
  • Loading branch information
openshift-merge-bot[bot] authored Nov 5, 2024
2 parents 8bb4806 + fd6eb0a commit a3bfaec
Show file tree
Hide file tree
Showing 11 changed files with 193 additions and 116 deletions.
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Main collection of env. vars to set for all tasks and scripts.
env:
# Actual|intended branch for this run
DEST_BRANCH: "main"
DEST_BRANCH: "v1.13"
# The default is 'sh' if unspecified
CIRRUS_SHELL: "/bin/bash"
# Location where source repo. will be cloned
Expand Down
45 changes: 14 additions & 31 deletions .packit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ packages:
aardvark-dns-centos:
pkg_tool: centpkg
specfile_path: rpm/aardvark-dns.spec
aardvark-dns-rhel:
specfile_path: rpm/aardvark-dns.spec
aardvark-dns-eln:
specfile_path: rpm/aardvark-dns.spec

Expand All @@ -49,6 +47,7 @@ jobs:
- fedora-all-x86_64
- fedora-all-aarch64
enable_net: true
osh_diff_scan_after_copr_build: false

- job: copr_build
trigger: pull_request
Expand All @@ -74,15 +73,6 @@ jobs:
- centos-stream-10-aarch64
enable_net: true

- job: copr_build
trigger: pull_request
packages: [aardvark-dns-rhel]
notifications: *copr_build_failure_notification
targets:
- epel-9-x86_64
- epel-9-aarch64
enable_net: true

# Run on commit to main branch
- job: copr_build
trigger: commit
Expand Down Expand Up @@ -111,33 +101,25 @@ jobs:
- fedora-latest-stable-aarch64
- fedora-40-x86_64
- fedora-40-aarch64
tf_extra_params:
environments:
- artifacts:
- type: repository-file
id: https://copr.fedorainfracloud.org/coprs/rhcontainerbot/podman-next/repo/fedora-$releasever/rhcontainerbot-podman-next-fedora-$releasever.repo

# Unit tests on CentOS Stream
- job: tests
trigger: pull_request
packages: [aardvark-dns-centos]
notifications: *test_failure_notification
targets: *centos_copr_targets

# Unit tests on RHEL
- job: tests
trigger: pull_request
packages: [aardvark-dns-rhel]
notifications: *test_failure_notification
use_internal_tf: true
targets:
epel-9-aarch64:
distros: [RHEL-9-Nightly,RHEL-9.4.0-Nightly]
epel-9-x86_64:
distros: [RHEL-9-Nightly,RHEL-9.4.0-Nightly]
# NOTE: Need to use centos-stream-10 until RHEL-10/EPEL-10 copr targets
# are available
# TODO: iptables kernel module is not available on rhel10.
# Enable these after netavark default is switched to nftables.
#centos-stream-10-aarch64:
# distros: [RHEL-10-Beta-Nightly]
#centos-stream-10-x86_64:
# distros: [RHEL-10-Beta-Nightly]
tf_extra_params:
environments:
- artifacts:
- type: repository-file
id: https://copr.fedorainfracloud.org/coprs/rhcontainerbot/podman-next/repo/centos-stream-$releasever/rhcontainerbot-podman-next-centos-stream-$releasever.repo
- type: repository-file
id: https://src.fedoraproject.org/rpms/epel-release/raw/epel$releasever/f/epel.repo

# Sync to Fedora
- job: propose_downstream
Expand All @@ -154,6 +136,7 @@ jobs:
update_release: false
dist_git_branches:
- c10s
- c9s

- job: koji_build
trigger: commit
Expand Down
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ hickory-proto = { version = "0.24.1", features = ["tokio-runtime"] }
hickory-client = "0.24.1"
futures-util = { version = "0.3.31", default-features = false }
tokio = { version = "1.41.0", features = ["macros", "rt-multi-thread", "net", "signal"] }
nix = { version = "0.29.0", features = ["fs", "signal"] }
nix = { version = "0.29.0", features = ["fs", "signal", "net"] }
libc = "0.2.161"
arc-swap = "1.7.1"
flume = "0.11.1"
Expand Down
1 change: 1 addition & 0 deletions plans/all.fmf → plans/main.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ execute:
summary: Run tests on bodhi / errata and dist-git PRs
discover+:
filter: tag:downstream
dist-git-install-builddeps: true
dist-git-source: true
dist-git-remove-fmf-root: true
adjust+:
Expand Down
8 changes: 0 additions & 8 deletions rpm/aardvark-dns.spec
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,4 @@ tar fx %{SOURCE1}
%{_libexecdir}/podman/%{name}

%changelog
%if %{defined autochangelog}
%autochangelog
%else
# NOTE: This changelog will be visible on CentOS 8 Stream builds
# Other envs are capable of handling autochangelog
* Wed Jun 14 2023 RH Container Bot <[email protected]>
- Placeholder changelog for envs that are not autochangelog-ready
- Contact upstream if you need to report an issue with the build.
%endif
23 changes: 12 additions & 11 deletions src/dns/coredns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,19 @@ use tokio::net::UdpSocket;

const DEFAULT_TIMEOUT: Duration = Duration::from_secs(5);

pub const DNS_PORT: u16 = 53;

pub struct CoreDns {
rx: flume::Receiver<()>, // kill switch receiver
inner: CoreDnsData,
}

#[derive(Clone)]
struct CoreDnsData {
network_name: String, // raw network name
backend: &'static ArcSwap<DNSBackend>, // server's data store
no_proxy: bool, // do not forward to external resolvers
nameservers: Arc<Mutex<Vec<IpAddr>>>, // host nameservers from resolv.conf
network_name: String, // raw network name
backend: &'static ArcSwap<DNSBackend>, // server's data store
no_proxy: bool, // do not forward to external resolvers
nameservers: Arc<Mutex<Vec<SocketAddr>>>, // host nameservers from resolv.conf
}

enum Protocol {
Expand All @@ -52,7 +54,7 @@ impl CoreDns {
backend: &'static ArcSwap<DNSBackend>,
rx: flume::Receiver<()>,
no_proxy: bool,
nameservers: Arc<Mutex<Vec<IpAddr>>>,
nameservers: Arc<Mutex<Vec<SocketAddr>>>,
) -> Self {
CoreDns {
rx,
Expand Down Expand Up @@ -211,18 +213,18 @@ impl CoreDns {
"Forwarding dns request for {} type: {}",
&request_name_string, record_type
);
let mut nameservers: Vec<IpAddr> = Vec::new();
let mut nameservers = Vec::new();
// Add resolvers configured for container
if let Some(Some(dns_servers)) = backend.ctr_dns_server.get(&src_address.ip()) {
for dns_server in dns_servers.iter() {
nameservers.push(*dns_server);
nameservers.push(SocketAddr::new(*dns_server, DNS_PORT));
}
// Add network scoped resolvers only if container specific resolvers were not configured
} else if let Some(network_dns_servers) =
backend.get_network_scoped_resolvers(&src_address.ip())
{
for dns_server in network_dns_servers.iter() {
nameservers.push(*dns_server);
nameservers.push(SocketAddr::new(*dns_server, DNS_PORT));
}
}
// Use host resolvers if no custom resolvers are set for the container.
Expand All @@ -249,7 +251,7 @@ impl CoreDns {
}

async fn forward_to_servers(
nameservers: Vec<IpAddr>,
nameservers: Vec<SocketAddr>,
mut sender: BufDnsStreamHandle,
src_address: SocketAddr,
req: Message,
Expand All @@ -261,8 +263,7 @@ impl CoreDns {
timeout = Duration::from_secs(5) / nameservers.len() as u32
}
// forward dns request to hosts's /etc/resolv.conf
for nameserver in &nameservers {
let addr = SocketAddr::new(*nameserver, 53);
for addr in nameservers {
let (client, handle) = match proto {
Protocol::Udp => {
let stream = UdpClientStream::<UdpSocket>::with_timeout(addr, timeout);
Expand Down
Loading

0 comments on commit a3bfaec

Please sign in to comment.