Files
kolla/docker/kolla-toolbox/Dockerfile.j2
Michal Nasiadka 9e36b89766 Move to CentOS Stream 10
Known missing packages:
- mod_auth_mellon - missing SAML support in Keystone/Horizon - built in Kolla COPR
- glusterfs-fuse in manila-share - built in Kolla COPR
- collectd/telegraf - no opstools repository
- redis - needs a switch to valkey
- python3-ethtool - not required for neutron-mlnx-agent since 6 years [1]

Building packages in Kolla COPR is a temporary solution until these show up
in EPEL10.

[1]: Id2cae3ac9ff049e9fc8225551f99e1e99a87fc65

Depends-On: https://review.opendev.org/c/openstack/kolla-ansible/+/951751

Change-Id: I7074fabcf95184fcfd2561648ae1e05acfb0bc11
Signed-off-by: Michal Nasiadka <mnasiadka@gmail.com>
2025-07-16 14:05:50 +00:00

141 lines
4.6 KiB
Django/Jinja

FROM {{ namespace }}/{{ image_prefix }}base:{{ tag }}
{% block labels %}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
{% endblock %}
{% block kolla_toolbox_header %}{% endblock %}
{% set venv_path='/opt/ansible' %}
{% set os_client_config= venv_path + '/lib/python3/site-packages/os_client_config/defaults.json' %}
{% import "macros.j2" as macros with context %}
{{ macros.configure_user(name='ansible') }}
{{ macros.configure_user(name='rabbitmq') }}
{{ macros.enable_extra_repos(['crb', 'erlang', 'openvswitch', 'rabbitmq']) }}
{% block rabbitmq_apt_preferences %}
{% if base_package_type == 'deb' %}
COPY apt_preferences_rabbitmq.{{ base_distro }} /etc/apt/preferences.d/rabbitmq
{% endif %}
{% endblock %}
{% if base_package_type == 'rpm' %}
{% set kolla_toolbox_packages = [
'erlang-27.*',
'gcc',
'gdisk',
'git',
'jq',
'libffi-devel',
'libxml2-devel',
'libxslt-devel',
'make',
'openssh-clients',
'openssl-devel',
'openvswitch',
'python3',
'python3-devel',
'rabbitmq-server-4.1.*'
] %}
{% elif base_package_type == 'deb' %}
{% set kolla_toolbox_packages = [
'build-essential',
'ca-certificates',
'gdisk',
'git',
'jq',
'libffi-dev',
'libssl-dev',
'libxslt1-dev',
'openvswitch-switch',
'python3-dev',
'python3-venv',
'rabbitmq-server',
] %}
{% endif %}
{{ macros.install_packages(kolla_toolbox_packages | customizable("packages")) }}
{# NOTE(kevko):
In all distros, there is always a /usr/bin/python3 -> python3.X.
However, this is disrupted for RHEL-based systems because, unlike
other distros, we upgrade Python above [1], but we forget to set
the default python3 to the new python3.X. As a result also, everything
outside of the virtual environment ends up running on Python 3.9.
So, let's correctly set python3 -> python3.X since we had to install
it and now have default python3 points to the new version.
[1] https://review.opendev.org/c/openstack/kolla/+/924245
#}
{% if base_package_type == 'rpm' %}
RUN cd /usr/bin && \
rm -f python3 && \
ln -s python3.12 python3
{% endif %}
{% block kolla_toolbox_pip_conf %}
ENV UPPER_CONSTRAINTS_FILE=https://releases.openstack.org/constraints/upper/{{ openstack_release }}
{% endblock %}
{% block kolla_toolbox_upper_constraints %}
RUN mkdir -p /requirements \
&& curl -o /requirements/upper-constraints.txt $UPPER_CONSTRAINTS_FILE \
&& {{ macros.upper_constraints_remove("openstacksdk") }} \
&& python3 -m venv --system-site-packages {{ venv_path }} \
&& KOLLA_DISTRO_PYTHON_VERSION=$(/usr/bin/python3 -c "import sys; print('{}.{}'.format(sys.version_info.major, sys.version_info.minor))") \
&& cd {{ venv_path }}/lib \
&& ln -s python${KOLLA_DISTRO_PYTHON_VERSION} {{ venv_path }}/lib/python3
{% endblock %}
ENV PATH {{ venv_path }}/bin:$PATH
{% set kolla_toolbox_pip_packages = [
'ansible-core==2.18.*',
'cmd2',
'influxdb',
'openstacksdk',
'os-client-config',
'pbr',
'pymysql',
'python-ironicclient',
'python-openstackclient',
'pytz',
'pyudev',
] %}
RUN {{ macros.install_pip(['pip', 'wheel', 'setuptools']) }} \
&& {{ macros.install_pip((kolla_toolbox_pip_packages | customizable("pip_packages"))) }} \
&& mkdir -p /etc/ansible /usr/share/ansible \
&& echo 'localhost ansible_connection=local ansible_python_interpreter={{ venv_path }}/bin/python' > /etc/ansible/hosts \
&& sed -i 's| "identity_api_version": "2.0",| "identity_api_version": "3",|' {{ os_client_config }}
{% block kolla_toolbox_collections_install %}
COPY requirements.yml /var/lib/ansible/
RUN fail=1; for i in $(seq 1 5); do if \
ansible-galaxy collection install --timeout 120 -p /usr/share/ansible/collections -r /var/lib/ansible/requirements.yml \
; then fail=0; break; fi; echo "Collection download failed, retrying"; sleep 5; done; \
if [ "$fail" -eq 1 ]; then exit 1; fi
ENV ANSIBLE_LIBRARY /usr/share/ansible:$ANSIBLE_LIBRARY
{% endblock %}
COPY ansible.cfg /etc/ansible/ansible.cfg
COPY ansible_sudoers /etc/sudoers.d/kolla_ansible_sudoers
COPY extend_start.sh /usr/local/bin/kolla_extend_start
COPY kolla_toolbox.sh /usr/local/bin/kolla_toolbox
RUN chmod 644 /etc/ansible/ansible.cfg \
/usr/local/bin/kolla_extend_start \
&& chmod 755 /usr/local/bin/kolla_toolbox \
&& chmod 440 /etc/sudoers.d/kolla_ansible_sudoers
{{ macros.kolla_patch_sources() }}
{% block kolla_toolbox_footer %}{% endblock %}
{% block footer %}{% endblock %}
USER ansible