<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body><div>On Wed, Jun 29, 2016, at 10:26 AM, Nir Magnezi wrote:<br></div>
<blockquote type="cite"><div dir="ltr"><div>Hello,<br></div>
<div> </div>
<div>Lately, I've been working on a fix[1] for the amhpora-agent, which currently only support Debian based flavors such as Ubuntu.<br></div>
<div> </div>
<div>The main Issues here:<br></div>
<div>1. NIC hot plugs: Ubuntu's ethX.cfg files looks different from ifcfg-ethX files which are accepted in Linux flavors such a RHEL, CentOS and Fedora, read more in the fix commit msg.<br></div>
<div>2. The usage of Flavor specific features such as 'upstart'.<br></div>
<div> </div>
<div>I would like to have a discussion about the second bullet mentioned above.<br></div>
<div>Due to the fact that in Octavia the loadbalancer runs inside of an instance (Amphora), There are few actions that need to take place in the Amphora instance boot process:<br></div>
<div>a. namespace and NIC created.<br></div>
<div>b. amphora agent starts<br></div>
<div>c. haproxy (and possibly keepalived) start<br></div>
<div> </div>
<div><div>The Amphora-agent leverages[2] the capabilities of 'upstart' to make that happen, which is a bit problematic if we wish it to work on other flavors.<br></div>
</div>
<div>The default cloud image for Amphora today is Ubuntu, yet there are few more options[3] such as CentOS and Fedora.<br></div>
<div>Unlike the Ubuntu base image, which uses 'sysvinit', The latter two flavors use 'systemd'.<br></div>
<div>This creates incompatibility with the jinja2[4][5] templates used by the agent.<br></div>
<div> </div>
<div>The way I see it there are two possible solutions for this:<br></div>
<div>1. Include a systemd equivalent in the fix[1] that will essentially duplicate the functionality mentioned above and work in the other flavors.<br></div>
<div>2. Have a the amphora agent be the only binary that needs to be configured to start upon boot, and that agent will take care of plugging namespaces and NICs and also spawning needs processes. This is how it is done in lbaas and l3 agents.<br></div>
<div> </div>
<div>While the latter solution looks like a more "clean" design, the trade-off here is a bigger change to the amphora agent. <br></div>
<div> </div>
<div>[1] <a href="https://review.openstack.org/#/c/331841/">https://review.openstack.org/#/c/331841/</a><br></div>
<div><div>[2] <a href="https://github.com/openstack/octavia/blob/master/octavia/amphorae/backends/agent/api_server/listener.py#L128">https://github.com/openstack/octavia/blob/master/octavia/amphorae/backends/agent/api_server/listener.py#L128</a><br></div>
</div>
<div>[3] <a href="https://github.com/openstack/octavia/blob/master/diskimage-create/diskimage-create.sh#L27">https://github.com/openstack/octavia/blob/master/diskimage-create/diskimage-create.sh#L27</a><br></div>
<div>[4] <a href="https://github.com/openstack/octavia/blob/master/octavia/amphorae/backends/agent/api_server/templates/upstart.conf.j2">https://github.com/openstack/octavia/blob/master/octavia/amphorae/backends/agent/api_server/templates/upstart.conf.j2</a><br></div>
<div>[5] <a href="https://github.com/openstack/octavia/blob/master/octavia/amphorae/backends/agent/api_server/templates/sysvinit.conf.j2">https://github.com/openstack/octavia/blob/master/octavia/amphorae/backends/agent/api_server/templates/sysvinit.conf.j2</a><br></div>
<div> </div>
<div> </div>
<div>Thanks,<br></div>
<div>Nir<br></div>
</div>
</blockquote><div> </div>
<div>I have an alternative suggestion - Maybe we shouldn't be templating out the init scripts? What we are effectively doing here is code-gen which leads to problems exactly like this, and fixing it with more code gen actually makes the problem more difficult.<br></div>
<div> </div>
<div>I see two fairly straightforward ways to not require this templating:<br></div>
<div> </div>
<div>1) Use the agent to write out config for the init scripts in to /etc/defaults/amphora and have the init scripts consume that file (source variables in that file). The init script can then simply be a static file which we can even bake in to the image directly.<br></div>
<div> </div>
<div>2) Move the code which requires the templating in to another executable which the init scripts call out to. e.g. create a amphora-net-init executable that runs the same code as in the pre-up section of the upstart script. Then there is no need for templating in the init scripts themselves (they will all simply call the same executable) and we can also do something like bake init scripts directly in to the image.<br></div>
<div> </div>
<div> </div>
<div>My thinking is that this is only going to get more complex - what are we going to do to support the new ubuntu LTS which is systemd based? Or if folk show up with other distros that match neither? Its a lot easier to decouple the init scripts, which are target specific, from configuration specific components and avoid this issues all together.<br></div>
<div> </div>
<div>HTH,<br></div>
<div>Greg</div>
</body>
</html>