-
Notifications
You must be signed in to change notification settings - Fork 302
Conversation
OMG |
Cool stuff!! |
This will definitely make things easier. 👍 |
What is the advantage of this over just submitting a foo@bar.service unit directly? |
@polvi I think you could ask the same question of systemd, ignoring the fact that fleet sits between you and systemd. |
The difference with systemd is that it does not actually make a differentiation. The symbolic link thing is just a convention. You are still actually starting that distinct unit (could be a link or a copy). I think to make this idiomatic systemd, you would just create the links locally then |
i.e. with systemd you do not need to load/submit your template before you can use it. You just interact with the units, which happen to be a copy. |
@polvi you do have to 'submit' your template in the sense that it needs to be in /etc/systemd/system (or /run/... or /usr/lib64/...). The submit step in fleetctl is the equivalent of you either calling |
nope. enable is used for telling systemd to load the unit at boot time, has nothing to do with templates. You do not need the template in the systemd search path to use it.
Systemd just reads the unit as is. It does not do any magic outside of parsing the data between '@' and '.service' and using it as a template var. |
@polvi In your example, you put (linked) test@.service in /etc/systemd/system, which is a systemd search path. Am I misunderstanding you when you say 'you do not need the template in the systemd search path to use it'? |
@bcwaldon it is in
|
@polvi but the fact that it is in /etc/systemd/system means etcd "knows" about it...right? You couldn't start test@foo.service if your cwd was /root and the /etc/systemd/system/test@.service symlink did not exist. |
Oh - misread how your symlink was setup. |
My point is that the template does nothing special with regards to the link. Here is another example. Note: systemd has no idea about the template unit now.
|
Just for clarity, foo is a symbolic link. bar is a copy of the file directly. Same result.
|
@polvi Here's the workflow I'm thinking of:
I put sleep@.service in the systemd search path, then I can start arbitrary instances of it. |
OK, I get it now. |
You guys are doing a lot of talking about stuff on a single machine. If your template contains What happens when you submit a modified template into fleet. Do all of the instances start referencing the new template? Or does fleet reject it like it does now when you attempt to start something with the same name? |
@robszumski The payload would have to exist on every machine that's running a dependent job. So yes, the template unit file would be copied everywhere its needed. Payloads will remain immutable, so you will still not be able to push an updated template. |
Closing so @unihorn can tackle this. |
@bcwaldon is there a new PR up yet? I was just about to post with a test result.
The service never started. |
OK, np. @unihorn would you mind pinging this PR when yours goes up? Also let me know if you need something tested. |
This will allow you to submit a unit like foo@.service, then start a job like foo@42.service.