Skip to content
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

fixes for pluto #4032

Merged
merged 2 commits into from
Jun 6, 2024
Merged

fixes for pluto #4032

merged 2 commits into from
Jun 6, 2024

Conversation

bcressey
Copy link
Contributor

@bcressey bcressey commented Jun 4, 2024

Issue number:
Fixes #3828

Description of changes:
Conceptually, these changes make pluto act a bit more like a settings generator: it now runs in between sundog and thar-be-settings, and it lets thar-be-settings handle the actual commit.

Testing done:
Annotated output after these changes:

bash-5.1# journalctl -o short-monotonic -b |grep -A30 'Generate additional'
# pluto.service starts
[   12.504233] localhost systemd[1]: Starting Generate additional settings for Kubernetes...

# pluto needs settings to be committed so it can read them for its own use
[   12.505915] localhost settings-committer[1149]: 18:01:36 [INFO] Checking pending settings.
[   12.506639] localhost settings-committer[1149]: 18:01:36 [INFO] Committing settings.
[   12.506923] localhost apiserver[1063]: 18:01:36 [INFO] Committed data key settings.metrics.send-metrics
[   12.507106] localhost apiserver[1063]: 18:01:36 [INFO] Committed data key settings.network.hostname
[   12.507106] localhost apiserver[1063]: 18:01:36 [INFO] Committed data key settings.updates.seed
[   12.507106] localhost apiserver[1063]: 18:01:36 [INFO] Committed data key settings.updates.metadata-base-url
[   12.507106] localhost apiserver[1063]: 18:01:36 [INFO] Committed data key settings.host-containers.admin.source
[   12.507106] localhost apiserver[1063]: 18:01:36 [INFO] Committed data key settings.kubernetes.pod-infra-container-image
[   12.507106] localhost apiserver[1063]: 18:01:36 [INFO] Committed data key settings.host-containers.control.source
[   12.507215] localhost apiserver[1063]: 18:01:36 [INFO] Committed data key settings.updates.targets-base-url

# mysterious 3 second pause while pluto does stuff!
[   15.353395] localhost systemd[1]: Finished Generate additional settings for Kubernetes.

# settings-applier.service starts
[   15.355579] localhost systemd[1]: Starting Applies settings to create config files...

# settings-committer now commits the settings from pluto.
[   15.357889] localhost settings-committer[1170]: 18:01:39 [INFO] Checking pending settings.
[   15.358380] localhost settings-committer[1170]: 18:01:39 [INFO] Committing settings.
[   15.358659] localhost apiserver[1063]: 18:01:39 [INFO] Committed data key settings.kubernetes.node-ip
[   15.358877] localhost apiserver[1063]: 18:01:39 [INFO] Committed data key settings.kubernetes.hostname-override
[   15.358877] localhost apiserver[1063]: 18:01:39 [INFO] Committed data key settings.kubernetes.cluster-name
[   15.358877] localhost apiserver[1063]: 18:01:39 [INFO] Committed data key settings.kubernetes.cluster-dns-ip
[   15.358877] localhost apiserver[1063]: 18:01:39 [INFO] Committed data key settings.kubernetes.max-pods

# then thar-be-settings is kicked off - not sure about the 600 ms delay though ...
[   15.950790] localhost thar-be-settings[1175]: 18:01:40 [INFO] thar-be-settings started
[   15.950790] localhost thar-be-settings[1175]: 18:01:40 [INFO] Requesting configuration file data for affected services
[   16.053302] localhost thar-be-settings[1175]: 18:01:40 [INFO] Rendering config files...
[   16.088655] localhost thar-be-settings[1175]: 18:01:40 [INFO] Writing config files to disk...
[   16.089046] localhost thar-be-settings[1175]: 18:01:40 [INFO] Restarting all services...

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

@bcressey bcressey requested review from cbgbt and jmt-lab June 4, 2024 21:16
Comment on lines 20 to 30
[Install]
RequiredBy=preconfigured.target
RequiredBy=settings-applier.service
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to comment here that pluto requires the settings-applier service to commit its changes added to an open transaction.

This may be a clear responsibility implied by its position in the service tree that I've forgotten, though. If it's an obvious detail we can omit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to comment here that pluto requires the settings-applier service to commit its changes added to an open transaction.

Added some comments. Let me know if it's still not clear; this is an under-documented area of the system.

@@ -11,6 +11,7 @@ exclude = ["README.md"]

[dependencies]
bytes = "1"
constants = { path = "../../constants", version = "0.1" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is my dollar? 🤑

#2238 (comment)

settings-applier.service is expected to be the last unit in the chain
before initial system configuration is done. Ensure that pluto runs
and completes successfully before it starts.

Signed-off-by: Ben Cressey <bcressey@amazon.com>
When settings-applier.service starts, it runs settings-committer,
because it expects that sundog will have added generated settings to
the launch transaction, and then runs thar-be-settings to apply the
changes.

However, if pluto runs, it will have already committed any settings
from sundog, and then directly applied the settings via apiclient.
This introduces a different mode for system boot depending on whether
pluto is installed, and also worsens boot time as thar-be-settings is
relatively slow.

Fix this by having pluto add its own generated settings to the launch
transaction, so that settings-committer always has pending changes to
commit, and so that thar-be-settings only runs once.

Signed-off-by: Ben Cressey <bcressey@amazon.com>
@bcressey bcressey merged commit 73fb2af into bottlerocket-os:develop Jun 6, 2024
31 checks passed
@bcressey bcressey deleted the pluto-fixes branch June 6, 2024 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants