Repository navigation
core: Also refresh confext extensions when reloading notify-reload service - #33995
Conversation
|
This is a compat break. Some services might not be able to cope with the sudden change of confexts, or simply don't want these to change. Please guard this behind a |
I'm not sure it's necessary - confext are an extremely new thing, so if it's configured to use one, and it's configured to also do Reload=notify-reload, the chance of something using both and not wanting this seem extremely slim to me. In fact, with the read-only /etc/, it would be very strange if someone didn't want this. It doesn't happen automatically, you have to manually hit the reload button anyway |
There will be some button somewhere in git (or github?) to configure it to avoid pushing merge commits for your local client you'll want |
I still prefer to make this opt-in. As mentioned, we'd introduce a knob for other resources anyway. And it would be inconsistent/annoying that some resources are implicitly reloaded, while others aren't |
Thanks! Got rid of the merge commit (that was from using GitHub's built-in "sync with upstream" button). (@YHNdnzj you may want to slap the |
|
Even for credentials, we should just reload them - it's the right thing to do. Having such granular and complex options is just confusing. People can opt out of the automated reloads entirely by avoiding the notify-reload type, and then nothing happens, and they can have their own reload methods via ExecReload that are entirely custom and we don't do anything magic. But if the fully automated, all-bells-and-whistles thing is enabled, then we should just do the right thing, without making people go spelunking through thousands of lines of manpages, and that includes adding new stuff from time to time where it makes sense, documenting it clearly |
Why should this be tied to notify-reload? I'm really not convinced. If I use cred to pass config to a program that's completely unaware of systemd and its protocols, I should still be able to reload creds. The process would read the new config - in this case creds as manually passed through |
|
OTOH, even if a program natively supports creds + notify protocol, based on our previous promises it could assume creds are immutable and re-reading is not done on reload. It would be very confusing to users. Note that we currently state that creds are immutable during the whole lifetime of service. Now it isn't considered a compat break anymore? |
|
With how it's written right now, it does reload the confext when a |
Because that's the config knob that says "I am fully opted in to all the magic, please do stuff for me", and, if documented, that's a good enough sign that stuff should happen. If you want to also make reloading creds tied to something else additionally that's fine. And if you don't want to automatically reload creds in this case, that can be discussed separately. But for this, I definitely do not want a different option, because it's just the only sensible option: with a read-only /etc/, which is what you get if you use any confext, it doesn't make sense to reload, as you cannot get any config changes, because it's read-only. So making the confext reload work automatically is the logical and expected thing. |
I can probably accept that RefreshOnReload= defaults to extension if notify-reload. But come on, some legacy systemd-unaware programs can still benefit from this. Let's not deliberately alienate those, but provide a way to enable this logic for them. |
These extensions are a systemd-specific thing, you can't really have a systemd-unaware setup and run it with extensions. Again, it does not make sense to do anything else - reloading is explicitly to notify that configuration in /etc has changed, and if your /etc is read-only, it's just meaningless to reload, as it cannot changed by definition |
I don't grok this. The hierarchy is set up by the service manager, and the processes running inside the namespace don't really need to know what's going on? And again, let's not force |
|
You have to opt in, not only to confext via ExtensionImages, but also to the vpick logic, otherwise it's a no-op, so you cannot use this unless you have explicitly configured it to do so, so there's no way this happens in a systemd-unaware system. And once again, it makes absolutely zero sense to not refresh these, as a reload is pointless without it, the configuration dirs are read-only, so I am not sure what one would even be reloading - nothing can change. There is no way anybody is opting in to confext PLUS opting in to vpick PLUS opting in to notify-reload PLUS calling a reload, and also wants to have yet another opt in on top of that, and would be surprised if it happens. We already have seventeen million options, at some point for some things we just need to do the right thing out of the box, and this is one of them. |
I have never questioned about this part - but please focus on the actual payload/process/program. Then would run in a FHS environment with all overlays/... set up by service manager. They do not need to know what's exactly going on under the hood.
Again, that's only one part of the story, which I agree to enable as default. However, payloads that has no understanding of systemd CAN still use this feature. And this impl is not restrained to |
Why would they need to?
No, they cannot, as sd-notify needs to be used
Yes, that's something to fix, I'll submit a full review later today |
This comment was marked as resolved.
This comment was marked as resolved.
Include 'socat' as part of the tools built with minimal-0/minimal-1 images used for integration testing. This would allow notify-reload services to signal reloading without using the systemd-notify tool and other socket communication test cases. Note that 'ncat', although included in the minimal image, cannot be used because it dies before systemd can figure out the unit it's from. See 67e5622.
Add a path_uses_vpick helper method to determine if a path matches
the vpick format ('PATH/NAME.SUFFIX.v' or 'PATH.v/NAME___.SUFFIX'):
/* good: returns 1 */
path_uses_vpick("/var/lib/machines/mymachine.raw.v/")
path_uses_vpick("to.v/foo___.raw
/* bad: returns <= 0 */
path_uses_vpick("/")
path_uses_vpick("path/to/foo.mp4.vtt
Added, seems to work fine |
|
First push was just a rebase, second one has the requested changes, so that diff-of-diff is readable: https://github.com/systemd/systemd/compare/2a69cfb08d569623babc93c37787a2d8dc906f5c..a524e1c20b7d8631097150277bea9e3664628151 |
`ExtensionImages=` and `ExtensionDirectories=` now let you specify
vpick-named extensions; however, since they just get set up once when
the service is started, you can't see newer versions without restarting
the service entirely. Here, also reload confext extensions when you
reload a service. This allows you to deploy a new version of some
configuration and have it picked up at reload time without interruption
to your workload.
Right now, we would only reload confext extensions and leave the sysext
ones behind, since it didn't seem prudent to swap out what is likely
program code at reload. This is made possible by only going for the
`SYSTEMD_CONFEXT_HIERARCHIES` overlays (which only contains `/etc`).
Implementation wise, this uses the new kernel API and two collaborating
child processes under the host & child namespaces in order to gather the
right FDs needed:
- (1) In child, set up the extension images and directories in a slave
mountns, and obtain their FDs.
- (2) Fork into a grandchild under target process namespace, and do a
"fake" unmount to obtain the FD of the underlying target folder
say /etc).
- (3) In the child again, set up new overlay under host NS rights.
We do not want to do I/O heavy jobs inline in PID1 blocking the state
machine, so add separate async states to handle this case.
Co-authored-by: Luca Boccassi <[email protected]>
In TEST-50-DISSECT.dissect, this adds the following cases: - testservice-50g: vpick extension in ExtensionDirectories - testservice-50h: vpick extension in ExtensionImages - testservice-50i: ExtensionDirectories + RootImage - testservice-50j: ExtensionDirectories + RootDirectory
Any chance you could push that? It would be really great to be able to rotate secrets that way |
ExtensionImages=andExtensionDirectories=now let you specify vpick-named extensions; however, since they just get set up once when the service is started, you can't see newer versions without restarting the service entirely. Here, also reload confext extensions when you reload a service. This allows you to deploy a new version of some configuration and have it picked up at reload time without interruption to your workload.Right now, we would only reload confext extensions and leave the sysext ones behind, since it didn't seem prudent to swap out what is likely program code at reload. This is made possible by only going for the
SYSTEMD_CONFEXT_HIERARCHIESoverlays (which only contains/etc).This PR:
service.cto also refresh extensions when needed.systemd.execman pages to document this behavior.This is a follow up to #24864 and #31364. Thank you to @bluca and @goenkam for help in getting this up.