Skip to content

Commit

Permalink
Merge pull request bottlerocket-os#3700 from jmt-lab/jmt/netdog/condi…
Browse files Browse the repository at this point in the history
…tional-removal

Jmt/netdog/conditional removal
  • Loading branch information
jmt-lab authored May 2, 2024
2 parents 504c0e8 + e0b18ac commit 8933289
Show file tree
Hide file tree
Showing 232 changed files with 360 additions and 331 deletions.
File renamed without changes.
23 changes: 23 additions & 0 deletions packages/netdog/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[package]
name = "netdog"
version = "0.1.0"
edition = "2021"
publish = false
build = "../build.rs"

[lib]
path = "../packages.rs"

[package.metadata.build-packages]
source-groups = [
"netdog",
"dogtag",
]

# RPM BuildRequires
[build-dependencies]
glibc = { path = "../glibc" }

[dependencies]
wicked = { path = "../wicked" }
systemd = { path = "../systemd" }
File renamed without changes.
File renamed without changes.
File renamed without changes.
123 changes: 123 additions & 0 deletions packages/netdog/netdog.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
%global _cross_first_party 1
%undefine _debugsource_packages

Name: %{_cross_os}netdog
Version: 0.1.1
Release: 0%{?dist}
Summary: Bottlerocket network configuration helper
License: Apache-2.0 OR MIT
URL: https://github.com/bottlerocket-os/bottlerocket

Source0: netdog-tmpfiles.conf

Source10: run-netdog.mount
Source11: write-network-status.service
Source12: generate-network-config.service
Source13: disable-udp-offload.service

Source20: 00-resolved.conf

BuildRequires: %{_cross_os}glibc-devel
Requires: %{_cross_os}hostname-reverse-dns
Requires: (%{_cross_os}hostname-imds if %{_cross_os}variant-platform(aws))
Requires: (%{_cross_os}netdog-systemd-networkd if %{_cross_os}image-feature(systemd-networkd))
Requires: (%{_cross_os}netdog-wicked if %{_cross_os}image-feature(no-systemd-networkd))

%description
%{summary}.

%package systemd-networkd
Summary: Bottlerocket network configuration helper
Requires: %{name}
Requires: %{_cross_os}systemd-networkd
Requires: %{_cross_os}systemd-resolved
Conflicts: (%{_cross_os}netdog-wicked or %{_cross_os}image-feature(no-systemd-networkd))
%description -n %{_cross_os}netdog-systemd-networkd
%{summary}.

%package wicked
Summary: Bottlerocket network configuration helper
Requires: %{name}
Requires: %{_cross_os}wicked
Conflicts: (%{_cross_os}netdog-systemd-networkd or %{_cross_os}image-feature(systemd-networkd))
%description -n %{_cross_os}netdog-wicked
%{summary}.

%package -n %{_cross_os}hostname-reverse-dns
Summary: Reverse DNS Hostname detector
%description -n %{_cross_os}hostname-reverse-dns
%{summary}

%package -n %{_cross_os}hostname-imds
Summary: IMDS Hostname detector
%description -n %{_cross_os}hostname-imds
%{summary}

%prep
%setup -T -c
%cargo_prep

%build
mkdir bin

echo "** Build Dogtag Hostname Detectors"
%cargo_build --manifest-path %{_builddir}/sources/Cargo.toml \
-p dogtag \
--bins \
--target-dir=${HOME}/.cache/dogtag

echo "** Build Netdog Binaries"
%cargo_build --manifest-path %{_builddir}/sources/Cargo.toml \
-p netdog \
--features default \
--target-dir=${HOME}/.cache/networkd
%cargo_build --manifest-path %{_builddir}/sources/Cargo.toml \
-p netdog \
--features wicked \
--target-dir=${HOME}/.cache/wicked

%install
install -d %{buildroot}%{_cross_libexecdir}/hostname-detectors
install -p -m 0755 ${HOME}/.cache/dogtag/%{__cargo_target}/release/20-imds %{buildroot}%{_cross_libexecdir}/hostname-detectors/20-imds
install -p -m 0755 ${HOME}/.cache/dogtag/%{__cargo_target}/release/10-reverse-dns %{buildroot}%{_cross_libexecdir}/hostname-detectors/10-reverse-dns

install -d %{buildroot}%{_cross_bindir}
install -p -m 0755 ${HOME}/.cache/networkd/%{__cargo_target}/release/netdog %{buildroot}%{_cross_bindir}/netdog-systemd-networkd
install -p -m 0755 ${HOME}/.cache/wicked/%{__cargo_target}/release/netdog %{buildroot}%{_cross_bindir}/netdog-wicked

install -d %{buildroot}%{_cross_tmpfilesdir}
install -p -m 0644 %{S:0} %{buildroot}%{_cross_tmpfilesdir}/netdog.conf

install -d %{buildroot}%{_cross_unitdir}
install -p -m 0644 %{S:10} %{S:11} %{S:12} %{S:13} %{buildroot}%{_cross_unitdir}

install -d %{buildroot}%{_cross_libdir}
install -d %{buildroot}%{_cross_libdir}/systemd/resolved.conf.d
install -p -m 0644 %{S:20} %{buildroot}%{_cross_libdir}/systemd/resolved.conf.d

%post wicked -p <lua>
posix.symlink("netdog-wicked", "%{_cross_bindir}/netdog")

%post systemd-networkd -p <lua>
posix.symlink("netdog-systemd-networkd", "%{_cross_bindir}/netdog")

%files
%{_cross_tmpfilesdir}/netdog.conf
%{_cross_unitdir}/generate-network-config.service
%{_cross_unitdir}/disable-udp-offload.service
%{_cross_unitdir}/run-netdog.mount

%files -n %{_cross_os}hostname-reverse-dns
%{_cross_libexecdir}/hostname-detectors/10-reverse-dns

%files -n %{_cross_os}hostname-imds
%{_cross_libexecdir}/hostname-detectors/20-imds

%files systemd-networkd
%{_cross_bindir}/netdog-systemd-networkd
%{_cross_unitdir}/write-network-status.service
%dir %{_cross_libdir}/systemd/resolved.conf.d
%{_cross_libdir}/systemd/resolved.conf.d/00-resolved.conf

%files wicked
%{_cross_bindir}/netdog-wicked
File renamed without changes.
File renamed without changes.
4 changes: 0 additions & 4 deletions packages/os/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ source-groups = [
"bloodhound",
"xfscli",
]
package-features = [ "systemd-networkd" ]

[lib]
path = "../packages.rs"
Expand All @@ -46,6 +45,3 @@ glibc = { path = "../glibc" }
# binutils = { path = "../binutils" }
# oci-add-hooks required for shimpei functionality
# oci-add-hooks = { path = "../oci-add-hooks" }
# wicked and systemd-networkd required for netdog functionality
# wicked = { path = "../wicked" }
# systemd-networkd = { path = "../systemd" }
51 changes: 3 additions & 48 deletions packages/os/os.spec
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ Source8: oci-default-hooks-json
Source9: cfsignal-toml
Source10: warm-pool-wait-toml
Source11: bottlerocket-cis-checks-metadata-json
Source12: 00-resolved.conf
Source13: kubernetes-cis-checks-metadata-json
Source14: certdog-toml
Source15: prairiedog-toml
Expand All @@ -52,20 +51,15 @@ Source114: [email protected]
Source115: link-kernel-modules.service.in
Source116: load-kernel-modules.service.in
Source117: cfsignal.service
Source118: generate-network-config.service
Source119: reboot-if-required.service
Source120: warm-pool-wait.service
Source121: disable-udp-offload.service
Source122: has-boot-ever-succeeded.service
Source123: run-netdog.mount
Source124: write-network-status.service

# 2xx sources: tmpfilesd configs
Source200: migration-tmpfiles.conf
Source201: host-containers-tmpfiles.conf
Source202: thar-be-updates-tmpfiles.conf
Source203: bootstrap-containers-tmpfiles.conf
Source204: netdog-tmpfiles.conf

# 3xx sources: udev rules
Source300: ephemeral-storage.rules
Expand All @@ -90,7 +84,6 @@ Requires: %{_cross_os}host-containers
Requires: %{_cross_os}logdog
Requires: %{_cross_os}metricdog
Requires: %{_cross_os}migration
Requires: %{_cross_os}netdog
Requires: %{_cross_os}prairiedog
Requires: %{_cross_os}schnauzer
Requires: %{_cross_os}settings-committer
Expand Down Expand Up @@ -129,17 +122,6 @@ Summary: Bottlerocket API client
%description -n %{_cross_os}apiclient
%{summary}.

%package -n %{_cross_os}netdog
Summary: Bottlerocket network configuration helper
%if %{with systemd_networkd}
Requires: %{_cross_os}systemd-networkd
Requires: %{_cross_os}systemd-resolved
%else
Requires: %{_cross_os}wicked
%endif
%description -n %{_cross_os}netdog
%{summary}.

%package -n %{_cross_os}sundog
Summary: Updates settings dynamically based on user-specified generators
%description -n %{_cross_os}sundog
Expand Down Expand Up @@ -363,7 +345,6 @@ exec 1>&3 2>&4
echo "** Output from non-static builds:"
%cargo_build --manifest-path %{_builddir}/sources/Cargo.toml \
-p apiserver \
-p netdog \
-p sundog \
-p schnauzer \
-p bork \
Expand Down Expand Up @@ -411,7 +392,7 @@ fi
install -d %{buildroot}%{_cross_bindir}
for p in \
apiserver \
netdog sundog schnauzer schnauzer-v2 bork \
sundog schnauzer schnauzer-v2 bork \
corndog thar-be-settings thar-be-updates host-containers \
storewolf settings-committer \
migrator prairiedog certdog \
Expand Down Expand Up @@ -522,17 +503,10 @@ install -p -m 0644 %{S:5} %{S:6} %{S:7} %{S:8} %{S:14} %{S:15} %{S:16} %{S:17} %
install -d %{buildroot}%{_cross_unitdir}
install -p -m 0644 \
%{S:100} %{S:102} %{S:103} %{S:105} \
%{S:106} %{S:107} %{S:110} %{S:111} \
%{S:112} %{S:113} %{S:114} %{S:118} \
%{S:119} %{S:122} %{S:123} \
%{S:106} %{S:107} %{S:110} %{S:111} %{S:112} \
%{S:113} %{S:114} %{S:119} %{S:122} \
%{buildroot}%{_cross_unitdir}

%if %{with systemd_networkd}
install -p -m 0644 %{S:124} %{buildroot}%{_cross_unitdir}
install -d %{buildroot}%{_cross_libdir}/systemd/resolved.conf.d
install -p -m 0644 %{S:12} %{buildroot}%{_cross_libdir}/systemd/resolved.conf.d
%endif

%if %{with nvidia_flavor}
sed -e 's|PREFIX|%{_cross_prefix}|g' %{S:115} > link-kernel-modules.service
sed -e 's|PREFIX|%{_cross_prefix}|g' %{S:116} > load-kernel-modules.service
Expand All @@ -556,17 +530,12 @@ install -p -m 0644 %{S:200} %{buildroot}%{_cross_tmpfilesdir}/migration.conf
install -p -m 0644 %{S:201} %{buildroot}%{_cross_tmpfilesdir}/host-containers.conf
install -p -m 0644 %{S:202} %{buildroot}%{_cross_tmpfilesdir}/thar-be-updates.conf
install -p -m 0644 %{S:203} %{buildroot}%{_cross_tmpfilesdir}/bootstrap-containers.conf
install -p -m 0644 %{S:204} %{buildroot}%{_cross_tmpfilesdir}/netdog.conf

install -d %{buildroot}%{_cross_udevrulesdir}
install -p -m 0644 %{S:300} %{buildroot}%{_cross_udevrulesdir}/80-ephemeral-storage.rules
install -p -m 0644 %{S:301} %{buildroot}%{_cross_udevrulesdir}/81-ebs-volumes.rules
install -p -m 0644 %{S:302} %{buildroot}%{_cross_udevrulesdir}/82-supplemental-storage.rules

%if %{with vmware_platform}
install -p -m 0644 %{S:121} %{buildroot}%{_cross_unitdir}
%endif

%cross_scan_attribution --clarify %{_builddir}/sources/clarify.toml \
cargo --offline --locked %{_builddir}/sources/Cargo.toml

Expand All @@ -589,20 +558,6 @@ install -p -m 0644 %{S:400} %{S:401} %{S:402} %{buildroot}%{_cross_licensedir}
%files -n %{_cross_os}apiclient
%{_cross_bindir}/apiclient

%files -n %{_cross_os}netdog
%{_cross_bindir}/netdog
%{_cross_tmpfilesdir}/netdog.conf
%{_cross_unitdir}/generate-network-config.service
%{_cross_unitdir}/run-netdog.mount
%if %{with vmware_platform}
%{_cross_unitdir}/disable-udp-offload.service
%endif
%if %{with systemd_networkd}
%{_cross_unitdir}/write-network-status.service
%dir %{_cross_libdir}/systemd/resolved.conf.d
%{_cross_libdir}/systemd/resolved.conf.d/00-resolved.conf
%endif

%files -n %{_cross_os}corndog
%{_cross_bindir}/corndog
%{_cross_templatedir}/corndog-toml
Expand Down
2 changes: 1 addition & 1 deletion packages/release/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ libgcc = { path = "../libgcc" }
libkcapi = { path = "../libkcapi" }
libstd-rust = { path = "../libstd-rust" }
makedumpfile = { path = "../../packages/makedumpfile" }
netdog = {path = "../netdog" }
os = { path = "../os" }
oci-add-hooks = { path = "../oci-add-hooks" }
policycoreutils = { path = "../policycoreutils" }
Expand All @@ -48,5 +49,4 @@ selinux-policy = { path = "../selinux-policy" }
shim = { path = "../shim" }
systemd = { path = "../systemd" }
util-linux = { path = "../util-linux" }
wicked = { path = "../wicked" }
xfsprogs = { path = "../xfsprogs" }
1 change: 1 addition & 0 deletions packages/release/release.spec
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ Requires: %{_cross_os}iptables
Requires: %{_cross_os}kexec-tools
Requires: %{_cross_os}keyutils
Requires: %{_cross_os}makedumpfile
Requires: %{_cross_os}netdog
Requires: %{_cross_os}os
Requires: %{_cross_os}policycoreutils
Requires: %{_cross_os}procps
Expand Down
6 changes: 2 additions & 4 deletions sources/Cargo.lock

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

3 changes: 2 additions & 1 deletion sources/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ members = [
"api/certdog",
"api/corndog",
"api/datastore",
"api/netdog",
"api/sundog",
"api/schnauzer",
"api/pluto",
Expand Down Expand Up @@ -115,6 +114,8 @@ members = [

"metricdog",

"netdog",

"cfsignal",

"logdog",
Expand Down
Loading

0 comments on commit 8933289

Please sign in to comment.