<div dir="ltr">Thank you sean,<div><br></div><div>I did following an it works hope this is correct way to customize </div><div><br></div><div>{% extends parent_template %}<br><br># Horizon<br>{% block horizon_ubuntu_source_setup %}<br>RUN apt update -y<br>RUN apt install -y net-tools vim<br>RUN touch /root/foo<br>{% endblock %}<br></div><div><br></div><div><br></div><div>$ kolla-build --registry docker-reg:4000 -b ubuntu -t source --tag zed-v2 --template-override template-overrides.j2 --debug horizon</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Mar 31, 2023 at 1:31 PM Sean Mooney <<a href="mailto:smooney@redhat.com">smooney@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Fri, 2023-03-31 at 10:25 -0400, Satish Patel wrote:<br>
> Thank you Sean,<br>
> <br>
> What a wonderful explanation of the process. Yes I can download images from<br>
> the public domain and push them to a local repository but in some cases I<br>
> would like to add my own tools like monitoring agents, utilities etc<br>
> for debugging so i decided to build my own images.<br>
> <br>
> I believe <a href="https://tarballs.opendev.org" rel="noreferrer" target="_blank">https://tarballs.opendev.org</a> is the right place to source<br>
> software correctly?<br>
that is the offcial location where all opendev/openstack projects are released<br>
and its the location distros use to build there packages.<br>
> <br>
> If I want to add some tools or packages inside images then I should use<br>
> Dockerfile.j2 to add and compile images. correct?<br>
<br>
yes so one of the great things about kolla images is tiem was taken to write<br>
down the image api when the project was first started<br>
<a href="https://docs.openstack.org/kolla/yoga/admin/kolla_api.html" rel="noreferrer" target="_blank">https://docs.openstack.org/kolla/yoga/admin/kolla_api.html</a><br>
<br>
over time the common usecaes were then docuemnted in the admin image-building guide<br>
<a href="https://docs.openstack.org/kolla/yoga/admin/image-building.html#dockerfile-customisation" rel="noreferrer" target="_blank">https://docs.openstack.org/kolla/yoga/admin/image-building.html#dockerfile-customisation</a><br>
<br>
<br>
all of the templated imnages have convension/contract that they provide delement that operator can<br>
use to add customisations.<br>
<br>
for examplel the nova_base_footer block and be used to add addtional content to the nova-base image<br>
<a href="https://github.com/openstack/kolla/blob/master/docker/nova/nova-base/Dockerfile.j2#L82" rel="noreferrer" target="_blank">https://github.com/openstack/kolla/blob/master/docker/nova/nova-base/Dockerfile.j2#L82</a><br>
<br>
to customise the iamges you provide what is know as a template override file<br>
<br>
the contrib folder has a number of exmaples<br>
<br>
<a href="https://github.com/openstack/kolla/blob/master/contrib/template-override/ovs-dpdk.j2" rel="noreferrer" target="_blank">https://github.com/openstack/kolla/blob/master/contrib/template-override/ovs-dpdk.j2</a><br>
<a href="https://github.com/openstack/kolla/blob/master/contrib/neutron-plugins/template_override-networking-mlnx.j2" rel="noreferrer" target="_blank">https://github.com/openstack/kolla/blob/master/contrib/neutron-plugins/template_override-networking-mlnx.j2</a><br>
<a href="https://github.com/openstack/kolla/blob/master/contrib/neutron-plugins/template_override-vmware-nsx.j2" rel="noreferrer" target="_blank">https://github.com/openstack/kolla/blob/master/contrib/neutron-plugins/template_override-vmware-nsx.j2</a><br>
<br>
<br>
the way they work is you starte it with <br>
<br>
{% extends parent_template %}<br>
<br>
then you just create a block that mages the name of the one you want to repalce<br>
{% extends parent_template %}<br>
<br>
{% block nova_base_footer %} <br>
 RUN /bin/true<br>
{% endblock %}<br>
<br>
<br>
what ever content you put in the block will be injected directly into the rendered docer file<br>
<br>
<br>
<a href="https://docs.openstack.org/kolla/yoga/admin/image-building.html#plugin-functionality" rel="noreferrer" target="_blank">https://docs.openstack.org/kolla/yoga/admin/image-building.html#plugin-functionality</a><br>
<br>
show how to use that for neutron <br>
<br>
in addtion to replacing block you can set the conten of specal variables<br>
like horizon_packages_append or horizon_packages_remove<br>
<br>
<a href="https://docs.openstack.org/kolla/yoga/admin/image-building.html#packages-customisation" rel="noreferrer" target="_blank">https://docs.openstack.org/kolla/yoga/admin/image-building.html#packages-customisation</a><br>
<br>
that allow you add an remove packages in a simple way<br>
there is also a set of macros that you can use<br>
<br>
you include them with <br>
{% import "macros.j2" as macros with context %}<br>
<br>
they are defiend here<br>
<a href="https://github.com/openstack/kolla/blob/master/docker/macros.j2" rel="noreferrer" target="_blank">https://github.com/openstack/kolla/blob/master/docker/macros.j2</a><br>
<br>
if you know that the docs exist the capablitys are coverd pretty well in the kolla docs you just need to know where to look<br>
hopefully that helps.<br>
<br>
the ovs-dpdk template overide docs can be fouund here <a href="https://docs.openstack.org/kolla/yoga/admin/template-override/ovs-dpdk.html" rel="noreferrer" target="_blank">https://docs.openstack.org/kolla/yoga/admin/template-override/ovs-dpdk.html</a><br>
<br>
its a liltle differnt then the other since there i used the template override mechanium to allow compiling ovs with dpdk form souces<br>
<br>
kolla normlly does not support that but it serves as a demonstration for how operator can do that if they really need too.<br>
i.e. compile a replacment for a minary componet like mariadb. it salso show how to use git as the souce localtion instead<br>
of tars if that is your prefernce.<br>
<br>
> <br>
> ~S<br>
> <br>
> On Fri, Mar 31, 2023 at 7:01 AM Sean Mooney <<a href="mailto:smooney@redhat.com" target="_blank">smooney@redhat.com</a>> wrote:<br>
> <br>
> > On Thu, 2023-03-30 at 16:49 -0400, Satish Patel wrote:<br>
> > > Folks,<br>
> > > <br>
> > > I am playing with kolla image building to understand how it works. I am<br>
> > > using the following command to build images and wanted to check with you<br>
> > > folks if that is the correct way to do it.<br>
> > > <br>
> > > $ kolla-build -b ubuntu -t source keystone nova neutron glance<br>
> > > <br>
> > > Does the above command compile code from source or just download images<br>
> > > from remote repositories and re-compile them?<br>
> > > <br>
> > openstack is mainly python so in general ther is no complie step.<br>
> > but to answer your question that builds the image using the source tarballs<br>
> > or the openstakc packages.<br>
> > <br>
> > the defaults soruce locations are rendered into a file which you can<br>
> > override<br>
> > from the data stored in<br>
> > <a href="https://github.com/openstack/kolla/blob/master/kolla/common/sources.py" rel="noreferrer" target="_blank">https://github.com/openstack/kolla/blob/master/kolla/common/sources.py</a><br>
> > the other build config defaults are generated form this code<br>
> > <a href="https://github.com/openstack/kolla/blob/master/kolla/common/config.py" rel="noreferrer" target="_blank">https://github.com/openstack/kolla/blob/master/kolla/common/config.py</a><br>
> > <br>
> > when you invoke kolla-build its executing<br>
> > <a href="https://github.com/openstack/kolla/blob/master/kolla/cmd/build.py" rel="noreferrer" target="_blank">https://github.com/openstack/kolla/blob/master/kolla/cmd/build.py</a><br>
> > but the main build workflow is here<br>
> > <a href="https://github.com/openstack/kolla/blob/be15d6212f278027c257f9dd67e5b2719e9f730a/kolla/image/build.py#L95" rel="noreferrer" target="_blank">https://github.com/openstack/kolla/blob/be15d6212f278027c257f9dd67e5b2719e9f730a/kolla/image/build.py#L95</a><br>
> > <br>
> > the tl;dr is the build worklow starts by creating  build director and<br>
> > locating the docker file templats.<br>
> > in otherwords the content of the<br>
> > <a href="https://github.com/openstack/kolla/tree/be15d6212f278027c257f9dd67e5b2719e9f730a/docker" rel="noreferrer" target="_blank">https://github.com/openstack/kolla/tree/be15d6212f278027c257f9dd67e5b2719e9f730a/docker</a><br>
> > directory<br>
> > <br>
> > each project has a direcoty in the docker directory and then each<br>
> > contaienr that project has has a directory in the project directory<br>
> > <br>
> > so the aodh project has a aodh folder<br>
> > <a href="https://github.com/openstack/kolla/tree/be15d6212f278027c257f9dd67e5b2719e9f730a/docker/aodh" rel="noreferrer" target="_blank">https://github.com/openstack/kolla/tree/be15d6212f278027c257f9dd67e5b2719e9f730a/docker/aodh</a><br>
> > the convention is to have a <project>-base contaienr which handels the<br>
> > depency installation and then one addtional contaienr for each binary deamon<br>
> > the project has i.e. aodh-api<br>
> > <br>
> > the name of the folder in teh project dir is used as the name of the<br>
> > contaienr<br>
> > <br>
> > if we look at the content of the docker files we will see that they are<br>
> > not actuly dockerfiles<br>
> > <br>
> > <a href="https://github.com/openstack/kolla/blob/be15d6212f278027c257f9dd67e5b2719e9f730a/docker/aodh/aodh-api/Dockerfile.j2" rel="noreferrer" target="_blank">https://github.com/openstack/kolla/blob/be15d6212f278027c257f9dd67e5b2719e9f730a/docker/aodh/aodh-api/Dockerfile.j2</a><br>
> > <br>
> > they are jinja2 templates that produce docker files<br>
> > <br>
> > kolla as far as i am aware has drop support for binary images and<br>
> > alternitiv distos<br>
> > <br>
> > but looking at an older release we can se ehow this worked<br>
> > <br>
> > <a href="https://github.com/openstack/kolla/blob/stable/wallaby/docker/nova/nova-base/Dockerfile.j2#L13-L52" rel="noreferrer" target="_blank">https://github.com/openstack/kolla/blob/stable/wallaby/docker/nova/nova-base/Dockerfile.j2#L13-L52</a><br>
> > <br>
> > each docker file template would use the jinja2 to generate a set of<br>
> > concreate docker files form the template<br>
> > and make dession based on the parmater passed in.<br>
> > <br>
> > so when you are invokeing<br>
> > kolla-build -b ubuntu -t source keystone nova neutron glance<br>
> > <br>
> > what actully happening is that the -t flag is being set as teh<br>
> > install_type parmater in the the jinja2 environemtn when<br>
> > the docker file is rendered.<br>
> > <br>
> > after all the docer files are rendered into normal docker files kolla just<br>
> > invokes the build.<br>
> > <br>
> > in the case of a source build that inovles pre fetching the source tar<br>
> > from <a href="https://tarballs.opendev.org" rel="noreferrer" target="_blank">https://tarballs.opendev.org</a><br>
> > and puting it in the build directory so that it can be included into the<br>
> > contianer.<br>
> > <br>
> > kolla also used to supprot git repo as a alternitve  source fromat<br>
> > <br>
> > i have glossed over a lot of the details of how this actully work but that<br>
> > is the essence of what that command is doing<br>
> > creating a build dir, downloading the source, rendering the dockerfile<br>
> > templates to docker files, invokeing docker build on those<br>
> > and then taging them with the contaienr nameand build tag<br>
> > <br>
> > <br>
> > <a href="https://docs.openstack.org/kolla/latest/admin/image-building.html" rel="noreferrer" target="_blank">https://docs.openstack.org/kolla/latest/admin/image-building.html</a><br>
> > covers this form a high level<br>
> > <br>
> > >   because in command output<br>
> > > I've not noticed anything related to the compiling process going on.<br>
> > > <br>
> > > Here is the output of all images produced by kolla-build command. Do I<br>
> > need<br>
> > > anything else or is this enough to deploy kolla?<br>
> > you can deploy coll with what you have yes although since the kolla files<br>
> > are automaticaly<br>
> > built by ci kolla-ansible can just use the ones form the docker hub or<br>
> > quay instead you do not need to build them yourself<br>
> > <br>
> > if you do build them your self then there is basically one other stpe that<br>
> > you shoudl take if this si a multi node deployment<br>
> > you should push the iamges to an interally host docker registry although<br>
> > based on the hostname in the prompt below<br>
> > it looks like you ahve alredy done that.<br>
> > > <br>
> > > root@docker-reg:~# docker images<br>
> > > REPOSITORY                            TAG       IMAGE ID       CREATED<br>
> > >         SIZE<br>
> > > kolla/mariadb-server                  15.1.0    2a497eee8269   26 minutes<br>
> > > ago      595MB<br>
> > > kolla/cron                            15.1.0    342877f26a8a   30 minutes<br>
> > > ago      250MB<br>
> > > kolla/memcached                       15.1.0    0d19a4902644   31 minutes<br>
> > > ago      250MB<br>
> > > kolla/mariadb-clustercheck            15.1.0    d84427d3c639   31 minutes<br>
> > > ago      314MB<br>
> > > kolla/mariadb-base                    15.1.0    34447e3e59b6   31 minutes<br>
> > > ago      314MB<br>
> > > kolla/keepalived                      15.1.0    82133b09fbf0   31 minutes<br>
> > > ago      260MB<br>
> > > kolla/prometheus-memcached-exporter   15.1.0    6c2d605f70ee   31 minutes<br>
> > > ago      262MB<br>
> > > <none>                                <none>    e66b228c2a07   31 minutes<br>
> > > ago      248MB<br>
> > > kolla/rabbitmq                        15.1.0    8de5c39379d3   32 minutes<br>
> > > ago      309MB<br>
> > > kolla/fluentd                         15.1.0    adfd19027862   33 minutes<br>
> > > ago      519MB<br>
> > > kolla/haproxy-ssh                     15.1.0    514357ac4d36   36 minutes<br>
> > > ago      255MB<br>
> > > kolla/haproxy                         15.1.0    e5b9cfdf6dfc   37 minutes<br>
> > > ago      257MB<br>
> > > kolla/prometheus-haproxy-exporter     15.1.0    a679f65fd735   37 minutes<br>
> > > ago      263MB<br>
> > > kolla/prometheus-base                 15.1.0    afeff3ed5dce   37 minutes<br>
> > > ago      248MB<br>
> > > kolla/glance-api                      15.1.0    a2241f68f23a   38 minutes<br>
> > > ago      1.04GB<br>
> > > kolla/glance-base                     15.1.0    7286772a03a4   About an<br>
> > > hour ago   1.03GB<br>
> > > kolla/neutron-infoblox-ipam-agent     15.1.0    f90ffc1a3326   About an<br>
> > > hour ago   1.05GB<br>
> > > kolla/neutron-server                  15.1.0    69c844a2e3a9   About an<br>
> > > hour ago   1.05GB<br>
> > > kolla/neutron-l3-agent                15.1.0    4d87e6963c96   About an<br>
> > > hour ago   1.05GB<br>
> > > <none>                                <none>    486da9a6562e   About an<br>
> > > hour ago   1.05GB<br>
> > > kolla/neutron-linuxbridge-agent       15.1.0    e5b3ca7e099c   About an<br>
> > > hour ago   1.04GB<br>
> > > kolla/neutron-bgp-dragent             15.1.0    ac37377820c6   About an<br>
> > > hour ago   1.04GB<br>
> > > kolla/ironic-neutron-agent            15.1.0    90993adcd74b   About an<br>
> > > hour ago   1.04GB<br>
> > > kolla/neutron-metadata-agent          15.1.0    8522f147f88d   About an<br>
> > > hour ago   1.04GB<br>
> > > kolla/neutron-sriov-agent             15.1.0    8a92ce7d13c0   About an<br>
> > > hour ago   1.04GB<br>
> > > kolla/neutron-dhcp-agent              15.1.0    5c214b0171f5   About an<br>
> > > hour ago   1.04GB<br>
> > > kolla/neutron-metering-agent          15.1.0    7b3b91ecd77b   About an<br>
> > > hour ago   1.04GB<br>
> > > kolla/neutron-openvswitch-agent       15.1.0    1f8807308814   About an<br>
> > > hour ago   1.04GB<br>
> > > kolla/neutron-base                    15.1.0    f85b6a2e2725   About an<br>
> > > hour ago   1.04GB<br>
> > > kolla/nova-libvirt                    15.1.0    0f3ecefe4752   About an<br>
> > > hour ago   987MB<br>
> > > kolla/nova-compute                    15.1.0    241b7e7fafbe   About an<br>
> > > hour ago   1.47GB<br>
> > > kolla/nova-spicehtml5proxy            15.1.0    b740820a7ad1   About an<br>
> > > hour ago   1.15GB<br>
> > > kolla/nova-novncproxy                 15.1.0    1ba2f443d5c3   About an<br>
> > > hour ago   1.22GB<br>
> > > kolla/nova-compute-ironic             15.1.0    716612107532   About an<br>
> > > hour ago   1.12GB<br>
> > > kolla/nova-ssh                        15.1.0    ae2397f4e1c1   About an<br>
> > > hour ago   1.11GB<br>
> > > kolla/nova-api                        15.1.0    2aef02667ff8   About an<br>
> > > hour ago   1.11GB<br>
> > > kolla/nova-conductor                  15.1.0    6f1da3400901   About an<br>
> > > hour ago   1.11GB<br>
> > > kolla/nova-scheduler                  15.1.0    628326776b1d   About an<br>
> > > hour ago   1.11GB<br>
> > > kolla/nova-serialproxy                15.1.0    28eb7a4a13f8   About an<br>
> > > hour ago   1.11GB<br>
> > > kolla/nova-base                       15.1.0    e47420013283   About an<br>
> > > hour ago   1.11GB<br>
> > > kolla/keystone                        15.1.0    e5530d829d5f   2 hours<br>
> > ago<br>
> > >         947MB<br>
> > > kolla/keystone-ssh                    15.1.0    eaa7e3f3985a   2 hours<br>
> > ago<br>
> > >         953MB<br>
> > > kolla/keystone-fernet                 15.1.0    8a4fa24853a8   2 hours<br>
> > ago<br>
> > >         951MB<br>
> > > kolla/keystone-base                   15.1.0    b6f9562364a9   2 hours<br>
> > ago<br>
> > >         945MB<br>
> > > kolla/barbican-base                   15.1.0    b2fdef1afb44   2 hours<br>
> > ago<br>
> > >         915MB<br>
> > > kolla/barbican-keystone-listener      15.1.0    58bd59de2c63   2 hours<br>
> > ago<br>
> > >         915MB<br>
> > > kolla/openstack-base                  15.1.0    c805b4b3b1c1   2 hours<br>
> > ago<br>
> > >         893MB<br>
> > > kolla/base                            15.1.0    f68e9ef3dd30   2 hours<br>
> > ago<br>
> > >         248MB<br>
> > > registry                              2         8db46f9d7550   19 hours<br>
> > ago<br>
> > >        24.2MB<br>
> > > ubuntu                                22.04     08d22c0ceb15   3 weeks<br>
> > ago<br>
> > >         77.8MB<br>
> > <br>
> > <br>
<br>
</blockquote></div>