Skip to content

Commit

Permalink
Merge pull request bottlerocket-os#4032 from bcressey/pluto-fixes
Browse files Browse the repository at this point in the history
fixes for pluto
  • Loading branch information
bcressey authored Jun 6, 2024
2 parents efbbe1a + 2ee4e0f commit 73fb2af
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
12 changes: 11 additions & 1 deletion packages/os/pluto.service
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
[Unit]
Description=Generate additional settings for Kubernetes
# Treat pluto as an honorary settings generator. It should run after sundog runs other
# settings generators, and before settings-applier commits all the settings, renders
# config files, and restarts services.
After=network-online.target apiserver.service sundog.service
Before=settings-applier.service
Requires=sundog.service
# We don't want to restart the unit if the network goes offline or apiserver restarts
Wants=network-online.target apiserver.service
Expand All @@ -11,10 +15,16 @@ RefuseManualStop=true

[Service]
Type=oneshot
# pluto needs access to any Kubernetes settings supplied through user-data, along with
# network-related settings such as proxy servers. Commit any settings that might have
# been generated during the sundog phase.
ExecStartPre=/usr/bin/settings-committer
ExecStart=/usr/bin/pluto
RemainAfterExit=true
StandardError=journal+console

[Install]
RequiredBy=preconfigured.target
# settings-applier requires sundog to succeed as a signal that all settings generators ran
# successfully. Since pluto is an honorary settings generator, settings-applier also needs
# it to succeed before it can start.
RequiredBy=settings-applier.service
1 change: 1 addition & 0 deletions sources/Cargo.lock

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

1 change: 1 addition & 0 deletions sources/api/pluto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ exclude = ["README.md"]

[dependencies]
bytes = "1"
constants = { path = "../../constants", version = "0.1" }
futures-util = { version = "0.3", default-features = false }
headers = "0.3"
http = "0.2"
Expand Down
7 changes: 6 additions & 1 deletion sources/api/pluto/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,12 @@ async fn run() -> Result<()> {
"kubernetes": settings
});
let json_str = generated_settings.to_string();
api::client_command(&["set", "-j", json_str.as_str()])
let uri = &format!(
"{}?tx={}",
constants::API_SETTINGS_URI,
constants::LAUNCH_TRANSACTION
);
api::client_command(&["raw", "-m", "PATCH", "-u", uri, "-d", json_str.as_str()])
.await
.context(error::SetFailureSnafu)?;

Expand Down

0 comments on commit 73fb2af

Please sign in to comment.