Skip to content
Open
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
36 changes: 9 additions & 27 deletions Dockerfile.openshift
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,21 @@ ADD . /go/src/github.com/openshift/whereabouts
WORKDIR /go/src/github.com/openshift/whereabouts
ENV CGO_ENABLED=1
ENV GO111MODULE=on
RUN go build -mod vendor -o bin/whereabouts cmd/whereabouts.go
RUN go build -mod vendor -o bin/ip-control-loop cmd/controlloop/controlloop.go
RUN go build -mod vendor -o bin/node-slice-controller cmd/nodeslicecontroller/node_slice_controller.go
WORKDIR /

FROM registry.ci.openshift.org/ocp/builder:rhel-8-golang-1.24-openshift-4.20 AS rhel8
ADD . /go/src/github.com/openshift/whereabouts
WORKDIR /go/src/github.com/openshift/whereabouts
ENV CGO_ENABLED=1
ENV GO111MODULE=on
RUN go build -mod vendor -o bin/whereabouts cmd/whereabouts.go
RUN go build -mod vendor -o bin/ip-control-loop cmd/controlloop/controlloop.go
RUN go build -mod vendor -o bin/node-slice-controller cmd/nodeslicecontroller/node_slice_controller.go
RUN go build -mod vendor -ldflags '-s -w' -o bin/whereabouts cmd/whereabouts.go
RUN go build -mod vendor -ldflags '-s -w' -o bin/ip-control-loop cmd/controlloop/controlloop.go
RUN go build -mod vendor -ldflags '-s -w' -o bin/node-slice-controller cmd/nodeslicecontroller/node_slice_controller.go
WORKDIR /

FROM registry.ci.openshift.org/ocp/4.20:base-rhel9
RUN mkdir -p /usr/src/whereabouts/images && \
mkdir -p /usr/src/whereabouts/bin && \
mkdir -p /usr/src/whereabouts/rhel9/bin && \
mkdir -p /usr/src/whereabouts/rhel8/bin
COPY --from=rhel8 /go/src/github.com/openshift/whereabouts/entrypoint.sh /usr/src/whereabouts/bin
COPY --from=rhel8 /go/src/github.com/openshift/whereabouts/bin/whereabouts /usr/src/whereabouts/bin
COPY --from=rhel8 /go/src/github.com/openshift/whereabouts/bin/ip-control-loop /usr/src/whereabouts/bin
COPY --from=rhel8 /go/src/github.com/openshift/whereabouts/bin/node-slice-controller /usr/src/whereabouts/bin
COPY --from=rhel9 /go/src/github.com/openshift/whereabouts/bin/whereabouts /usr/src/whereabouts/rhel9/bin
COPY --from=rhel9 /go/src/github.com/openshift/whereabouts/bin/ip-control-loop /usr/src/whereabouts/rhel9/bin
COPY --from=rhel9 /go/src/github.com/openshift/whereabouts/bin/node-slice-controller /usr/src/whereabouts/rhel9/bin
COPY --from=rhel8 /go/src/github.com/openshift/whereabouts/bin/whereabouts /usr/src/whereabouts/rhel8/bin
COPY --from=rhel8 /go/src/github.com/openshift/whereabouts/bin/ip-control-loop /usr/src/whereabouts/rhel8/bin
COPY --from=rhel8 /go/src/github.com/openshift/whereabouts/bin/node-slice-controller /usr/src/whereabouts/rhel8/bin
mkdir -p /usr/src/whereabouts/bin
COPY --from=rhel9 /go/src/github.com/openshift/whereabouts/entrypoint.sh /usr/src/whereabouts/bin
COPY --from=rhel9 /go/src/github.com/openshift/whereabouts/bin/whereabouts /usr/src/whereabouts/bin
COPY --from=rhel9 /go/src/github.com/openshift/whereabouts/bin/ip-control-loop /usr/src/whereabouts/bin
COPY --from=rhel9 /go/src/github.com/openshift/whereabouts/bin/node-slice-controller /usr/src/whereabouts/bin
Comment on lines 12 to +17

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Missing rhel9/bin and rhel10/bin hardlink directories causes runtime failure.

The entrypoint.sh resolves the binary path as /usr/src/whereabouts/rhel${rhelmajor}/bin/ip-control-loop, but this Dockerfile only creates /usr/src/whereabouts/bin/. The container will fail at runtime with "No such file or directory" for all RHEL versions (9, 10, and 8 for Fedora CoreOS).

The PR objectives and test plan mention creating hardlinks for rhel9/bin and rhel10/bin, but this is not implemented.

🐛 Proposed fix to add hardlink directories
 RUN mkdir -p /usr/src/whereabouts/images && \
        mkdir -p /usr/src/whereabouts/bin
 COPY --from=rhel9 /go/src/github.com/openshift/whereabouts/entrypoint.sh       /usr/src/whereabouts/bin
 COPY --from=rhel9 /go/src/github.com/openshift/whereabouts/bin/whereabouts     /usr/src/whereabouts/bin
 COPY --from=rhel9 /go/src/github.com/openshift/whereabouts/bin/ip-control-loop /usr/src/whereabouts/bin
 COPY --from=rhel9 /go/src/github.com/openshift/whereabouts/bin/node-slice-controller /usr/src/whereabouts/bin
+RUN mkdir -p /usr/src/whereabouts/rhel9/bin && \
+    ln /usr/src/whereabouts/bin/whereabouts     /usr/src/whereabouts/rhel9/bin/whereabouts && \
+    ln /usr/src/whereabouts/bin/ip-control-loop /usr/src/whereabouts/rhel9/bin/ip-control-loop && \
+    ln /usr/src/whereabouts/bin/node-slice-controller /usr/src/whereabouts/rhel9/bin/node-slice-controller
+RUN mkdir -p /usr/src/whereabouts/rhel10/bin && \
+    ln /usr/src/whereabouts/bin/whereabouts     /usr/src/whereabouts/rhel10/bin/whereabouts && \
+    ln /usr/src/whereabouts/bin/ip-control-loop /usr/src/whereabouts/rhel10/bin/ip-control-loop && \
+    ln /usr/src/whereabouts/bin/node-slice-controller /usr/src/whereabouts/rhel10/bin/node-slice-controller

For rhel8/Fedora CoreOS compatibility (as flagged in a previous review), also add:

+RUN mkdir -p /usr/src/whereabouts/rhel8/bin && \
+    ln /usr/src/whereabouts/bin/whereabouts     /usr/src/whereabouts/rhel8/bin/whereabouts && \
+    ln /usr/src/whereabouts/bin/ip-control-loop /usr/src/whereabouts/rhel8/bin/ip-control-loop && \
+    ln /usr/src/whereabouts/bin/node-slice-controller /usr/src/whereabouts/rhel8/bin/node-slice-controller
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Dockerfile.openshift` around lines 12 - 17, The Dockerfile currently creates
/usr/src/whereabouts/bin but fails to create the rhel-specific hardlink
directories that entrypoint.sh expects (it resolves binaries at
/usr/src/whereabouts/rhel${rhelmajor}/bin/*); update the Dockerfile to mkdir -p
for /usr/src/whereabouts/rhel9/bin and /usr/src/whereabouts/rhel10/bin (and
rhel8 or fedora equivalents if required) and create hardlinks (or copy) from
/usr/src/whereabouts/bin/<binary> into those rhelN/bin directories so that
entrypoint.sh can find ip-control-loop, whereabouts, node-slice-controller,
etc.; ensure the same set of files copied from the rhel9 stage (entrypoint.sh,
whereabouts, ip-control-loop, node-slice-controller) are hardlinked into each
rhelN/bin directory referenced by entrypoint.sh.


LABEL org.opencontainers.image.source https://github.com/openshift/whereabouts
LABEL io.k8s.display-name="Whereabouts CNI" \
io.k8s.description="This is a component of OpenShift Container Platform and provides a cluster-wide IPAM CNI plugin." \
io.openshift.tags="openshift" \
maintainer="CTO Networking <nfvpe-container@redhat.com>"
maintainer="CTO Networking <nfvpe-container@redhat.com>"