drop leftovers of RHEL support

As a project we never built RHEL based images so support for them
was not tested.

Change-Id: I27dfe34ade088228d71f6857ec4f3ab28ee63915
This commit is contained in:
Marcin Juszkiewicz 2021-04-09 09:33:15 +02:00
parent 53b391d361
commit bd90b02708
19 changed files with 30 additions and 170 deletions

View File

@ -33,7 +33,6 @@ There are following distros (bases) available for building images:
- centos
- debian
- rhel (deprecated)
- ubuntu
See the :ref:`support matrix <support-matrix-base-images>` 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=<user-name> \
--password=<password> && subscription-manager attach --pool <pool-id>
{% endblock %}
Packages customisation
----------------------

View File

@ -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, ...)

View File

@ -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
================== =============================== ================

View File

@ -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 %}

View File

@ -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"

View File

@ -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

View File

@ -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 %}

View File

@ -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 %}

View File

@ -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 %}

View File

@ -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'

View File

@ -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

View File

@ -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

View File

@ -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,

View File

@ -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"

View File

@ -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')

View File

@ -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',

View File

@ -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.

View File

@ -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()

View File

@ -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"