Skip to content

Commit

Permalink
Merge pull request #23 from bcressey/make-features-optional
Browse files Browse the repository at this point in the history
enable host containers and in-place updates to be optional
  • Loading branch information
bcressey authored Jul 3, 2024
2 parents e4f9f14 + 095acef commit a4226f4
Show file tree
Hide file tree
Showing 14 changed files with 192 additions and 90 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

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

4 changes: 2 additions & 2 deletions packages/os/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ glibc = { path = "../glibc" }

# RPM Requires
[dependencies]
# We depend on these packages at runtime, and are expected to be pulled in
# by way of the `release` package.
# We depend on these packages at runtime, and they are expected to be built
# because they are included in the core kit.
# `host-ctr` for host containers functionality
# host-ctr = { path = "../host-ctr" }
# kexec-tools and makedumpfile required for prairiedog functionality
Expand Down
4 changes: 2 additions & 2 deletions packages/os/apiserver.service
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Unit]
Description=Bottlerocket API server
After=storewolf.service migrator.service
Requires=storewolf.service migrator.service
After=storewolf.service
Requires=storewolf.service

[Service]
Type=notify
Expand Down
1 change: 0 additions & 1 deletion packages/os/mark-successful-boot.service
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ Description=Call signpost to mark the boot as successful after all required targ
# This unit is in charge of updating the partitions on successful boots. Use other service
# units instead of adding more `ExecStart*` lines to prevent indirect dependencies on
# other units not listed in the `RequiredBy` section.
Requires=migrator.service
# Block manual interactions with this service, manually running it could leave the system in an
# unexpected state
RefuseManualStart=true
Expand Down
4 changes: 3 additions & 1 deletion packages/os/migrator.service
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[Unit]
Description=Bottlerocket data store migrator
Before=apiserver.service mark-successful-boot.service storewolf.service

RefuseManualStart=true
RefuseManualStop=true

Expand All @@ -16,4 +18,4 @@ StandardOutput=journal+console
StandardError=journal+console

[Install]
RequiredBy=preconfigured.target
RequiredBy=preconfigured.target apiserver.service mark-successful-boot.service storewolf.service
23 changes: 16 additions & 7 deletions packages/os/os.spec
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,11 @@ BuildRequires: %{_cross_os}glibc-devel
Requires: %{_cross_os}apiclient
Requires: %{_cross_os}apiserver
Requires: %{_cross_os}bloodhound
Requires: %{_cross_os}bootstrap-containers
Requires: %{_cross_os}bork
Requires: %{_cross_os}corndog
Requires: %{_cross_os}certdog
Requires: %{_cross_os}ghostdog
Requires: %{_cross_os}host-containers
Requires: %{_cross_os}logdog
Requires: %{_cross_os}metricdog
Requires: %{_cross_os}migration
Requires: %{_cross_os}prairiedog
Requires: %{_cross_os}schnauzer
Requires: %{_cross_os}settings-committer
Expand All @@ -92,8 +88,14 @@ Requires: %{_cross_os}storewolf
Requires: %{_cross_os}sundog
Requires: %{_cross_os}xfscli
Requires: %{_cross_os}thar-be-settings
Requires: %{_cross_os}thar-be-updates
Requires: %{_cross_os}updog

Requires: (%{_cross_os}bootstrap-containers or %{_cross_os}image-feature(no-host-containers))
Requires: (%{_cross_os}host-containers or %{_cross_os}image-feature(no-host-containers))

Requires: (%{_cross_os}bork or %{_cross_os}image-feature(no-in-place-updates))
Requires: (%{_cross_os}migration or %{_cross_os}image-feature(no-in-place-updates))
Requires: (%{_cross_os}thar-be-updates or %{_cross_os}image-feature(no-in-place-updates))
Requires: (%{_cross_os}updog or %{_cross_os}image-feature(no-in-place-updates))

Requires: (%{_cross_os}pluto if %{_cross_os}variant-family(aws-k8s))
Requires: (%{_cross_os}shibaken if %{_cross_os}variant-platform(aws))
Expand Down Expand Up @@ -124,6 +126,7 @@ Summary: Updates settings dynamically based on user-specified generators

%package -n %{_cross_os}bork
Summary: Dynamic setting generator for updog
Conflicts: %{_cross_os}image-feature(no-in-place-updates)
%description -n %{_cross_os}bork
%{summary}.

Expand All @@ -144,12 +147,14 @@ Summary: Applies changed settings to a Bottlerocket system

%package -n %{_cross_os}thar-be-updates
Summary: Dispatches Bottlerocket update commands
Conflicts: %{_cross_os}image-feature(no-in-place-updates)
%description -n %{_cross_os}thar-be-updates
%{summary}.

%package -n %{_cross_os}host-containers
Summary: Manages system- and user-defined host containers
Requires: %{_cross_os}host-ctr
Conflicts: %{_cross_os}image-feature(no-host-containers)
%description -n %{_cross_os}host-containers
%{summary}.

Expand All @@ -161,6 +166,7 @@ Requires: %{_cross_os}settings-defaults

%package -n %{_cross_os}migration
Summary: Tools to migrate version formats
Conflicts: %{_cross_os}image-feature(no-in-place-updates)
%description -n %{_cross_os}migration

%package -n %{_cross_os}settings-committer
Expand All @@ -181,6 +187,7 @@ Summary: Bottlerocket GPT priority querier/switcher

%package -n %{_cross_os}updog
Summary: Bottlerocket updater CLI
Conflicts: %{_cross_os}image-feature(no-in-place-updates)
%description -n %{_cross_os}updog
not much what's up with you

Expand Down Expand Up @@ -241,6 +248,8 @@ Requires: %{_cross_os}binutils

%package -n %{_cross_os}bootstrap-containers
Summary: Manages bootstrap-containers
Requires: %{_cross_os}host-ctr
Conflicts: %{_cross_os}image-feature(no-host-containers)
%description -n %{_cross_os}bootstrap-containers
%{summary}.

Expand Down Expand Up @@ -515,7 +524,6 @@ install -p -m 0644 %{S:400} %{S:401} %{S:402} %{buildroot}%{_cross_licensedir}
%files -n %{_cross_os}apiserver
%{_cross_bindir}/apiserver
%{_cross_unitdir}/apiserver.service
%{_cross_unitdir}/migrator.service
%{_cross_sysusersdir}/api.conf

%files -n %{_cross_os}apiclient
Expand Down Expand Up @@ -560,6 +568,7 @@ install -p -m 0644 %{S:400} %{S:401} %{S:402} %{buildroot}%{_cross_licensedir}

%files -n %{_cross_os}migration
%{_cross_bindir}/migrator
%{_cross_unitdir}/migrator.service
%{_cross_tmpfilesdir}/migration.conf

%files -n %{_cross_os}settings-committer
Expand Down
2 changes: 0 additions & 2 deletions packages/os/storewolf.service
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
[Unit]
Description=Datastore creator
After=migrator.service
Requires=migrator.service
# Block manual interactions with this service, since it could leave the system in an
# unexpected state
RefuseManualStart=true
Expand Down
1 change: 0 additions & 1 deletion packages/release/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ findutils = { path = "../findutils" }
glibc = { path = "../glibc" }
grep = { path = "../grep" }
grub = { path = "../grub" }
host-ctr = { path = "../host-ctr" }
iproute = { path = "../iproute" }
iptables = { path = "../iptables" }
kexec-tools = { path = "../../packages/kexec-tools" }
Expand Down
1 change: 0 additions & 1 deletion packages/release/release.spec
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ Requires: %{_cross_os}findutils
Requires: %{_cross_os}glibc
Requires: %{_cross_os}grep
Requires: %{_cross_os}grub
Requires: %{_cross_os}host-ctr
Requires: %{_cross_os}iproute
Requires: %{_cross_os}iptables
Requires: %{_cross_os}kexec-tools
Expand Down
6 changes: 6 additions & 0 deletions sources/updater/signpost/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ pub enum Error {
source: block_party::Error,
},

#[snafu(display("Failed to convert vec to array"))]
ConvertVec {},

#[snafu(display("Failed to get disk from partition {}: {}", device.display(), source))]
DiskFromPartition {
device: PathBuf,
Expand All @@ -43,6 +46,9 @@ pub enum Error {
#[snafu(display("Inactive partition {} is already marked for upgrade", inactive.display()))]
InactiveAlreadyMarked { inactive: PathBuf },

#[snafu(display("Inactive partition {} is not available", inactive.display()))]
InactiveNotAvailable { inactive: PathBuf },

#[snafu(display("Inactive partition {} has not been marked valid for upgrade", inactive.display()))]
InactiveNotValid { inactive: PathBuf },

Expand Down
6 changes: 3 additions & 3 deletions sources/updater/signpost/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,23 @@ fn main() {
match command {
Command::Status => println!("{state}"),
Command::ClearInactive => {
state.clear_inactive();
state.clear_inactive()?;
state.write()?;
}
Command::MarkSuccessfulBoot => {
state.mark_successful_boot();
state.write()?;
}
Command::MarkInactiveValid => {
state.mark_inactive_valid();
state.mark_inactive_valid()?;
state.write()?;
}
Command::UpgradeToInactive => {
state.upgrade_to_inactive()?;
state.write()?;
}
Command::CancelUpgrade => {
state.cancel_upgrade();
state.cancel_upgrade()?;
state.write()?;
}
Command::RollbackToInactive => {
Expand Down
Loading

0 comments on commit a4226f4

Please sign in to comment.