Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 115 additions & 0 deletions containers/aodh/aodh-api/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
ARG BASE_IMAGE=localhost/openstack/openstack-base:latest

# --- Build stage: compile wheels and collect upstream config ---
FROM ${BASE_IMAGE} AS build

ARG SERVICE_SRC=/src/aodh

ARG CONSTRAINTS_FILE=requirements.lock
COPY ${CONSTRAINTS_FILE} /deps-upper-constraints.txt
COPY src/ /src/
COPY aodh-api/src/ /src/

ARG PIP_NO_BINARY=""
ENV PIP_NO_BINARY=${PIP_NO_BINARY}

COPY aodh-api/builddeps.txt /tmp/builddeps.txt
RUN pkgs=$(cat /tmp/builddeps.txt | grep -v '^#' | grep -v '^$' | tr '\n' ' ') && \
if [ -n "${pkgs}" ]; then microdnf -y install ${pkgs} && microdnf clean all; fi

COPY aodh-api/pythonbuilddeps.txt /tmp/pythonbuilddeps.txt
RUN pkgs=$(cat /tmp/pythonbuilddeps.txt | grep -v '^#' | grep -v '^$' | tr '\n' ' ') && \
if [ -n "${pkgs}" ]; then pip3 install --no-cache-dir -c /deps-upper-constraints.txt ${pkgs}; fi && \
rm /tmp/pythonbuilddeps.txt

RUN cp /deps-upper-constraints.txt /tmp/build-constraints.txt && \
for src_dir in /src/*/ /src/overrides/*/; do \
if [ -d "${src_dir}" ] && [ -f "${src_dir}/setup.cfg" ]; then \
pkg_name=$(grep -m1 '^name' "${src_dir}/setup.cfg" | sed 's/.*=\s*//'); \
sed -i "/^${pkg_name}[=!<>]/Id" /tmp/build-constraints.txt; \
fi; \
done

RUN for pkg in /src/*/ /src/overrides/*/; do \
if [ -d "${pkg}" ] && [ -f "${pkg}/setup.cfg" -o -f "${pkg}/setup.py" -o -f "${pkg}/pyproject.toml" ]; then \
pip3 wheel --no-cache-dir --no-deps \
--wheel-dir=/wheels/pkgs "${pkg}"; \
fi; \
done

RUN pip3 wheel --no-cache-dir --no-deps \
--find-links=/wheels/pkgs \
--wheel-dir=/wheels/deps -r /deps-upper-constraints.txt

RUN for src_dir in /src/*/ /src/overrides/*/; do \
if [ -d "${src_dir}" ] && [ -f "${src_dir}/setup.cfg" ]; then \
pkg_name=$(grep -m1 '^name' "${src_dir}/setup.cfg" | sed 's/.*=\s*//'); \
commit=$(git -C "${src_dir}" rev-parse HEAD 2>/dev/null || echo "unknown"); \
version=$(ls /wheels/pkgs/${pkg_name//-/_}-*.whl 2>/dev/null | head -1 | sed 's/.*-\([0-9][^-]*\)-.*/\1/' || echo "unknown"); \
echo "${pkg_name},${commit},${version}"; \
fi; \
done > /source-built-packages.txt

RUN pip3 install --no-cache-dir --prefix=/usr \
-c /tmp/build-constraints.txt \
--find-links=/wheels/deps \
--find-links=/wheels/pkgs \
/wheels/pkgs/*.whl

RUN mkdir -p /configfiles/etc/aodh && \
oslo-config-generator \
--config-file ${SERVICE_SRC}/etc/aodh/aodh-config-generator.conf \
--output-file /configfiles/etc/aodh/aodh.conf && \
sed -i "/#pybasedir.*/d" /configfiles/etc/aodh/aodh.conf && \
cp -a ${SERVICE_SRC}/aodh/api/api-paste.ini /configfiles/etc/aodh/api-paste.ini

# --- Runtime stage: install from wheels ---
FROM ${BASE_IMAGE}

LABEL summary="OpenStack Aodh API" \
io.k8s.description="Aodh API container built from source with kolla interface"

# Use system CA bundle: SSL_CERT_FILE for OpenSSL/stdlib, REQUESTS_CA_BUNDLE for requests/certifi
ENV SSL_CERT_FILE=/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
ENV REQUESTS_CA_BUNDLE=/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem

RUN uid_gid_manage aodh

COPY aodh-api/bindeps.txt /tmp/bindeps.txt
RUN pkgs=$(cat /tmp/bindeps.txt | grep -v '^#' | grep -v '^$' | tr '\n' ' ') && \
if [ -n "${pkgs}" ]; then microdnf -y install ${pkgs} && microdnf clean all; fi && rm /tmp/bindeps.txt

COPY --from=build /wheels /wheels
COPY --from=build /tmp/build-constraints.txt /deps-upper-constraints.txt
COPY --from=build /source-built-packages.txt /source-built-packages.txt
COPY aodh-api/pythondeps.txt /tmp/pythondeps.txt
RUN extrapkgs=$(cat /tmp/pythondeps.txt | grep -v '^#' | grep -v '^$' | tr '\n' ' ') && \
pip3 install --no-cache-dir --prefix=/usr \
-c /deps-upper-constraints.txt \
--find-links=/wheels/deps \
--find-links=/wheels/pkgs \
/wheels/pkgs/*.whl ${extrapkgs} && \
rm -rf /wheels /tmp/pythondeps.txt

RUN mkdir -p /etc/aodh /var/log/aodh /var/lib/aodh /var/lib/aodh/tmp /usr/share/aodh && \
chmod 750 /var/log/aodh && \
chown -R aodh:aodh /var/lib/aodh && \
chown -R aodh:root /var/log/aodh

COPY --from=build /configfiles/etc/aodh/aodh.conf /etc/aodh/aodh.conf
COPY --from=build /configfiles/etc/aodh/api-paste.ini /etc/aodh/api-paste.ini
COPY common/config/usr/share/aodh/aodh-dist.conf /usr/share/aodh/aodh-dist.conf

RUN chmod 640 /etc/aodh/aodh.conf /etc/aodh/api-paste.ini && \
chmod 640 /usr/share/aodh/aodh-dist.conf && \
chown -R root:aodh /etc/aodh /usr/share/aodh

# Apache httpd setup for WSGI
RUN mkdir -p /var/www/cgi-bin/aodh && \
chmod 755 /var/www/cgi-bin/aodh && \
cp -a /usr/bin/aodh-api /var/www/cgi-bin/aodh/ && \
sed -i -r 's,^(Listen 80),#\1,' /etc/httpd/conf/httpd.conf && \
sed -i -r 's,^(Listen 443),#\1,' /etc/httpd/conf.d/ssl.conf && \
usermod --append --groups apache aodh

USER aodh
5 changes: 5 additions & 0 deletions containers/aodh/aodh-api/bindeps.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
python3
python3-pip
httpd
mod_ssl
python3-mod_wsgi
9 changes: 9 additions & 0 deletions containers/aodh/aodh-api/builddeps.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
git-core
gcc
gcc-c++
python3-devel
python3-setuptools
libffi-devel
openssl-devel
libxml2-devel
libxslt-devel
2 changes: 2 additions & 0 deletions containers/aodh/aodh-api/pythonbuilddeps.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pbr
wheel
5 changes: 5 additions & 0 deletions containers/aodh/aodh-api/pythondeps.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Database driver (mysql extra for oslo.db)
oslo.db[mysql]

# Required by keystonemiddleware for memcache-based token caching
python-memcached
Empty file.
107 changes: 107 additions & 0 deletions containers/aodh/aodh-evaluator/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
ARG BASE_IMAGE=localhost/openstack/openstack-base:latest

# --- Build stage: compile wheels and collect upstream config ---
FROM ${BASE_IMAGE} AS build

ARG SERVICE_SRC=/src/aodh

ARG CONSTRAINTS_FILE=requirements.lock
COPY ${CONSTRAINTS_FILE} /deps-upper-constraints.txt
COPY src/ /src/
COPY aodh-evaluator/src/ /src/

ARG PIP_NO_BINARY=""
ENV PIP_NO_BINARY=${PIP_NO_BINARY}

COPY aodh-evaluator/builddeps.txt /tmp/builddeps.txt
RUN pkgs=$(cat /tmp/builddeps.txt | grep -v '^#' | grep -v '^$' | tr '\n' ' ') && \
if [ -n "${pkgs}" ]; then microdnf -y install ${pkgs} && microdnf clean all; fi

COPY aodh-evaluator/pythonbuilddeps.txt /tmp/pythonbuilddeps.txt
RUN pkgs=$(cat /tmp/pythonbuilddeps.txt | grep -v '^#' | grep -v '^$' | tr '\n' ' ') && \
if [ -n "${pkgs}" ]; then pip3 install --no-cache-dir -c /deps-upper-constraints.txt ${pkgs}; fi && \
rm /tmp/pythonbuilddeps.txt

RUN cp /deps-upper-constraints.txt /tmp/build-constraints.txt && \
for src_dir in /src/*/ /src/overrides/*/; do \
if [ -d "${src_dir}" ] && [ -f "${src_dir}/setup.cfg" ]; then \
pkg_name=$(grep -m1 '^name' "${src_dir}/setup.cfg" | sed 's/.*=\s*//'); \
sed -i "/^${pkg_name}[=!<>]/Id" /tmp/build-constraints.txt; \
fi; \
done

RUN for pkg in /src/*/ /src/overrides/*/; do \
if [ -d "${pkg}" ] && [ -f "${pkg}/setup.cfg" -o -f "${pkg}/setup.py" -o -f "${pkg}/pyproject.toml" ]; then \
pip3 wheel --no-cache-dir --no-deps \
--wheel-dir=/wheels/pkgs "${pkg}"; \
fi; \
done

RUN pip3 wheel --no-cache-dir --no-deps \
--find-links=/wheels/pkgs \
--wheel-dir=/wheels/deps -r /deps-upper-constraints.txt

RUN for src_dir in /src/*/ /src/overrides/*/; do \
if [ -d "${src_dir}" ] && [ -f "${src_dir}/setup.cfg" ]; then \
pkg_name=$(grep -m1 '^name' "${src_dir}/setup.cfg" | sed 's/.*=\s*//'); \
commit=$(git -C "${src_dir}" rev-parse HEAD 2>/dev/null || echo "unknown"); \
version=$(ls /wheels/pkgs/${pkg_name//-/_}-*.whl 2>/dev/null | head -1 | sed 's/.*-\([0-9][^-]*\)-.*/\1/' || echo "unknown"); \
echo "${pkg_name},${commit},${version}"; \
fi; \
done > /source-built-packages.txt

RUN pip3 install --no-cache-dir --prefix=/usr \
-c /tmp/build-constraints.txt \
--find-links=/wheels/deps \
--find-links=/wheels/pkgs \
/wheels/pkgs/*.whl

RUN mkdir -p /configfiles/etc/aodh && \
oslo-config-generator \
--config-file ${SERVICE_SRC}/etc/aodh/aodh-config-generator.conf \
--output-file /configfiles/etc/aodh/aodh.conf && \
sed -i "/#pybasedir.*/d" /configfiles/etc/aodh/aodh.conf && \
cp -a ${SERVICE_SRC}/aodh/api/api-paste.ini /configfiles/etc/aodh/api-paste.ini

# --- Runtime stage: install from wheels ---
FROM ${BASE_IMAGE}

LABEL summary="OpenStack Aodh Evaluator" \
io.k8s.description="Aodh evaluator container built from source with kolla interface"

# Use system CA bundle: SSL_CERT_FILE for OpenSSL/stdlib, REQUESTS_CA_BUNDLE for requests/certifi
ENV SSL_CERT_FILE=/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
ENV REQUESTS_CA_BUNDLE=/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem

RUN uid_gid_manage aodh

COPY aodh-evaluator/bindeps.txt /tmp/bindeps.txt
RUN pkgs=$(cat /tmp/bindeps.txt | grep -v '^#' | grep -v '^$' | tr '\n' ' ') && \
if [ -n "${pkgs}" ]; then microdnf -y install ${pkgs} && microdnf clean all; fi && rm /tmp/bindeps.txt

COPY --from=build /wheels /wheels
COPY --from=build /tmp/build-constraints.txt /deps-upper-constraints.txt
COPY --from=build /source-built-packages.txt /source-built-packages.txt
COPY aodh-evaluator/pythondeps.txt /tmp/pythondeps.txt
RUN extrapkgs=$(cat /tmp/pythondeps.txt | grep -v '^#' | grep -v '^$' | tr '\n' ' ') && \
pip3 install --no-cache-dir --prefix=/usr \
-c /deps-upper-constraints.txt \
--find-links=/wheels/deps \
--find-links=/wheels/pkgs \
/wheels/pkgs/*.whl ${extrapkgs} && \
rm -rf /wheels /tmp/pythondeps.txt

RUN mkdir -p /etc/aodh /var/log/aodh /var/lib/aodh /var/lib/aodh/tmp /usr/share/aodh && \
chmod 750 /var/log/aodh && \
chown -R aodh:aodh /var/lib/aodh && \
chown -R aodh:root /var/log/aodh

COPY --from=build /configfiles/etc/aodh/aodh.conf /etc/aodh/aodh.conf
COPY --from=build /configfiles/etc/aodh/api-paste.ini /etc/aodh/api-paste.ini
COPY common/config/usr/share/aodh/aodh-dist.conf /usr/share/aodh/aodh-dist.conf

RUN chmod 640 /etc/aodh/aodh.conf /etc/aodh/api-paste.ini && \
chmod 640 /usr/share/aodh/aodh-dist.conf && \
chown -R root:aodh /etc/aodh /usr/share/aodh

USER aodh
2 changes: 2 additions & 0 deletions containers/aodh/aodh-evaluator/bindeps.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
python3
python3-pip
9 changes: 9 additions & 0 deletions containers/aodh/aodh-evaluator/builddeps.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
git-core
gcc
gcc-c++
python3-devel
python3-setuptools
libffi-devel
openssl-devel
libxml2-devel
libxslt-devel
2 changes: 2 additions & 0 deletions containers/aodh/aodh-evaluator/pythonbuilddeps.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pbr
wheel
2 changes: 2 additions & 0 deletions containers/aodh/aodh-evaluator/pythondeps.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Database driver (mysql extra for oslo.db)
oslo.db[mysql]
Empty file.
107 changes: 107 additions & 0 deletions containers/aodh/aodh-expirer/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
ARG BASE_IMAGE=localhost/openstack/openstack-base:latest

# --- Build stage: compile wheels and collect upstream config ---
FROM ${BASE_IMAGE} AS build

ARG SERVICE_SRC=/src/aodh

ARG CONSTRAINTS_FILE=requirements.lock
COPY ${CONSTRAINTS_FILE} /deps-upper-constraints.txt
COPY src/ /src/
COPY aodh-expirer/src/ /src/

ARG PIP_NO_BINARY=""
ENV PIP_NO_BINARY=${PIP_NO_BINARY}

COPY aodh-expirer/builddeps.txt /tmp/builddeps.txt
RUN pkgs=$(cat /tmp/builddeps.txt | grep -v '^#' | grep -v '^$' | tr '\n' ' ') && \
if [ -n "${pkgs}" ]; then microdnf -y install ${pkgs} && microdnf clean all; fi

COPY aodh-expirer/pythonbuilddeps.txt /tmp/pythonbuilddeps.txt
RUN pkgs=$(cat /tmp/pythonbuilddeps.txt | grep -v '^#' | grep -v '^$' | tr '\n' ' ') && \
if [ -n "${pkgs}" ]; then pip3 install --no-cache-dir -c /deps-upper-constraints.txt ${pkgs}; fi && \
rm /tmp/pythonbuilddeps.txt

RUN cp /deps-upper-constraints.txt /tmp/build-constraints.txt && \
for src_dir in /src/*/ /src/overrides/*/; do \
if [ -d "${src_dir}" ] && [ -f "${src_dir}/setup.cfg" ]; then \
pkg_name=$(grep -m1 '^name' "${src_dir}/setup.cfg" | sed 's/.*=\s*//'); \
sed -i "/^${pkg_name}[=!<>]/Id" /tmp/build-constraints.txt; \
fi; \
done

RUN for pkg in /src/*/ /src/overrides/*/; do \
if [ -d "${pkg}" ] && [ -f "${pkg}/setup.cfg" -o -f "${pkg}/setup.py" -o -f "${pkg}/pyproject.toml" ]; then \
pip3 wheel --no-cache-dir --no-deps \
--wheel-dir=/wheels/pkgs "${pkg}"; \
fi; \
done

RUN pip3 wheel --no-cache-dir --no-deps \
--find-links=/wheels/pkgs \
--wheel-dir=/wheels/deps -r /deps-upper-constraints.txt

RUN for src_dir in /src/*/ /src/overrides/*/; do \
if [ -d "${src_dir}" ] && [ -f "${src_dir}/setup.cfg" ]; then \
pkg_name=$(grep -m1 '^name' "${src_dir}/setup.cfg" | sed 's/.*=\s*//'); \
commit=$(git -C "${src_dir}" rev-parse HEAD 2>/dev/null || echo "unknown"); \
version=$(ls /wheels/pkgs/${pkg_name//-/_}-*.whl 2>/dev/null | head -1 | sed 's/.*-\([0-9][^-]*\)-.*/\1/' || echo "unknown"); \
echo "${pkg_name},${commit},${version}"; \
fi; \
done > /source-built-packages.txt

RUN pip3 install --no-cache-dir --prefix=/usr \
-c /tmp/build-constraints.txt \
--find-links=/wheels/deps \
--find-links=/wheels/pkgs \
/wheels/pkgs/*.whl

RUN mkdir -p /configfiles/etc/aodh && \
oslo-config-generator \
--config-file ${SERVICE_SRC}/etc/aodh/aodh-config-generator.conf \
--output-file /configfiles/etc/aodh/aodh.conf && \
sed -i "/#pybasedir.*/d" /configfiles/etc/aodh/aodh.conf && \
cp -a ${SERVICE_SRC}/aodh/api/api-paste.ini /configfiles/etc/aodh/api-paste.ini

# --- Runtime stage: install from wheels ---
FROM ${BASE_IMAGE}

LABEL summary="OpenStack Aodh Expirer" \
io.k8s.description="Aodh expirer container built from source with kolla interface"

# Use system CA bundle: SSL_CERT_FILE for OpenSSL/stdlib, REQUESTS_CA_BUNDLE for requests/certifi
ENV SSL_CERT_FILE=/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
ENV REQUESTS_CA_BUNDLE=/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem

RUN uid_gid_manage aodh

COPY aodh-expirer/bindeps.txt /tmp/bindeps.txt
RUN pkgs=$(cat /tmp/bindeps.txt | grep -v '^#' | grep -v '^$' | tr '\n' ' ') && \
if [ -n "${pkgs}" ]; then microdnf -y install ${pkgs} && microdnf clean all; fi && rm /tmp/bindeps.txt

COPY --from=build /wheels /wheels
COPY --from=build /tmp/build-constraints.txt /deps-upper-constraints.txt
COPY --from=build /source-built-packages.txt /source-built-packages.txt
COPY aodh-expirer/pythondeps.txt /tmp/pythondeps.txt
RUN extrapkgs=$(cat /tmp/pythondeps.txt | grep -v '^#' | grep -v '^$' | tr '\n' ' ') && \
pip3 install --no-cache-dir --prefix=/usr \
-c /deps-upper-constraints.txt \
--find-links=/wheels/deps \
--find-links=/wheels/pkgs \
/wheels/pkgs/*.whl ${extrapkgs} && \
rm -rf /wheels /tmp/pythondeps.txt

RUN mkdir -p /etc/aodh /var/log/aodh /var/lib/aodh /var/lib/aodh/tmp /usr/share/aodh && \
chmod 750 /var/log/aodh && \
chown -R aodh:aodh /var/lib/aodh && \
chown -R aodh:root /var/log/aodh

COPY --from=build /configfiles/etc/aodh/aodh.conf /etc/aodh/aodh.conf
COPY --from=build /configfiles/etc/aodh/api-paste.ini /etc/aodh/api-paste.ini
COPY common/config/usr/share/aodh/aodh-dist.conf /usr/share/aodh/aodh-dist.conf

RUN chmod 640 /etc/aodh/aodh.conf /etc/aodh/api-paste.ini && \
chmod 640 /usr/share/aodh/aodh-dist.conf && \
chown -R root:aodh /etc/aodh /usr/share/aodh

USER aodh
2 changes: 2 additions & 0 deletions containers/aodh/aodh-expirer/bindeps.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
python3
python3-pip
12 changes: 12 additions & 0 deletions containers/aodh/aodh-expirer/builddeps.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
git-core
gcc
gcc-c++
python3-devel
python3-setuptools
libffi-devel
openssl-devel
# psycopg2 C extension
libpq-devel
# lxml C extension
libxml2-devel
libxslt-devel
2 changes: 2 additions & 0 deletions containers/aodh/aodh-expirer/pythonbuilddeps.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pbr
wheel
2 changes: 2 additions & 0 deletions containers/aodh/aodh-expirer/pythondeps.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# MySQL driver for oslo.db
oslo.db[mysql]
Loading
Loading