aboutsummaryrefslogtreecommitdiff
path: root/docker
diff options
context:
space:
mode:
Diffstat (limited to 'docker')
-rw-r--r--docker/base/Dockerfile.j21
-rw-r--r--docker/horizon/Dockerfile.j22
-rw-r--r--docker/horizon/extend_start.sh2
-rw-r--r--docker/kolla-toolbox/Dockerfile.j232
-rw-r--r--docker/openstack-base/Dockerfile.j24
-rw-r--r--docker/skyline/skyline-apiserver/extend_start.sh2
6 files changed, 31 insertions, 12 deletions
diff --git a/docker/base/Dockerfile.j2 b/docker/base/Dockerfile.j2
index d220eba2c..b3662f893 100644
--- a/docker/base/Dockerfile.j2
+++ b/docker/base/Dockerfile.j2
@@ -23,7 +23,6 @@ LABEL kolla_version="{{ kolla_version }}"
{% block base_header %}{% endblock %}
ENV KOLLA_BASE_DISTRO={{ base_distro }} \
- KOLLA_DISTRO_PYTHON_VERSION={{ distro_python_version }} \
KOLLA_BASE_ARCH={{ base_arch }}
diff --git a/docker/horizon/Dockerfile.j2 b/docker/horizon/Dockerfile.j2
index cec72a177..d9d6b32a5 100644
--- a/docker/horizon/Dockerfile.j2
+++ b/docker/horizon/Dockerfile.j2
@@ -66,7 +66,7 @@ RUN ln -s horizon-source/* horizon \
&& if [ "$(ls /plugins)" ]; then \
{{ macros.install_pip(horizon_plugins_pip_packages) }}; \
fi \
- && for locale in /var/lib/kolla/venv/lib/python{{distro_python_version}}/site-packages/*/locale; do \
+ && for locale in /var/lib/kolla/venv/lib/python3/site-packages/*/locale; do \
(cd ${locale%/*} && /var/lib/kolla/venv/bin/django-admin compilemessages) \
done \
&& chmod 644 /usr/local/bin/kolla_extend_start
diff --git a/docker/horizon/extend_start.sh b/docker/horizon/extend_start.sh
index 5a71d6be1..63a40189d 100644
--- a/docker/horizon/extend_start.sh
+++ b/docker/horizon/extend_start.sh
@@ -5,7 +5,7 @@ set -o errexit
FORCE_GENERATE="${FORCE_GENERATE:-no}"
HASH_PATH=/var/lib/kolla/.settings.md5sum.txt
-SITE_PACKAGES="/var/lib/kolla/venv/lib/python${KOLLA_DISTRO_PYTHON_VERSION}/site-packages"
+SITE_PACKAGES="/var/lib/kolla/venv/lib/python3/site-packages"
MANAGE_PY="/var/lib/kolla/venv/bin/python /var/lib/kolla/venv/bin/manage.py"
diff --git a/docker/kolla-toolbox/Dockerfile.j2 b/docker/kolla-toolbox/Dockerfile.j2
index 7cdc760c8..7a60674af 100644
--- a/docker/kolla-toolbox/Dockerfile.j2
+++ b/docker/kolla-toolbox/Dockerfile.j2
@@ -6,10 +6,7 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build
{% block kolla_toolbox_header %}{% endblock %}
{% set venv_path='/opt/ansible' %}
-{% if base_package_type == 'rpm' %}
- {% set distro_python_version = '3.12' %}
-{% endif %}
-{% set os_client_config= venv_path + '/lib/python' + distro_python_version + '/site-packages/os_client_config/defaults.json' %}
+{% set os_client_config= venv_path + '/lib/python3/site-packages/os_client_config/defaults.json' %}
{% import "macros.j2" as macros with context %}
@@ -63,11 +60,32 @@ COPY apt_preferences_rabbitmq.{{ base_distro }} /etc/apt/preferences.d/rabbitmq
{% 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_upper_constraints %}
RUN mkdir -p /requirements \
&& curl -o /requirements/upper-constraints.txt ${UPPER_CONSTRAINTS_FILE:-https://releases.openstack.org/constraints/upper/{{ openstack_release }}} \
&& {{ macros.upper_constraints_remove("openstacksdk") }} \
- && python{{ distro_python_version }} -m venv --system-site-packages {{ venv_path }}
+ && 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
@@ -86,8 +104,8 @@ ENV PATH {{ venv_path }}/bin:$PATH
'pyudev',
] %}
-RUN {{ macros.install_pip(['pip', 'wheel', 'setuptools'], python_version=distro_python_version) }} \
- && {{ macros.install_pip((kolla_toolbox_pip_packages | customizable("pip_packages")), python_version=distro_python_version) }} \
+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 }}
diff --git a/docker/openstack-base/Dockerfile.j2 b/docker/openstack-base/Dockerfile.j2
index 1df4321e5..f6aebd6ca 100644
--- a/docker/openstack-base/Dockerfile.j2
+++ b/docker/openstack-base/Dockerfile.j2
@@ -195,7 +195,9 @@ RUN ln -s openstack-base-source/* /requirements \
#}
&& {{ macros.upper_constraints_remove("ovs") }} \
&& mkdir -p /var/lib/kolla \
- && python3 -m venv --system-site-packages /var/lib/kolla/venv
+ && python3 -m venv --system-site-packages /var/lib/kolla/venv \
+ && KOLLA_DISTRO_PYTHON_VERSION=$(/usr/bin/python3 -c "import sys; print('{}.{}'.format(sys.version_info.major, sys.version_info.minor))") \
+ && ln -s python${KOLLA_DISTRO_PYTHON_VERSION} /var/lib/kolla/venv/lib/python3
{# Block used for overriding global version constraints.
diff --git a/docker/skyline/skyline-apiserver/extend_start.sh b/docker/skyline/skyline-apiserver/extend_start.sh
index e762106c0..e1802937b 100644
--- a/docker/skyline/skyline-apiserver/extend_start.sh
+++ b/docker/skyline/skyline-apiserver/extend_start.sh
@@ -3,7 +3,7 @@
# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases
# of the KOLLA_BOOTSTRAP variable being set, including empty.
if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
- SITE_PACKAGES="/var/lib/kolla/venv/lib/python${KOLLA_DISTRO_PYTHON_VERSION}/site-packages"
+ SITE_PACKAGES="/var/lib/kolla/venv/lib/python3/site-packages"
pushd ${SITE_PACKAGES}/skyline_apiserver/db/alembic
alembic upgrade head
popd