-
Notifications
You must be signed in to change notification settings - Fork 519
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
packages: change systemd boot sequence #1423
packages: change systemd boot sequence #1423
Conversation
Re: preconfigured section - One question is whether |
e4e4624
to
ed170a3
Compare
ed170a3
to
9e0ed5e
Compare
9e0ed5e
to
3ef4fa2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Just a handful of wording and consistency fixes.
3ef4fa2
to
1834d0e
Compare
In the last forced pushed I addressed the comments left by @bcressey:
|
1834d0e
to
104a38a
Compare
In the last forced pushed I addressed the comments left by @bcressey:
|
I'm happy with the code changes, but I'm planning to pull down the branch and try some contrived scenarios to see if the system behaves as expected. |
104a38a
to
fd4e0d6
Compare
|
fd4e0d6
to
95c752a
Compare
|
95c752a
to
cad9380
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/usr/bin/metricdog send-boot-success
will return zero even if the network is not ready. If that is the case then you would see an error in the journal. If it succeeds there would be no output in the journal unless you run it like this /usr/bin/metricdog --log-level debug send-boot-success
. Other than making sure send-boot-success works, looks good to me. Nice work!
cad9380
to
3874edb
Compare
|
The current systemd boot sequence is error prone on isolated scenarios like sending invalid configurations through user data. These scenarios could cause inconsistent states at the end of the boot process, which affect the mechanism to determine if a boot was successful after applying new configurations or updates. It is also difficult to implement features that require service initialization order. In order to fix the problems presented above, this commit defines a new boot sequence, with three main systemd targets: preconfigured, configured and multi-user. Preconfigured This target is used to start the boot process. Failures in any of the required service units will cause the target to fail, stopping the boot process. The boot is marked as successful during the execution of this target only if the migrator "oneshot" service exists successfully. Services initialized during this phase include: * migrator * mark-successful-boot * send-boot-success * storewolf * apiserver * early-boot-config * sundog * settings-applier Once the target is reached (completed), the "activate-configured.service" unit will set the configured target as the default target and start it. Configured This target should be used to setup additional configurations in the host before services like kubernetes/ecs start. Services initialized during this phase include: * chronyd * host-containerd Once the target is reached (completed) the "activate-multi-user.service" unit will set the multi-user target as the default target, and start it. Multi-user This is the final target enabled in the boot sequence. Services initialized during this phase include: * host-containers@* * docker * ecs * kubernetes
3874edb
to
0e74737
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm okay moving forward with this - though I'd like us to use another approach (if that's possible with what systemd provides) if we run into significant issues with systemctl isolate
down the road.
Issue number:
#1392
Description of changes:
The current systemd boot sequence is error prone on isolated scenarios like sending invalid configurations through user data. These scenarios could cause inconsistent states at the end of the boot process, which affect the mechanism to determine if a boot was successful after applying new configurations or updates.
With the current boot sequence, it is difficult to implement features that require a strict services' initialization order (a.k.a run levels).
In order to fix the problems presented above, this commit defines a new boot sequence, with three main systemd targets: preconfigured, configured and multi-user. The "host-containers" crate was modified to enable the host-container service units only when multi-user is the current default target.
The "mark-successful-boot" service unit was moved from the "multi-user" target to the "preconfigured" target, and it only depends on the "migrator" oneshot service unit since it is the only service required (for now) to determine if a boot was successful. The "mark-successful-boot" service unit used to send metrics after it was executed. However, doing so indirectly declared a strong dependency on "settings-applier" since the unit was setup to use the "proxy.env" file. The "metricdog-successful-boot" oneshot service unit was created to remove such dependency from "mark-successful-boot".
Preconfigured
This target is used to start the boot process (a.k.a default target), it is based on the "multi-user" target provided by systemd so that other basic systemd units are started during this stage. Failures in the required "oneshot" service units will cause the target to fail, stopping the boot process. The boot is marked as successful during the execution of this target, only if the migrator "oneshot" service exits successfully. Services initialized during this phase include:
Once the target is reached (completed), the "activate-configured.service" unit will set the configured target as the default target and start it.
Configured
This target should be used to setup additional configurations in the host before services like kubernetes/ecs start. Services initialized during this phase include:
Once the target is reached (completed) the "activate-multi-user.service" unit will set the multi-user target as the default target, and start it.
Multi-user
This is the final target enabled in the boot sequence. Services initialized during this phase include:
Testing done:
systemctl status
didn't show any failures on successful bootsmulti-user
target was reachedmulti-user
target was reachedps ax -o pid,args | grep host-ctr 479 /usr/bin/host-ctr run --container-id=admin --source=328549459982.dkr.ecr.us-west-2.amazonaws.com/bottlerocket-admin:v0.6.0 --superpowered=true 480 /usr/bin/host-ctr run --container-id=control --source=328549459982.dkr.ecr.us-west-2.amazonaws.com/bottlerocket-control:v0.4.2 --superpowered=false 481 /usr/bin/host-ctr run --container-id=custom-at-boot --source=docker.io/arnaldo2792/blocker:latest --superpowered=false 16546 /usr/bin/host-ctr run --container-id=test --source=docker.io/arnaldo2792/blocker:latest --superpowered=false
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.