mirror of
https://github.com/malarinv/iperf3-monitor.git
synced 2026-03-08 05:22:35 +00:00
Compare commits
4 Commits
fix_rbac
...
exporter-e
| Author | SHA1 | Date | |
|---|---|---|---|
| 77daeee1ca | |||
| e54a02ad8c | |||
| 0a3249f30b | |||
| 1eeb4b20df |
@@ -20,7 +20,7 @@ spec:
|
||||
serviceAccountName: {{ include "iperf3-monitor.serviceAccountName" . }}
|
||||
containers:
|
||||
- name: iperf3-exporter
|
||||
image: "{{ .Values.exporter.image.repository }}:{{ .Values.exporter.image.tag | default .Chart.AppVersion }}"
|
||||
image: "{{ .Values.exporter.image.repository }}:{{ .Values.exporter.image.tag | default (printf "v%s" .Chart.AppVersion) }}"
|
||||
imagePullPolicy: {{ .Values.exporter.image.pullPolicy }}
|
||||
ports:
|
||||
- containerPort: {{ .Values.service.targetPort }}
|
||||
|
||||
@@ -5,25 +5,13 @@ FROM python:3.9-slim as builder
|
||||
ARG TARGETARCH
|
||||
WORKDIR /app
|
||||
|
||||
# Install iperf3 and build dependencies
|
||||
# Minimal dependencies for builder stage if any Python packages had C extensions.
|
||||
# Assuming requirements.txt does not need gcc or other build tools for now.
|
||||
# If pip install fails later, add necessary build tools (e.g., gcc, python3-dev) here.
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends gcc iperf3 libiperf-dev && \
|
||||
# apt-get install -y --no-install-recommends gcc python3-dev # Example if needed
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Determine the correct libiperf source directory based on TARGETARCH
|
||||
# and copy libiperf.so.0 to a canonical temporary location /tmp/lib/ within the builder stage.
|
||||
RUN echo "Builder stage TARGETARCH: ${TARGETARCH}" && \
|
||||
LIBIPERF_SRC_DIR_SEGMENT="" && \
|
||||
if [ "${TARGETARCH}" = "amd64" ]; then \
|
||||
LIBIPERF_SRC_DIR_SEGMENT="x86_64-linux-gnu"; \
|
||||
elif [ "${TARGETARCH}" = "arm64" ]; then \
|
||||
LIBIPERF_SRC_DIR_SEGMENT="aarch64-linux-gnu"; \
|
||||
else \
|
||||
echo "Unsupported TARGETARCH in builder: ${TARGETARCH}" && exit 1; \
|
||||
fi && \
|
||||
mkdir -p /tmp/lib && \
|
||||
cp "/usr/lib/${LIBIPERF_SRC_DIR_SEGMENT}/libiperf.so.0" /tmp/lib/libiperf.so.0
|
||||
|
||||
# Install Python dependencies
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
@@ -33,11 +21,11 @@ FROM python:3.9-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy iperf3 binary from the builder stage
|
||||
COPY --from=builder /usr/bin/iperf3 /usr/bin/iperf3
|
||||
# Copy the prepared libiperf.so.0 from the builder's canonical temporary location
|
||||
# into a standard library path in the final image.
|
||||
COPY --from=builder /tmp/lib/libiperf.so.0 /usr/lib/libiperf.so.0
|
||||
# Install iperf3 and its runtime dependency libsctp1 directly in the final stage.
|
||||
# This simplifies the Dockerfile by removing the need to copy iperf3 components from the builder.
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends iperf3 libsctp1 && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy installed Python packages from the builder stage
|
||||
COPY --from=builder /usr/local/lib/python3.9/site-packages /usr/local/lib/python3.9/site-packages
|
||||
@@ -49,4 +37,4 @@ COPY exporter.py .
|
||||
EXPOSE 9876
|
||||
|
||||
# Set the entrypoint
|
||||
CMD ["python", "exporter.py"]
|
||||
CMD ["python", "exporter.py"]
|
||||
|
||||
Reference in New Issue
Block a user