Skip to content

Commit 6fd729f

Browse files
committed
Cleanup and fixes for FPGA initcontainer
- Simplify initcontainer, we don't need OPAE anymore - Remove old initcontainer related files
1 parent 71bb38f commit 6fd729f

File tree

3 files changed

+23
-156
lines changed

3 files changed

+23
-156
lines changed

build/docker/intel-fpga-initcontainer.Dockerfile

Lines changed: 23 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -11,70 +11,51 @@ ARG CLEAR_LINUX_BASE=clearlinux/golang:latest
1111
FROM ${CLEAR_LINUX_BASE} as builder
1212

1313
ARG CLEAR_LINUX_VERSION=
14-
ARG OPAE_RElEASE=1.3.2-1
1514

1615
RUN swupd update --no-boot-update ${CLEAR_LINUX_VERSION}
17-
18-
# Fetch dependencies and source code
19-
RUN swupd bundle-add wget c-basic devpkg-json-c devpkg-util-linux devpkg-hwloc doxygen Sphinx && \
20-
mkdir -p /usr/src/opae && \
21-
cd /usr/src/opae && \
22-
wget https://github.com/OPAE/opae-sdk/archive/${OPAE_RElEASE}.tar.gz && \
23-
tar xf *.tar.gz
24-
25-
# Build OPAE
26-
RUN cd /usr/src/opae/opae-sdk-${OPAE_RElEASE} && \
27-
mkdir build && \
28-
cd build && \
29-
cmake .. -DBUILD_ASE=0 -DCMAKE_SKIP_BUILD_RPATH=1 -DCMAKE_INSTALL_PREFIX=/opt/intel/fpga-sw/opae && \
30-
make xfpga board_rc fpgaconf fpgainfo
31-
32-
# Install clean os-core and rsync bundle in target directory
3316
RUN mkdir /install_root \
34-
&& swupd os-install ${CLEAR_LINUX_VERSION} \
35-
--path /install_root --statedir /swupd-state \
36-
--bundles=os-core,rsync --no-boot-update \
17+
&& swupd os-install \
18+
${CLEAR_LINUX_VERSION} \
19+
--path /install_root \
20+
--statedir /swupd-state \
21+
--bundles=os-core,rsync \
22+
--no-boot-update \
3723
&& rm -rf /install_root/var/lib/swupd/*
3824

3925
# Build CRI Hook
4026
ARG DIR=/go/src/github.com/intel/intel-device-plugins-for-kubernetes
4127
WORKDIR $DIR
4228
COPY . .
43-
RUN cd cmd/fpga_crihook && go install && chmod a+x /go/bin/fpga_crihook
29+
RUN cd $DIR/cmd/fpga_crihook && \
30+
go install && \
31+
chmod a+x /go/bin/fpga_crihook && \
32+
cd $DIR/cmd/fpga_tool && \
33+
go install && \
34+
chmod a+x /go/bin/fpga_tool && \
35+
install -D ${DIR}/LICENSE /install_root/usr/local/share/package-licenses/intel-device-plugins-for-kubernetes/LICENSE
4436

4537
# Minimal result image
4638
FROM scratch as final
4739
COPY --from=builder /install_root /
4840

49-
ARG SRC_DIR=/opt/intel/fpga-sw.src
41+
ARG SRC_DIR=/usr/local/fpga-sw.src
5042
ARG DST_DIR=/opt/intel/fpga-sw
5143

52-
# OPAE
53-
# fpgaconf and fpgainfo
54-
COPY --from=builder /usr/src/opae/opae-sdk-*/build/bin/fpga* $SRC_DIR/opae/bin/
55-
# libxfpga.so, libboard_rc.so, libopae-c.so*, libbitstream.so*
56-
COPY --from=builder /usr/src/opae/opae-sdk-*/build/lib/lib*.so* $SRC_DIR/opae/lib/
57-
COPY --from=builder /usr/lib64/libjson-c.so* $SRC_DIR/opae/lib/
58-
COPY --from=builder /usr/lib64/libuuid.so* $SRC_DIR/opae/lib/
59-
60-
RUN echo -e "#!/bin/sh\n\
61-
export LD_LIBRARY_PATH=$DST_DIR/opae/lib\n\
62-
$DST_DIR/opae/bin/fpgaconf \"\$@\"">> $SRC_DIR/opae/fpgaconf-wrapper && \
63-
echo -e "#!/bin/sh\n\
64-
export LD_LIBRARY_PATH=$DST_DIR/opae/lib\n\
65-
$DST_DIR/opae/bin/fpgainfo \"\$@\"">> $SRC_DIR/opae/fpgainfo-wrapper && \
66-
chmod +x $SRC_DIR/opae/*-wrapper
67-
68-
6944
# CRI hook
7045
ARG CRI_HOOK=intel-fpga-crihook
71-
ARG CRI_HOOK_SRC=$SRC_DIR/$CRI_HOOK
72-
ARG CRI_HOOK_DST=$DST_DIR/$CRI_HOOK
46+
ARG FPGA_TOOL=fpgatool
7347
ARG HOOK_CONF=$CRI_HOOK.json
7448
ARG HOOK_CONF_SRC=$SRC_DIR/$HOOK_CONF
7549
ARG HOOK_CONF_DST=$DST_DIR/$HOOK_CONF
7650

77-
COPY --from=builder /go/bin/fpga_crihook $CRI_HOOK_SRC
51+
COPY --from=builder /go/bin/fpga_crihook $SRC_DIR/$CRI_HOOK
52+
COPY --from=builder /go/bin/fpga_tool $SRC_DIR/$FPGA_TOOL
53+
54+
RUN echo -e "{\n\
55+
\"hook\" : \"$DST_DIR/$CRI_HOOK\",\n\
56+
\"stage\" : [ \"prestart\" ],\n\
57+
\"annotation\": [ \"fpga.intel.com/region\" ]\n\
58+
}\n">>$HOOK_CONF_SRC
7859

7960
RUN echo -e "#!/bin/sh\n\
8061
rsync -a --delete $SRC_DIR/ $DST_DIR\n\

deployments/fpga_plugin/build-initcontainer-image.sh

Lines changed: 0 additions & 32 deletions
This file was deleted.

deployments/fpga_plugin/intel-fpga-initcontainer.Dockerfile

Lines changed: 0 additions & 82 deletions
This file was deleted.

0 commit comments

Comments
 (0)