Skip to content

Commit

Permalink
dockerfile: comment out iptables-wrapper
Browse files Browse the repository at this point in the history
We don't need it on RHEL because we know the iptables mode we support,
nft.

The wrapper provides an easy way to support both "legacy" and "nft"
modes when you don't know the system the container will run in.

RHEL only supports nft, so there is no point in supporting legacy
through the wrapper.

See docs at
https://github.com/kubernetes-sigs/iptables-wrappers
  • Loading branch information
spotlesstofu authored and littlejawa committed Feb 7, 2025
1 parent 3628d91 commit 1c56c07
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions src/cloud-api-adaptor/Dockerfile.openshift
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ USER root
# the build process assumes go is under "/go", so let's make sure it works
RUN ln -s /opt/app-root/src/go /go
RUN go install github.com/mikefarah/yq/v4@$YQ_VERSION

# This registering RHEL when building on an unsubscribed system
# If you are running a UBI container on a registered and subscribed RHEL host,
# If you are running a UBI container on a registered and subscribed RHEL host,
# the main RHEL Server repository is enabled inside the standard UBI container.
RUN if command -v subscription-manager; then \
REPO_ARCH=$(uname -m) && \
Expand Down Expand Up @@ -63,19 +62,19 @@ ENV BUILTIN_CLOUD_PROVIDERS="strictfipsruntime aws azure ibmcloud vsphere libvir
ENV PATH=/opt/app-root/src/go/bin:$PATH
RUN CC=gcc make ARCH=$TARGETARCH COMMIT=$COMMIT VERSION=$VERSION RELEASE_BUILD=$RELEASE_BUILD cloud-api-adaptor

FROM builder-release AS iptables

# FROM builder-release AS iptables
#
#ARG TARGETARCH

WORKDIR /iptables
ENV PATH=/opt/app-root/src/go/bin:$PATH
RUN --mount=type=bind,target=/versions.yaml,source=cloud-api-adaptor/versions.yaml,readonly \
version=$(yq -r .tools.iptables-wrapper /versions.yaml) && \
GOARCH=$TARGETARCH go install "github.com/kubernetes-sigs/iptables-wrappers@$version" && \
shopt -s globstar && \
cp /go/bin/**/iptables-wrappers ./iptables-wrapper && \
curl -L -o iptables-wrapper-installer.sh "https://raw.githubusercontent.com/kubernetes-sigs/iptables-wrappers/${version#v*-*-}/iptables-wrapper-installer.sh" && \
chmod 755 iptables-wrapper-installer.sh
#
# WORKDIR /iptables
# ENV PATH=/opt/app-root/src/go/bin:$PATH
# RUN --mount=type=bind,target=/versions.yaml,source=cloud-api-adaptor/versions.yaml,readonly \
# version=$(yq -r .tools.iptables-wrapper /versions.yaml) && \
# GOARCH=$TARGETARCH go install "github.com/kubernetes-sigs/iptables-wrappers@$version" && \
# shopt -s globstar && \
# cp /go/bin/**/iptables-wrappers ./iptables-wrapper && \
# curl -L -o iptables-wrapper-installer.sh "https://raw.githubusercontent.com/kubernetes-sigs/iptables-wrappers/${version#v*-*-}/iptables-wrapper-installer.sh" && \
# chmod 755 iptables-wrapper-installer.sh

FROM registry.access.redhat.com/ubi9/ubi:9.5 AS base-release
USER root
Expand All @@ -87,10 +86,9 @@ RUN if command -v subscription-manager; then \
dnf -y install 'dnf-command(config-manager)' && dnf config-manager --enable crb; \
fi

RUN dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm -y
RUN dnf install -y iptables iptables-legacy iptables-nft nftables && dnf clean all
RUN --mount=type=cache,target=/iptables,from=iptables,source=/iptables,readonly \
cd /iptables && ./iptables-wrapper-installer.sh --no-sanity-check --no-cleanup
RUN dnf install -y iptables iptables-nft nftables && dnf clean all
# RUN --mount=type=cache,target=/iptables,from=iptables,source=/iptables,readonly \
# cd /iptables && ./iptables-wrapper-installer.sh --no-sanity-check --no-cleanup

#FROM base-release AS base-dev
RUN dnf install -y libvirt-libs /usr/bin/ssh && dnf clean all
Expand Down

0 comments on commit 1c56c07

Please sign in to comment.