From bd90b02708d8c6b88692ec7308a41229fdcdaf22 Mon Sep 17 00:00:00 2001 From: Marcin Juszkiewicz Date: Fri, 9 Apr 2021 09:33:15 +0200 Subject: [PATCH] drop leftovers of RHEL support As a project we never built RHEL based images so support for them was not tested. Change-Id: I27dfe34ade088228d71f6857ec4f3ab28ee63915 --- doc/source/admin/image-building.rst | 18 ------- doc/source/admin/kolla_api.rst | 2 - doc/source/support_matrix.rst | 1 - docker/base/Dockerfile.j2 | 20 +------ docker/base/copy_cacerts.sh | 2 +- docker/ironic/ironic-pxe/extend_start.sh | 4 +- docker/macros.j2 | 3 +- docker/magnum/magnum-api/Dockerfile.j2 | 5 +- docker/magnum/magnum-base/Dockerfile.j2 | 5 +- docker/magnum/magnum-conductor/Dockerfile.j2 | 5 +- docker/ovsdpdk/ovsdpdk/Dockerfile.j2 | 2 +- kolla/common/config.py | 6 +-- kolla/image/build.py | 49 ++++------------- kolla/template/repos.yaml | 6 --- kolla/tests/test_build.py | 52 ++----------------- kolla/tests/test_methods.py | 11 ---- .../drop-rhel-support-03ccce1a69bd88a7.yaml | 5 ++ tests/files/process_build_logs.py | 2 +- tools/validate-binary-build.sh | 2 +- 19 files changed, 30 insertions(+), 170 deletions(-) create mode 100644 releasenotes/notes/drop-rhel-support-03ccce1a69bd88a7.yaml diff --git a/doc/source/admin/image-building.rst b/doc/source/admin/image-building.rst index 97f2ba8aca..f5a110a7a6 100644 --- a/doc/source/admin/image-building.rst +++ b/doc/source/admin/image-building.rst @@ -33,7 +33,6 @@ There are following distros (bases) available for building images: - centos - debian -- rhel (deprecated) - ubuntu See the :ref:`support matrix ` for information on @@ -233,23 +232,6 @@ All leaf Dockerfiles, i.e. those meant for direct consumption, additionally have a ``footer`` block which is then guaranteed to exist once at the very end of the image recipe chain. -RHEL containers and RHN -^^^^^^^^^^^^^^^^^^^^^^^ - -To build RHEL containers, it is necessary to include registration with RHN -of the container runtime operating system. To obtain a RHN -username/password/pool id, contact Red Hat. Use template's header block in the -overrides file, e.g.: - -.. code-block:: jinja - - {% extends parent_template %} - - {% block base_header %} - RUN subscription-manager register --user= \ - --password= && subscription-manager attach --pool - {% endblock %} - Packages customisation ---------------------- diff --git a/doc/source/admin/kolla_api.rst b/doc/source/admin/kolla_api.rst index 4c4bd69f5c..b366de6962 100644 --- a/doc/source/admin/kolla_api.rst +++ b/doc/source/admin/kolla_api.rst @@ -170,5 +170,3 @@ scripts: ubuntu) * **KOLLA_INSTALL_TYPE**: ``install_type`` used to build the image (binary, source) -* **KOLLA_INSTALL_METATYPE**: ``install_metatype`` used to build the image - (rdo, ...) diff --git a/doc/source/support_matrix.rst b/doc/source/support_matrix.rst index 922456ff78..8049f248bc 100644 --- a/doc/source/support_matrix.rst +++ b/doc/source/support_matrix.rst @@ -19,7 +19,6 @@ Distribution Default base Default base tag ================== =============================== ================ CentOS Stream 8 quay.io/centos/centos stream8 Debian Bullseye debian bullseye -RHEL8 (deprecated) registry.access.redhat.com/ubi8 latest Ubuntu Focal ubuntu 20.04 ================== =============================== ================ diff --git a/docker/base/Dockerfile.j2 b/docker/base/Dockerfile.j2 index 13372519f4..9430f2d13a 100644 --- a/docker/base/Dockerfile.j2 +++ b/docker/base/Dockerfile.j2 @@ -138,23 +138,12 @@ RUN rm -f /etc/rpm/macros.image-language-conf \ {%- if not loop.last %} \{% endif %} {% endfor -%} - {% if install_metatype in ['rdo', 'mixed'] %} - {% for cmd in rpm_setup %} {{ cmd }} {% endfor %} {% block base_centos_repo_overrides_post_rpm %}{% endblock %} - {% endif %} - {# endif for repo setup for all RHEL except RHEL OSP #} - - {% if install_metatype == 'rhos' %} - -{% block base_rhos_repo_enablement %}{% endblock %} - - {% endif %} - {% if base_distro == 'centos' %} {% block base_centos_gpg_key_import %} @@ -213,13 +202,6 @@ RUN {{ macros.install_packages(base_centos_yum_repo_packages | customizable("cen {%- endif %} {# Endif for base_distro centos #} - {% if base_distro == 'rhel' %} - -{% block base_rhel_package_installation %}{% endblock %} - - {% endif %} - {# Endif for base_distro RHEL #} - #### END REPO ENABLEMENT {# We are back to the basic if conditional here which is: @@ -391,7 +373,7 @@ RUN apt-get update \ {# endif base_package_type deb #} {% endif %} -{% if base_distro == 'centos' or base_distro == 'rhel' %} +{% if base_distro == 'centos' %} RUN sed -ri '/-session(\s+)optional(\s+)pam_systemd.so/d' /etc/pam.d/system-auth \ && sed -ri '/^[^#]/ s/systemd//g' /etc/nsswitch.conf {% endif %} diff --git a/docker/base/copy_cacerts.sh b/docker/base/copy_cacerts.sh index aa0dd679a4..5e8955fed1 100644 --- a/docker/base/copy_cacerts.sh +++ b/docker/base/copy_cacerts.sh @@ -17,7 +17,7 @@ if [[ -d /var/lib/kolla/config_files/ca-certificates ]] && \ done update-ca-certificates elif [[ -e /etc/redhat-release ]]; then - # CentOS, RHEL + # CentOS for cert in /var/lib/kolla/config_files/ca-certificates/*; do file=$(basename "$cert") cp $cert "/etc/pki/ca-trust/source/anchors/kolla-customca-$file" diff --git a/docker/ironic/ironic-pxe/extend_start.sh b/docker/ironic/ironic-pxe/extend_start.sh index 44f101bb0b..af20d01d64 100644 --- a/docker/ironic/ironic-pxe/extend_start.sh +++ b/docker/ironic/ironic-pxe/extend_start.sh @@ -15,7 +15,7 @@ function prepare_pxe { function prepare_ipxe { if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then cp /usr/lib/ipxe/{undionly.kpxe,ipxe.efi} /tftpboot - elif [[ "${KOLLA_BASE_DISTRO}" =~ centos|rhel ]]; then + elif [[ "${KOLLA_BASE_DISTRO}" =~ centos ]]; then cp /usr/share/ipxe/{undionly.kpxe,ipxe*.efi} /tftpboot fi } @@ -35,7 +35,7 @@ if [[ -d /usr/lib/grub/arm64-efi ]]; then if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then grub-mkimage -v -o /tftpboot/grubaa64.efi -O arm64-efi -p "grub" $modules - elif [[ "${KOLLA_BASE_DISTRO}" =~ centos|rhel ]]; then + elif [[ "${KOLLA_BASE_DISTRO}" =~ centos ]]; then grub2-mkimage -v -o /tftpboot/grubaa64.efi -O arm64-efi -p "EFI/centos" $modules fi fi diff --git a/docker/macros.j2 b/docker/macros.j2 index 7076e422c9..0af1b6f148 100644 --- a/docker/macros.j2 +++ b/docker/macros.j2 @@ -82,6 +82,5 @@ RUN usermod --append --home {{ homedir }} --groups kolla {{ name }} \ {% endmacro %} {% macro add_binary_source_envs() %} -ENV KOLLA_INSTALL_TYPE={{ install_type }} \ - KOLLA_INSTALL_METATYPE={{ install_metatype }} +ENV KOLLA_INSTALL_TYPE={{ install_type }} {% endmacro %} diff --git a/docker/magnum/magnum-api/Dockerfile.j2 b/docker/magnum/magnum-api/Dockerfile.j2 index 1bc75758e4..773d7bbbc0 100644 --- a/docker/magnum/magnum-api/Dockerfile.j2 +++ b/docker/magnum/magnum-api/Dockerfile.j2 @@ -8,11 +8,8 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build {% import "macros.j2" as macros with context %} {% if install_type == 'binary' %} - {% if base_package_type == 'rpm' and base_distro != 'rhel' %} + {% if base_package_type == 'rpm' %} {% set magnum_api_packages = ['openstack-magnum-api'] %} - {% elif base_package_type == 'rpm' and base_distro == 'rhel' %} -RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \ - && /bin/false {% elif base_package_type == 'deb' %} {% set magnum_api_packages = ['magnum-api'] %} {% endif %} diff --git a/docker/magnum/magnum-base/Dockerfile.j2 b/docker/magnum/magnum-base/Dockerfile.j2 index 14024b6ace..83f5a57590 100644 --- a/docker/magnum/magnum-base/Dockerfile.j2 +++ b/docker/magnum/magnum-base/Dockerfile.j2 @@ -10,11 +10,8 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build {{ macros.configure_user(name='magnum') }} {% if install_type == 'binary' %} - {% if base_package_type == 'rpm' and base_distro != 'rhel' %} + {% if base_package_type == 'rpm' %} {% set magnum_base_packages = ['openstack-magnum-common'] %} - {% elif base_package_type == 'rpm' and base_distro == 'rhel' %} -RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \ - && /bin/bash {% elif base_package_type == 'deb' %} {% set magnum_base_packages = ['magnum-common'] %} {% endif %} diff --git a/docker/magnum/magnum-conductor/Dockerfile.j2 b/docker/magnum/magnum-conductor/Dockerfile.j2 index 39178fccf9..d6393a1cbb 100644 --- a/docker/magnum/magnum-conductor/Dockerfile.j2 +++ b/docker/magnum/magnum-conductor/Dockerfile.j2 @@ -8,13 +8,10 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build {% import "macros.j2" as macros with context %} {% if install_type == 'binary' %} - {% if base_package_type == 'rpm' and base_distro != 'rhel' %} + {% if base_package_type == 'rpm' %} {% set magnum_conductor_packages = [ 'openstack-magnum-conductor' ] %} - {% elif base_package_type == 'rpm' and base_distro == 'rhel' %} -RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \ - && /bin/false {% elif base_package_type == 'deb' %} {% set magnum_conductor_packages = [ 'magnum-conductor' diff --git a/docker/ovsdpdk/ovsdpdk/Dockerfile.j2 b/docker/ovsdpdk/ovsdpdk/Dockerfile.j2 index d56088720c..0f01621b99 100644 --- a/docker/ovsdpdk/ovsdpdk/Dockerfile.j2 +++ b/docker/ovsdpdk/ovsdpdk/Dockerfile.j2 @@ -11,7 +11,7 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build {% if base_package_type == 'rpm' %} #TODO(sean-k-mooney) create repo via open suse build system to package -# for centos/rhel distros. +# for centos distro. RUN echo 'image not yet available for {{ base_distro }}' \ && /bin/false diff --git a/kolla/common/config.py b/kolla/common/config.py index 0462f03877..a72961570f 100755 --- a/kolla/common/config.py +++ b/kolla/common/config.py @@ -19,18 +19,16 @@ from oslo_config import types from kolla.version import version_info as version -BASE_OS_DISTRO = ['centos', 'rhel', 'ubuntu', 'debian'] +BASE_OS_DISTRO = ['centos', 'debian', 'ubuntu'] BASE_ARCH = ['x86_64', 'aarch64'] DEFAULT_BASE_TAGS = { 'centos': {'name': 'quay.io/centos/centos', 'tag': 'stream8'}, - 'rhel': {'name': 'registry.access.redhat.com/ubi8', 'tag': 'latest'}, 'debian': {'name': 'debian', 'tag': 'bullseye'}, 'ubuntu': {'name': 'ubuntu', 'tag': '20.04'}, } # NOTE(hrw): has to match PRETTY_NAME in /etc/os-release DISTRO_PRETTY_NAME = { 'centos': 'CentOS Stream 8', - 'rhel': 'Red Hat Enterprise Linux 8', 'debian': 'Debian GNU/Linux 11 (bullseye)', 'ubuntu': 'Ubuntu 20.04', } @@ -42,7 +40,7 @@ DELOREAN = "https://trunk.rdoproject.org/centos8-wallaby/" \ DELOREAN_DEPS = "https://trunk.rdoproject.org/centos8-wallaby/" \ "delorean-deps.repo" -INSTALL_TYPE_CHOICES = ['binary', 'source', 'rdo', 'rhos'] +INSTALL_TYPE_CHOICES = ['binary', 'source'] # TODO(mandre) check for file integrity instead of downloading from an HTTPS # source diff --git a/kolla/image/build.py b/kolla/image/build.py index cc486c62b3..d900702db4 100755 --- a/kolla/image/build.py +++ b/kolla/image/build.py @@ -658,59 +658,29 @@ class KollaWorker(object): conf.rpm_setup_config if repo_file is not None]) self.rpm_setup = self.build_rpm_setup(rpm_setup_config) - rh_base = ['centos', 'rhel'] - rh_type = ['source', 'binary', 'rdo', 'rhos'] - deb_base = ['ubuntu', 'debian'] - deb_type = ['source', 'binary'] - - if self.base in rh_base: + if self.base in ['centos']: self.conf.distro_python_version = "3.6" + self.distro_package_manager = 'dnf' + self.base_package_type = 'rpm' elif self.base in ['debian']: self.conf.distro_python_version = "3.9" + self.distro_package_manager = 'apt' + self.base_package_type = 'deb' elif self.base in ['ubuntu']: self.conf.distro_python_version = "3.8" + self.distro_package_manager = 'apt' + self.base_package_type = 'deb' else: # Assume worst self.conf.distro_python_version = "3.6" if self.conf.distro_package_manager is not None: - package_manager = self.conf.distro_package_manager - elif self.base in rh_base: - package_manager = 'dnf' - elif self.base in deb_base: - package_manager = 'apt' - self.distro_package_manager = package_manager + self.distro_package_manager = self.conf.distro_package_manager - self.clean_package_cache = self.conf.clean_package_cache - - # Determine base packaging type for use in Dockerfiles. if self.conf.base_package_type: self.base_package_type = self.conf.base_package_type - elif self.base in rh_base: - self.base_package_type = 'rpm' - elif self.base in deb_base: - self.base_package_type = 'deb' - if not ((self.base in rh_base and self.install_type in rh_type) or - (self.base in deb_base and self.install_type in deb_type)): - raise exception.KollaMismatchBaseTypeException( - '{} is unavailable for {}'.format(self.install_type, self.base) - ) - - if self.install_type == 'binary': - self.install_metatype = 'rdo' - elif self.install_type == 'source': - self.install_metatype = 'mixed' - elif self.install_type == 'rdo': - self.install_type = 'binary' - self.install_metatype = 'rdo' - elif self.install_type == 'rhos': - self.install_type = 'binary' - self.install_metatype = 'rhos' - else: - raise exception.KollaUnknownBuildTypeException( - 'Unknown install type' - ) + self.clean_package_cache = self.conf.clean_package_cache if (self.install_type == 'binary' and self.base == 'debian' and self.base_arch != 'x86_64'): @@ -905,7 +875,6 @@ class KollaWorker(object): 'debian_arch': self.debian_arch, 'docker_healthchecks': self.docker_healthchecks, 'supported_distro_name': supported_distro_name, - 'install_metatype': self.install_metatype, 'image_prefix': self.image_prefix, 'infra_image_prefix': self.infra_image_prefix, 'install_type': self.install_type, diff --git a/kolla/template/repos.yaml b/kolla/template/repos.yaml index 2733e0a90f..d0ea99cbd7 100644 --- a/kolla/template/repos.yaml +++ b/kolla/template/repos.yaml @@ -37,12 +37,6 @@ centos-aarch64: rabbitmq: "rabbitmq_rabbitmq-server" td-agent: "treasuredata" -rhel: - erlang: "centos-rabbitmq-38" - hacluster: "ha" - opstools: "centos-opstools" - rabbitmq: "centos-rabbitmq-38" - # NOTE(mnasiadka): Erlang repo - Debian Buster/Bullseye needs to use bionic as per RabbitMQ docs debian: elasticsearch: "deb https://artifacts.elastic.co/packages/oss-7.x/apt stable main" diff --git a/kolla/tests/test_build.py b/kolla/tests/test_build.py index 422dfcd73a..0200fadd72 100644 --- a/kolla/tests/test_build.py +++ b/kolla/tests/test_build.py @@ -18,7 +18,6 @@ import sys from unittest import mock from kolla.cmd import build as build_cmd -from kolla import exception from kolla.image import build from kolla.tests import base @@ -361,14 +360,11 @@ class KollaWorkerTest(base.TestCase): self.mock_client = patcher.start() def test_supported_base_type(self): - rh_base = ['centos', 'rhel'] - rh_type = ['source', 'binary', 'rdo', 'rhos'] - deb_base = ['ubuntu', 'debian'] - deb_type = ['source', 'binary'] + build_base = ['centos', 'debian', 'ubuntu'] + build_type = ['source', 'binary'] for base_distro, install_type in itertools.chain( - itertools.product(rh_base, rh_type), - itertools.product(deb_base, deb_type)): + itertools.product(build_base, build_type)): self.conf.set_override('base', base_distro) if base_distro == 'debian' and install_type == 'binary': self.conf.set_override('base_arch', 'x86_64') @@ -376,14 +372,6 @@ class KollaWorkerTest(base.TestCase): # should no exception raised build.KollaWorker(self.conf) - def test_unsupported_base_type(self): - for base_distro, install_type in itertools.product( - ['ubuntu', 'debian'], ['rdo', 'rhos']): - self.conf.set_override('base', base_distro) - self.conf.set_override('install_type', install_type) - self.assertRaises(exception.KollaMismatchBaseTypeException, - build.KollaWorker, self.conf) - def test_build_image_list_adds_plugins(self): self.conf.set_override('install_type', 'source') @@ -534,20 +522,6 @@ class KollaWorkerTest(base.TestCase): kolla = build.KollaWorker(self.conf) self.assertEqual('3.9', kolla.distro_python_version) - def test_build_distro_python_version_rhel80(self): - """check distro_python_version for RHEL8.0""" - self.conf.set_override('base', 'rhel') - self.conf.set_override('base_tag', '8.0') - kolla = build.KollaWorker(self.conf) - self.assertEqual('3.6', kolla.distro_python_version) - - def test_build_distro_python_version_rhel8(self): - """check distro_python_version for RHEL8""" - self.conf.set_override('base', 'rhel') - self.conf.set_override('base_tag', '8') - kolla = build.KollaWorker(self.conf) - self.assertEqual('3.6', kolla.distro_python_version) - def test_build_distro_python_version_ubuntu(self): """check distro_python_version for Ubuntu""" self.conf.set_override('base', 'ubuntu') @@ -567,20 +541,6 @@ class KollaWorkerTest(base.TestCase): kolla = build.KollaWorker(self.conf) self.assertEqual('foo', kolla.distro_package_manager) - def test_build_distro_package_manager_rhel8(self): - """check distro_package_manager dnf for rhel8""" - self.conf.set_override('base', 'rhel') - self.conf.set_override('base_tag', '8') - kolla = build.KollaWorker(self.conf) - self.assertEqual('dnf', kolla.distro_package_manager) - - def test_build_distro_package_manager_rhel8_minor(self): - """check distro_package_manager dnf for rhel8""" - self.conf.set_override('base', 'rhel') - self.conf.set_override('base_tag', '8.1.2') - kolla = build.KollaWorker(self.conf) - self.assertEqual('dnf', kolla.distro_package_manager) - def test_build_distro_package_manager_debian(self): """check distro_package_manager apt for debian""" self.conf.set_override('base', 'debian') @@ -600,12 +560,6 @@ class KollaWorkerTest(base.TestCase): kolla = build.KollaWorker(self.conf) self.assertEqual('pip', kolla.base_package_type) - def test_base_package_type_rhel(self): - """check base_package_type rpm for rhel""" - self.conf.set_override('base', 'rhel') - kolla = build.KollaWorker(self.conf) - self.assertEqual('rpm', kolla.base_package_type) - def test_base_package_type_debian(self): """check base_package_type deb for debian""" self.conf.set_override('base', 'debian') diff --git a/kolla/tests/test_methods.py b/kolla/tests/test_methods.py index 65d54a6875..1ff8ec30fe 100644 --- a/kolla/tests/test_methods.py +++ b/kolla/tests/test_methods.py @@ -22,17 +22,6 @@ class MethodsTest(base.TestCase): expectCmd = 'apt-get -y install --no-install-recommends package2.deb' self.assertEqual(expectCmd, result.split("&&")[1].strip()) - def test_enable_repos_rhel(self): - template_vars = { - 'base_arch': 'x86_64', - 'base_distro': 'rhel', - 'base_package_type': 'rpm', - } - - result = methods.handle_repos(template_vars, ['grafana'], 'enable') - expectCmd = '' - self.assertEqual(expectCmd, result) - def test_enable_repos_centos(self): template_vars = { 'base_arch': 'x86_64', diff --git a/releasenotes/notes/drop-rhel-support-03ccce1a69bd88a7.yaml b/releasenotes/notes/drop-rhel-support-03ccce1a69bd88a7.yaml new file mode 100644 index 0000000000..074b91f3d0 --- /dev/null +++ b/releasenotes/notes/drop-rhel-support-03ccce1a69bd88a7.yaml @@ -0,0 +1,5 @@ +--- +upgrade: + - | + Support for using Red Hat Enterprise Linux as base of container images was + dropped. Please migrate to using CentOS Stream 8 based images. diff --git a/tests/files/process_build_logs.py b/tests/files/process_build_logs.py index f05cd81e99..22b7182273 100755 --- a/tests/files/process_build_logs.py +++ b/tests/files/process_build_logs.py @@ -30,7 +30,7 @@ parser.add_argument('-b', '--base', required=True) args = vars(parser.parse_args()) -if args['base'] not in ['centos', 'rhel']: +if args['base'] not in ['centos']: print("Non rpm-based distros are not yet supported.") sys.exit() diff --git a/tools/validate-binary-build.sh b/tools/validate-binary-build.sh index 4d12a5df34..b0d5c0014c 100755 --- a/tools/validate-binary-build.sh +++ b/tools/validate-binary-build.sh @@ -29,7 +29,7 @@ check_for_errors () { echo Looking for forbidden instructions in binary image templates -for distro in debian ubuntu centos rhel; do +for distro in debian ubuntu centos; do tmpdir=$(mktemp -d kolla-templates.XXXXXX --tmpdir) generate_templates check_for_errors "gem .*install"