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

Jmt/ootb/pluto #3828

Merged
merged 3 commits into from
May 23, 2024
Merged

Jmt/ootb/pluto #3828

merged 3 commits into from
May 23, 2024

Conversation

jmt-lab
Copy link
Contributor

@jmt-lab jmt-lab commented Mar 18, 2024

Issue number: #3620

Closes #3620

Description of changes:

Removes conditional compilation from pluto.

  • Changes pluto to fetch the necessary settings it needs via apiclient get cli
  • Removes pluto from use as setting-generator calls
  • Introduces pluto systemd unit to run to generate its settings after sundog and before settings-applier
  • Uses apiclient set to set its generated settings
  • New migration helper RemoveMetadata introduced along with unittests

Testing done:

  • Ran cargo +nightly udeps to ensure all unused dependencies have been removed
  • Pass the settings on first boot via userdata. Verify config.
  • cat /etc/os-release record your build ID include commit sha, record this
  • Downgrade to older version.
    • verify connectivity
    • cat /etc/os-release to verify lower version
    • verify that migrations have changed the metadata/settings as expected (i.e. they are gone from the datastore, or lists have been changed back)
  • Upgrade to newer version.
    • verify connectivity
    • cat /etc/os-release to verify version

Tested with downgrade -> upgrade

Initial Build ID 1.20.0 0bb2977
Downgrade Build ID 1.19.5 64049ba
Upgrade Build ID 1.20.0 0bb2977

Verified that pluto in both situations generated correct settings
Verified that the new remove metadata does a noop on downgrade and setting-generators return
Verified that the new remove metadata removes setting-generator settings on upgrade

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.

@jmt-lab jmt-lab requested review from bcressey and webern March 18, 2024 17:32
@jmt-lab jmt-lab self-assigned this Mar 18, 2024
sources/api/pluto/src/api.rs Outdated Show resolved Hide resolved
@jmt-lab
Copy link
Contributor Author

jmt-lab commented Mar 18, 2024

Fix formatting

@jmt-lab jmt-lab marked this pull request as draft March 18, 2024 23:08
@jmt-lab
Copy link
Contributor Author

jmt-lab commented Apr 1, 2024

Rebased, build fixes, tests ran

webern
webern previously requested changes Apr 2, 2024
Copy link
Member

@webern webern left a comment

Choose a reason for hiding this comment

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

You need a clippy fix

packages/pluto/build.rs Outdated Show resolved Hide resolved
sources/api/pluto/src/api.rs Outdated Show resolved Hide resolved
sources/api/settings-committer/src/main.rs Outdated Show resolved Hide resolved
@jmt-lab
Copy link
Contributor Author

jmt-lab commented Apr 3, 2024

  • Rebased on latest
  • Removed redundant build.rs
  • Undid debug change
  • Removed unnecessary variable

@jmt-lab jmt-lab force-pushed the jmt/ootb/pluto branch 3 times, most recently from 7c37bba to 28e0a72 Compare April 3, 2024 22:51
@bcressey
Copy link
Contributor

bcressey commented Apr 4, 2024

Migrates pluto out of os package to its own package

Why? Generally speaking the whimsical names shouldn't intrude into the visible surface area of the distro. For OOTBs that will also include package names.

Historical aside: pluto is so-named because it's a settings generator, and the program that invokes settings generators is called sundog, because it's the counterpart to early-boot-config, which used to be called moondog, which is the source of non-generated settings. moondog was one of the earliest names, back when the desert code name was "Atacama" instead of "Thar"; the Atacama Desert has the Very Large Telescope and hence there was an astronomical theme early on, before Thar let us unlock the pirate pun naming achievement. Bottlerocket was started in part by Amazon Linux veterans and observed the Amazon Linux tradition of using deserts as code names for major releases.

Back on topic: I am more OK with the generic ones like updog (for updates) and netdog (for networks) but would still prefer that they stay in the os aggregate package or else move to the appropriate settings-* package once those get rolling. For netdog in particular, splitting it out makes sense because there's a lot going on there and a separation of concerns is useful.

Aside from not wanting to export whimsy or to explain pluto ever again, I'm concerned about compile times exploding if we start compiling serde a hundred times in parallel.

packages/pluto/pluto-toml Outdated Show resolved Hide resolved
variants/aws-k8s-1.23-nvidia/Cargo.toml Outdated Show resolved Hide resolved
packages/pluto/pluto-toml Outdated Show resolved Hide resolved
sources/models/shared-defaults/kubernetes-aws.toml Outdated Show resolved Hide resolved
sources/api/pluto/src/api.rs Outdated Show resolved Hide resolved
@jmt-lab
Copy link
Contributor Author

jmt-lab commented Apr 4, 2024

Migrates pluto out of os package to its own package

Why? Generally speaking the whimsical names shouldn't intrude into the visible surface area of the distro. For OOTBs that will also include package names.

Historical aside: pluto is so-named because it's a settings generator, and the program that invokes settings generators is called sundog, because it's the counterpart to early-boot-config, which used to be called moondog, which is the source of non-generated settings. moondog was one of the earliest names, back when the desert code name was "Atacama" instead of "Thar"; the Atacama Desert has the Very Large Telescope and hence there was an astronomical theme early on, before Thar let us unlock the pirate pun naming achievement. Bottlerocket was started in part by Amazon Linux veterans and observed the Amazon Linux tradition of using deserts as code names for major releases.

Back on topic: I am more OK with the generic ones like updog (for updates) and netdog (for networks) but would still prefer that they stay in the os aggregate package or else move to the appropriate settings-* package once those get rolling. For netdog in particular, splitting it out makes sense because there's a lot going on there and a separation of concerns is useful.

Aside from not wanting to export whimsy or to explain pluto ever again, I'm concerned about compile times exploding if we start compiling serde a hundred times in parallel.

I was just following netdog since we pulled it out when doing a similar conditional removement, I'm okay sliding this back into os.spec if that is preferred

@jmt-lab jmt-lab force-pushed the jmt/ootb/pluto branch 2 times, most recently from 53f936c to 0bb2977 Compare May 2, 2024 23:04
@jmt-lab jmt-lab dismissed webern’s stale review May 2, 2024 23:04

Review was on old approach

@jmt-lab
Copy link
Contributor Author

jmt-lab commented May 2, 2024

Updated to ensure the compilation changes with pluto & cfsignal work well. Note I will be addressing shibaken and other remaining if blocks in another PR

@jmt-lab jmt-lab requested review from bcressey and webern May 2, 2024 23:05
@jmt-lab jmt-lab marked this pull request as ready for review May 2, 2024 23:46
packages/os/os.spec Outdated Show resolved Hide resolved
packages/os/os.spec Outdated Show resolved Hide resolved
packages/os/pluto.service Outdated Show resolved Hide resolved
packages/os/pluto.service Show resolved Hide resolved
packages/os/pluto.service Outdated Show resolved Hide resolved
packages/os/pluto-toml Outdated Show resolved Hide resolved
sources/api/pluto/src/api.rs Outdated Show resolved Hide resolved
sources/api/pluto/src/api.rs Outdated Show resolved Hide resolved
sources/api/pluto/src/main.rs Outdated Show resolved Hide resolved
@jmt-lab jmt-lab force-pushed the jmt/ootb/pluto branch 2 times, most recently from 6a5fe0e to 3f3f9cf Compare May 4, 2024 00:07
@jmt-lab
Copy link
Contributor Author

jmt-lab commented May 4, 2024

  • Fixed unwrap in get_max_pods
  • Remove build_variant

Copy link
Member

@webern webern left a comment

Choose a reason for hiding this comment

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

Is the empty file packages/os/pluto-toml intentional? If so can you explain why you need an empty file?

packages/os/os.spec Show resolved Hide resolved
sources/api/pluto/src/api.rs Show resolved Hide resolved
sources/api/pluto/src/api.rs Show resolved Hide resolved
@jmt-lab
Copy link
Contributor Author

jmt-lab commented May 6, 2024

Removed unnecessary test

@jmt-lab
Copy link
Contributor Author

jmt-lab commented May 6, 2024

Interactive rebase done to better arrange changes

@jmt-lab jmt-lab force-pushed the jmt/ootb/pluto branch 2 times, most recently from f929d97 to 2ffebfc Compare May 6, 2024 23:42
@jmt-lab
Copy link
Contributor Author

jmt-lab commented May 6, 2024

Rebased to squash commits and separate migration
Rebased off latest develop

sources/api/pluto/src/main.rs Outdated Show resolved Hide resolved
sources/api/pluto/src/api.rs Outdated Show resolved Hide resolved
Copy link
Member

@webern webern left a comment

Choose a reason for hiding this comment

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

  • The Pluto code looks correct to me, to the best of my ability with the caveat that I can't quite tell if there could be a subtle behavior change based on the fact that Pluto used to be called at different times for these things and may have had different settings available when that occurred.
  • The migration seems probably correct, though I have a question about "nothing to do on downgrade".
  • I mostly deferring to Ben on packaging concerns.


fn backward(&mut self, input: MigrationData) -> Result<MigrationData> {
println!(
"RemoveMetadataMigration({:?}) has no work to do on downgrade.",
Copy link
Member

Choose a reason for hiding this comment

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

Double-checking this is right, @bcressey. We don't need to do anything on downgrade because the defaults will cause the metadata to be put back into place on downgrade, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Double-checking this is right, @bcressey. We don't need to do anything on downgrade because the defaults will cause the metadata to be put back into place on downgrade, right?

Yes. migrator.service runs before storewolf.service and (simplifying) is responsible for fixing things up so the datastore that storewolf deserializes matches what the model expects.

storewolf will add any new defaults to an existing data store (since 036be78) but does not touch existing data.

One conclusion I've drawn from this - frankly downright weird! - migration is that there's probably something much smarter we could do for the datastore files that cannot be set via the API, such as "remove all existing metadata so that storewolf puts it back".

But that would fall outside the scope of what we can cover in any one set of up/down migrations; we'd need the OS itself to be smart enough to do that, which means doing the repo pivot trick to move to the new world where we can treat it as a given.

If we did that, we could expand the scope to include configuration-files and services too. Might as well throw in unrecognized prefixes and individual files while we're at it, and the ability to set a field to {{ default }} to force it to be re-evaluated to its current default value. Potentially we could eliminate almost all of what we use migrations for even in the current settings system.

sources/api/pluto/src/main.rs Outdated Show resolved Hide resolved
sources/api/pluto/src/main.rs Outdated Show resolved Hide resolved
sources/api/pluto/src/main.rs Outdated Show resolved Hide resolved
sources/api/pluto/src/main.rs Outdated Show resolved Hide resolved
@jmt-lab
Copy link
Contributor Author

jmt-lab commented May 17, 2024

  • Rebased on latest
  • Refactored to use generate methods that pass aws_k8s_info
  • Triggered node_ip off cluster_dns
  • Retested everything functioned as expected

@jmt-lab jmt-lab requested a review from bcressey May 17, 2024 23:51
sources/api/pluto/src/main.rs Outdated Show resolved Hide resolved
sources/api/pluto/src/main.rs Outdated Show resolved Hide resolved
sources/api/pluto/src/main.rs Show resolved Hide resolved
sources/api/pluto/src/main.rs Show resolved Hide resolved
sources/api/pluto/src/main.rs Show resolved Hide resolved
sources/api/pluto/src/api.rs Outdated Show resolved Hide resolved
Migrates pluto to fetch a view of required settings
from the api using apiclient to generated needed settings
for k*s on aws
Copy link
Contributor

@bcressey bcressey left a comment

Choose a reason for hiding this comment

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

🪐

@jmt-lab jmt-lab merged commit 3cddd68 into bottlerocket-os:develop May 23, 2024
33 checks passed
@jmt-lab jmt-lab deleted the jmt/ootb/pluto branch May 23, 2024 21:39
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.

OOTB: Remove conditional compilation and model dependency from pluto
3 participants