Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

improve template handling #1508

Open
kayrus opened this issue Mar 16, 2016 · 4 comments
Open

improve template handling #1508

kayrus opened this issue Mar 16, 2016 · 4 comments

Comments

@kayrus
Copy link
Contributor

kayrus commented Mar 16, 2016

When you submit [email protected] and start template@{1..10}.service fleet writes these unit files into the file system:

ls -la /run/fleet/units/ 
total 40
drwxr-xr-x 2 root root 240 Mar 16 16:51 .
drwxr-xr-x 3 root root  60 Mar 16 11:47 ..
-rw-r--r-- 1 root root  97 Mar 16 16:51 [email protected]
-rw-r--r-- 1 root root  97 Mar 16 16:51 [email protected]
-rw-r--r-- 1 root root  97 Mar 16 16:51 [email protected]
-rw-r--r-- 1 root root  97 Mar 16 16:51 [email protected]
-rw-r--r-- 1 root root  97 Mar 16 16:51 [email protected]
-rw-r--r-- 1 root root  97 Mar 16 16:51 [email protected]
-rw-r--r-- 1 root root  97 Mar 16 16:51 [email protected]
-rw-r--r-- 1 root root  97 Mar 16 16:51 [email protected]
-rw-r--r-- 1 root root  97 Mar 16 16:51 [email protected]
-rw-r--r-- 1 root root  97 Mar 16 16:51 [email protected]

Also it writes down unnecessary duplicated data inside the etcd registry.

With the new --replace feature you have to update each "templated" unit file instead of only one template.

Also when you start units using local template, which is not stored into the registry (i.e. fleetctl start template@{1..10}.service), fleet just creates copies of this template. But for some reason doesn't store the origin template into the registry. I suppose it should.

So the idea is to create a reference to the origin template inside the registry instead of copying template's data. This will allow you to update only one template using the --replace feature.

@antrik
Copy link
Contributor

antrik commented Mar 16, 2016

@kayrus how would you replace a template? AIUI, fleet commands always work on actual instances. If you do, say fleetctl start --replace [email protected] [email protected], it should replace these two instances with ones created from the current (possible changed) template; but not the others. I don't see how you would express "update all instances of this template"...

@kayrus
Copy link
Contributor Author

kayrus commented Mar 16, 2016

@antrik it shouldn't allow to replace template's reference. like it is not possible to start template itself.

@tixxdz
Copy link
Contributor

tixxdz commented Mar 17, 2016

@kayrus on your argument "With the new --replace feature you have to update each "templated" unit file instead of only one template."
I don't see any problem on this ? if you update a template then "submit --replace" to updated into the registry, that's it. We don't start units from a template on behalf of the user as I guess we don't want to automatically replace instantiated units on behalf of the user, and it's pretty easy just after submit --replace, do start --replace template@{1..100}

@kayrus
Copy link
Contributor Author

kayrus commented Mar 17, 2016

@tixxdz start --replace template@{1..100} will create at least 100 write events into etcd. if you rewrite only one template it will create only N etcd read events, where N is amount of machines in cluster.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants