From c563f45fb7e90dc202814df9f746bc909f2d0ffd Mon Sep 17 00:00:00 2001
From: Mark Goddard <mark@stackhpc.com>
Date: Tue, 10 Mar 2020 17:33:32 +0000
Subject: [PATCH] CentOS 8: separate kolla build tag from deploy tag

Prevously the container image tag applied to built images was configured
via 'kolla_openstack_release'. This variable also controlled the tag
used for deployed images. This could cause problems during the CentOS 8
transition, where we need to build two sets of images, and Kolla Ansible
may apply a '-centos8' suffix to the tag we specify on CentOS 8.

This change separates the tag applied to built images into a different
variable - 'kolla_tag'. The default is still 'kolla_openstack_release'.

Change-Id: I8e1d877ee91a07b86cb858d25b841f8bfcd50e21
Story: 2006574
Task: 39487
---
 ansible/group_vars/all/kolla                               | 4 ++++
 ansible/roles/kolla-build/defaults/main.yml                | 2 +-
 ansible/roles/kolla-build/templates/kolla-build.conf.j2    | 2 +-
 doc/source/configuration/kolla.rst                         | 3 +++
 etc/kayobe/kolla.yml                                       | 4 ++++
 .../notes/kolla-tag-and-suffix-a223b0c7173a245e.yaml       | 7 +++++++
 6 files changed, 20 insertions(+), 2 deletions(-)
 create mode 100644 releasenotes/notes/kolla-tag-and-suffix-a223b0c7173a245e.yaml

diff --git a/ansible/group_vars/all/kolla b/ansible/group_vars/all/kolla
index 97a89834..903f4ae8 100644
--- a/ansible/group_vars/all/kolla
+++ b/ansible/group_vars/all/kolla
@@ -74,6 +74,10 @@ kolla_docker_registry_password:
 # Default is {{ openstack_release }}.
 kolla_openstack_release: "{{ openstack_release }}"
 
+# Docker tag applied to built container images. Default is
+# {{ kolla_openstack_release }}.
+kolla_tag: "{{ kolla_openstack_release }}"
+
 # Dict mapping names of sources to their definitions for
 # kolla_install_type=source. See kolla.common.config for details.
 # Example:
diff --git a/ansible/roles/kolla-build/defaults/main.yml b/ansible/roles/kolla-build/defaults/main.yml
index d08d37ac..66de5825 100644
--- a/ansible/roles/kolla-build/defaults/main.yml
+++ b/ansible/roles/kolla-build/defaults/main.yml
@@ -15,7 +15,7 @@ kolla_install_type:
 kolla_docker_namespace:
 
 # Valid option is Docker repository tag
-kolla_openstack_release:
+kolla_tag:
 
 # Dict mapping names of sources to their definitions for
 # kolla_install_type=source. See kolla.common.config for details.
diff --git a/ansible/roles/kolla-build/templates/kolla-build.conf.j2 b/ansible/roles/kolla-build/templates/kolla-build.conf.j2
index e20e2f72..18a79be3 100644
--- a/ansible/roles/kolla-build/templates/kolla-build.conf.j2
+++ b/ansible/roles/kolla-build/templates/kolla-build.conf.j2
@@ -12,7 +12,7 @@ install_type={{ kolla_install_type }}
 namespace={{ kolla_docker_namespace }}
 
 # Docker image tag to apply.
-tag={{ kolla_openstack_release }}
+tag={{ kolla_tag }}
 
 # Path to a file containing template overrides.
 template_override={{ kolla_build_config_path }}/template-override.j2
diff --git a/doc/source/configuration/kolla.rst b/doc/source/configuration/kolla.rst
index e50f1d77..10f7b72a 100644
--- a/doc/source/configuration/kolla.rst
+++ b/doc/source/configuration/kolla.rst
@@ -92,6 +92,9 @@ affect :ref:`Kolla Ansible configuration <configuration-kolla-ansible-global>`.
     Kolla OpenStack release version. This should be a Docker image tag. Default
     is the OpenStack release name (e.g. ``rocky``) on stable branches and
     tagged releases, or ``master`` on the Kayobe ``master`` branch.
+``kolla_tag``
+    Kolla container image tag. This is the tag that will be applied to built
+    container images. Default is ``kolla_openstack_release``.
 
 For example, to build the Kolla ``centos`` ``binary`` images with a namespace
 of ``example``, and a private Docker registry at ``registry.example.com:4000``,
diff --git a/etc/kayobe/kolla.yml b/etc/kayobe/kolla.yml
index 60ab7e4c..12a9e7f1 100644
--- a/etc/kayobe/kolla.yml
+++ b/etc/kayobe/kolla.yml
@@ -86,6 +86,10 @@
 # Default is {{ openstack_release }}.
 #kolla_openstack_release:
 
+# Docker tag applied to built container images. Default is
+# {{ kolla_openstack_release }}.
+#kolla_tag:
+
 # Dict mapping names of sources to their definitions for
 # kolla_install_type=source. See kolla.common.config for details.
 # Example:
diff --git a/releasenotes/notes/kolla-tag-and-suffix-a223b0c7173a245e.yaml b/releasenotes/notes/kolla-tag-and-suffix-a223b0c7173a245e.yaml
new file mode 100644
index 00000000..4a4b546d
--- /dev/null
+++ b/releasenotes/notes/kolla-tag-and-suffix-a223b0c7173a245e.yaml
@@ -0,0 +1,7 @@
+---
+features:
+  - |
+    Adds a variable for controlling the tag applied to built container images -
+    ``kolla_tag``. This separates the configuration of the tag for image
+    building from that used for deployment (``kolla_openstack_release``).  The
+    default for ``kolla_tag`` is ``kolla_openstack_release``.
-- 
GitLab