<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:"\@SimSun";
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:#1F497D;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">I’m in broad agreement with Hongbin. Having tried a patch to use jinja2 in the templates, it certainly adds complexity. I am in favor of using conditionals and
consuming the latest version of heat. If we intend to support older versions of OpenStack this should be a clearly defined goal and needs to be tested. An aspiration to work with older versions isn’t a good policy.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">I would like to understand a bit better the “chaos” option 3 would cause.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Tom<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Hongbin Lu [mailto:hongbin.lu@huawei.com]
<br>
<b>Sent:</b> 12 May 2016 16:35<br>
<b>To:</b> OpenStack Development Mailing List (not for usage questions)<br>
<b>Subject:</b> Re: [openstack-dev] [magnum] Jinja2 for Heat template<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-CA" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">We discussed the management of Heat templates several times. It seems the consensus is to leverage the *conditionals*feature from Heat (option #1).
From the past discussion, it sounds like option #2 or #3 will significantly complicate our Heat templates, thus incurring burden on maintenance.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">However, I agree with Yuanying that option #1 will make Newton (or newer) version of Magnum incompatible with Mitaka (or older) version of OpenStack.
A solution I can think of is to have a Jinja2 version of Heat template in the contrib folder, so that operators can swap the Heat templates if they want to run newer version of Magnum with older version of OpenStack. Thoughts.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Best regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Hongbin<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif"> Yuanying OTSUKA [<a href="mailto:yuanying@oeilvert.org">mailto:yuanying@oeilvert.org</a>]
<br>
<b>Sent:</b> May-12-16 6:02 AM<br>
<b>To:</b> OpenStack Development Mailing List (not for usage questions)<br>
<b>Subject:</b> Re: [openstack-dev] [magnum] Jinja2 for Heat template<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-CA">Hi, <o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-CA">Thanks for your helpful comment.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-CA">I didn’t know about the pattern you suggested.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-CA">We often want to “if” or “for” etc…<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-CA">For example,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-CA">* if private network is supplied as parameter, disable creating network resource.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-CA">* if https parameter is enable, tcp 6443 port should be opened instead of 8080 at“OS::Neutron::SecurityGroup".<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-CA">* if https parameter is enable, loadbalancing protocol should be TCP instead of HTTP<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-CA">and so on.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-CA">So, I want to Jinja2 template to manage it.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-CA">I’ll try to use the composition model above,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-CA">and also test the limited use of jinja2 templating.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-CA">Thanks<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-CA">- OTSUKA, Yuanying<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<div>
<div>
<p class="MsoNormal"><span lang="EN-CA">2016</span><span lang="ZH-CN" style="font-family:SimSun;mso-fareast-language:ZH-CN">年</span><span lang="EN-CA">5</span><span lang="ZH-CN" style="font-family:SimSun;mso-fareast-language:ZH-CN">月</span><span lang="EN-CA">12</span><span lang="ZH-CN" style="font-family:SimSun;mso-fareast-language:ZH-CN">日</span><span lang="EN-CA">(</span><span lang="ZH-CN" style="font-family:SimSun;mso-fareast-language:ZH-CN">木</span><span lang="EN-CA">)
17:46 Steven Hardy <<a href="mailto:shardy@redhat.com">shardy@redhat.com</a>>:<o:p></o:p></span></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt">
<p class="MsoNormal"><span lang="EN-CA">On Thu, May 12, 2016 at 11:08:02AM +0300, Pavlo Shchelokovskyy wrote:<br>
> Hi,<br>
><br>
> not sure why 3 will bring chaos when implemented properly.<br>
<br>
I agree - heat is designed with composition in mind, and e.g in TripleO<br>
we're making heavy use of it for optional configurations and it works<br>
pretty well:<br>
<br>
<a href="http://docs.openstack.org/developer/heat/template_guide/composition.html" target="_blank">http://docs.openstack.org/developer/heat/template_guide/composition.html</a><br>
<br>
<a href="https://www.youtube.com/watch?v=fw0JhywwA1E" target="_blank">https://www.youtube.com/watch?v=fw0JhywwA1E</a><br>
<br>
<a href="http://hardysteven.blogspot.co.uk/2015/05/tripleo-heat-templates-part-1-roles-and.html" target="_blank">http://hardysteven.blogspot.co.uk/2015/05/tripleo-heat-templates-part-1-roles-and.html</a><br>
<br>
<a href="https://github.com/openstack/tripleo-heat-templates/tree/master/environments" target="_blank">https://github.com/openstack/tripleo-heat-templates/tree/master/environments</a><br>
<br>
> Can you abstract the "thing" (sorry, not quite familiar with Magnum) that<br>
> needs FP + FP itself into a custom resource/nested stack? Then you could<br>
> use single master template plus two environments (one with FP, one<br>
> without), and choose which one to use right where you have this logic<br>
> split in your code.<br>
<br>
Yes, this is exactly the model we make heavy use of in TripleO, it works<br>
pretty well.<br>
<br>
Note there's now an OS::Heat::None resource in heat, which makes it easy to<br>
conditionally disable things (without the need for a noop.yaml template<br>
that contains matching parameters):<br>
<br>
<a href="http://docs.openstack.org/developer/heat/template_guide/openstack.html#OS::Heat::None" target="_blank">http://docs.openstack.org/developer/heat/template_guide/openstack.html#OS::Heat::None</a><br>
<br>
So you'd have two environment files like:<br>
<br>
cat enable_floating.yaml:<br>
resource_registry:<br>
OS::Magnum::FloatingIP: templates/the_floating_config.yaml<br>
<br>
cat disable_floating.yaml:<br>
resource_registry:<br>
OS::Magnum::FloatingIP: OS::Heat::None<br>
<br>
Again, this pattern is well proven and works pretty well.<br>
<br>
Conditionals may provide an alternative way to do this, but at the expense<br>
of some additional complexity inside the templates.<br>
<br>
> Option 2 is not so bad either IMO (AFAIK Trove was doing that at sometime,<br>
> not sure of current status), but the above would be nicer.<br>
<br>
Yes, in the past[1] I've commented that the composition model above may be<br>
preferable to jinja templating, but recently I've realized there are pros<br>
and cons to each approach.<br>
<br>
The heat composition model works pretty well when you want to combine<br>
multiple pieces (nested stacks) which contain some mixture of different<br>
resources, but it doesn't work so well when you want to iterate over a<br>
common pattern and build a template (e.g based on a loop).<br>
<br>
You can use ResourceGroups in some cases, but that adds to the stack depth<br>
(number of nested stacks), and may not be workable for upgrades, so TripleO<br>
is now looking at some limited use of jinja2 templating also, I agree it's<br>
not so bad provided the interfaces presented to the user are carefully<br>
constrained.<br>
<br>
Steve<br>
<br>
[1] <a href="https://review.openstack.org/#/c/211771/" target="_blank">https://review.openstack.org/#/c/211771/</a><br>
<br>
__________________________________________________________________________<br>
OpenStack Development Mailing List (not for usage questions)<br>
Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" target="_blank">
OpenStack-dev-request@lists.openstack.org?subject:unsubscribe</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><o:p></o:p></span></p>
</blockquote>
</div>
</div>
</div>
</body>
</html>