Skip to content

Commit 233a7df

Browse files
committed
Add OSC plugins to container
This commit changes our container image because it's currently missing almost all the OSC plugins, unlike the `openstackclient` image. In this patch we ensure the image includes the plugins by: * Adding the plugins to the project dependencies in the `osc-plugin` dependency group. * Changing the source for all our openstack related packages, so instead of using PyPi to install them we use RPMs by using the `openstackclient` container image as the base. * We use the Centos 10 base image of the `openstackclient` container so it has Python 3.12 instead of 3.9 that is in the Centos 9 container (quay.io/podified-antelope-centos9/openstack-openstackclient:current-podified) because the MCP python library has a minimum requirement of Python 3.10. This not only resolves the missing plugins, but also ensures that the packages used are not coming from PyPi, facilitating a more secure downstream release. Available plugins are sent as part of the `openstack-cli` MCP tool description to help LLMs know what is installed, as they may assume only basic commands are available. We also update the allowed commands on read-only mode.
1 parent b18c4c7 commit 233a7df

6 files changed

Lines changed: 1971 additions & 1489 deletions

File tree

Containerfile

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
FROM registry.access.redhat.com/ubi9/python-312:latest AS builder
1+
# Use this base image so everything comes from RPM packages (including OSC plugins)
2+
ARG BUILDER_IMAGE=quay.rdoproject.org/podified-master-centos10/openstack-openstackclient:current-tested
3+
ARG BASE_IMAGE=quay.rdoproject.org/podified-master-centos10/openstack-openstackclient:current-tested
4+
5+
FROM $BUILDER_IMAGE AS builder
26

37
WORKDIR /app
48

@@ -8,19 +12,29 @@ COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
812
# Copy dependency manifests and README first (build backend needs README.md).
913
# Dependency layer is reused when only application code changes.
1014
COPY pyproject.toml uv.lock README.md ./
11-
RUN uv sync --frozen --no-dev --no-editable --no-install-project
15+
# Install dependencies but without the packages that come from the base image
16+
RUN uv sync --frozen --no-dev --no-editable --no-install-project \
17+
--no-install-package openstackclient \
18+
--no-install-package python-openstackclient \
19+
--no-install-package stevedore
1220

1321
# Copy application code and install the package into the venv.
1422
COPY src/ src/
15-
RUN uv sync --frozen --no-dev --no-editable
23+
RUN uv sync --frozen --no-dev --no-editable \
24+
--no-install-package openstackclient \
25+
--no-install-package python-openstackclient \
26+
--no-install-package stevedore
27+
28+
# FIX: Manually force the venv to look at system RPM packages at runtime
29+
RUN sed -i 's/include-system-site-packages = false/include-system-site-packages = true/' /app/.venv/pyvenv.cfg
1630

1731
RUN curl -o oc.tar.gz https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable-4.18/openshift-client-linux.tar.gz && \
1832
tar xvf oc.tar.gz oc && \
1933
chmod +x oc && \
2034
rm oc.tar.gz
2135

2236
# Final stage: smaller image without uv or build tools.
23-
FROM registry.access.redhat.com/ubi9/python-312:latest
37+
FROM $BASE_IMAGE
2438

2539
LABEL com.redhat.component="rhos-ls-mcps" \
2640
name="openstack-lightspeed/rhos-mcps" \

pyproject.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ dev = [
2525
"pre-commit>=4.6.0"
2626
]
2727

28+
osc-plugins = [
29+
"osc-placement",
30+
"python-barbicanclient",
31+
"python-designateclient",
32+
"python-glanceclient",
33+
"python-heatclient",
34+
"python-ironicclient",
35+
"python-ironic-inspector-client",
36+
"python-manilaclient",
37+
"python-observabilityclient",
38+
"python-octaviaclient",
39+
"aodhclient",
40+
"python-cloudkittyclient",
41+
"python-watcherclient",
42+
]
43+
2844
[build-system]
2945
requires = ["uv_build>=0.11.16,<0.12"]
3046
build-backend = "uv_build"

scripts/allow-deny-list.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@
151151
"metric_benchmark measures add",
152152
"metric_measures_batch-metrics",
153153
"metric_measures_batch-resources-metrics",
154+
"metric_clean-tombstones",
155+
"metric_snapshot",
156+
"rating_scope_patch",
157+
"share_service_ensure_shares",
158+
"share_replica_resync",
154159
# This sounds intrusive: https://docs.openstack.org/senlin/rocky/user/nodes.html#checking-a-node
155160
"cluster_node_check",
156161
}
@@ -183,6 +188,11 @@
183188
"workflow_engine_",
184189
"data_processing_",
185190
"orchestration_",
191+
"observabilityclient_",
192+
"placement_",
193+
"share_",
194+
"alarm_",
195+
"rating_",
186196
}
187197

188198

0 commit comments

Comments
 (0)