Skip to content

Commit

Permalink
d
Browse files Browse the repository at this point in the history
  • Loading branch information
weizhoublue committed Dec 14, 2023
1 parent 434d3d9 commit cce480f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion images/spiderpool-plugins/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ COPY --from=builder /src/ipoib-cni/build/ipoib ${IPOIB_BIN_PATH}
COPY --from=builder /src/cni/bin/ ${CNI_BIN_DIR}
COPY --from=builder /src/VERSION.info ${VERSION_FILE_PATH}

ADD ./entrypoint.sh /
ADD ./entrypoint.sh /
31 changes: 15 additions & 16 deletions images/spiderpool-plugins/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

#!/bin/bash

set -e
set -o errexit
set -o nounset
set -o pipefail

function usage()
{
Expand All @@ -24,12 +26,12 @@ echo "IPOIB_BIN_PATH=${IPOIB_BIN_PATH}"
echo "VERSION_FILE_PATH=${VERSION_FILE_PATH}"
echo "RDMA_BIN_PATH=${RDMA_BIN_PATH}"

[ -f "${RDMA_BIN_PATH}" ] || echo "error, failed to find ${RDMA_BIN_PATH}"
[ -f "${OVS_BIN_PATH}" ] || echo "error, failed to find ${OVS_BIN_PATH}"
[ -f "${IB_SRIOV_BIN_PATH}" ] || echo "error, failed to find ${IB_SRIOV_BIN_PATH}"
[ -f "${IPOIB_BIN_PATH}" ] || echo "error, failed to find ${IPOIB_BIN_PATH}"
[ -f "${VERSION_FILE_PATH}" ] || echo "error, failed to find ${VERSION_FILE_PATH}"
[ -d "${CNI_BIN_DIR}" ] || echo "error, failed to find ${CNI_BIN_DIR}"
[ -f "${RDMA_BIN_PATH}" ] || { echo "error, failed to find ${RDMA_BIN_PATH}" ; exit 1 ; }
[ -f "${OVS_BIN_PATH}" ] || { echo "error, failed to find ${OVS_BIN_PATH}" ; exit 1 ; }
[ -f "${IB_SRIOV_BIN_PATH}" ] || { echo "error, failed to find ${IB_SRIOV_BIN_PATH}" ; exit 1 ; }
[ -f "${IPOIB_BIN_PATH}" ] || { echo "error, failed to find ${IPOIB_BIN_PATH}" ; exit 1 ; }
[ -f "${VERSION_FILE_PATH}" ] || { echo "error, failed to find ${VERSION_FILE_PATH}" ; exit 1 ; }
[ -d "${CNI_BIN_DIR}" ] || { echo "error, failed to find ${CNI_BIN_DIR}" ; exit 1 ; }

INSTALL_OVS_PLUGIN=${INSTALL_OVS_PLUGIN:-false}
INSTALL_RDMA_PLUGIN=${INSTALL_RDMA_PLUGIN:-false}
Expand Down Expand Up @@ -71,15 +73,12 @@ while [ "$1" != "" ]; do
shift
done

if [ -f "${SRC_DIR}" ]; then
echo "source plugins dir: ${SRC_DIR} not exist"
exit 1
fi


mkdir -p ${COPY_DST_DIR}

if [ "$INSTALL_CNI_PLUGINS" = "true" ]; then
VERSION=$(cat VERSION.info | grep CNI_VERSION | awk '{print $2}')
VERSION=$(cat ${VERSION_FILE_PATH} | grep CNI_VERSION | awk '{print $2}')
echo "Installing CNI-Plugins: ${VERSION}"
for plugin in "${CNI_BIN_DIR}"/*; do
ITEM=${plugin##*/}
Expand All @@ -91,7 +90,7 @@ if [ "$INSTALL_CNI_PLUGINS" = "true" ]; then
fi

if [ "$INSTALL_OVS_PLUGIN" = "true" ]; then
VERSION=$(cat VERSION.info | grep OVS_VERSION | awk '{print $2}')
VERSION=$(cat ${VERSION_FILE_PATH} | grep OVS_VERSION | awk '{print $2}')
echo "Installing OVS-Plugin: ${VERSION}"
rm -f ${COPY_DST_DIR}/ovs.old || true
( [ -f "${COPY_DST_DIR}/ovs" ] && mv ${COPY_DST_DIR}/ovs ${COPY_DST_DIR}/ovs.old ) || true
Expand All @@ -100,7 +99,7 @@ if [ "$INSTALL_OVS_PLUGIN" = "true" ]; then
fi

if [ "$INSTALL_RDMA_PLUGIN" = "true" ]; then
VERSION=$(cat VERSION.info | grep RDMA_COMMIT_HASH | awk '{print $2}')
VERSION=$(cat ${VERSION_FILE_PATH} | grep RDMA_COMMIT_HASH | awk '{print $2}')
echo "Installing RDMA-Plugin: ${VERSION}"
rm -f ${COPY_DST_DIR}/rdma.old || true
( [ -f "${COPY_DST_DIR}/rdma" ] && mv ${COPY_DST_DIR}/rdma ${COPY_DST_DIR}/rdma.old ) || true
Expand All @@ -109,7 +108,7 @@ if [ "$INSTALL_RDMA_PLUGIN" = "true" ]; then
fi

if [ "$INSTALL_IB_SRIOV_PLUGIN" = "true" ]; then
VERSION=$(cat VERSION.info | grep IB_SRIOV_VERSION | awk '{print $2}')
VERSION=$(cat ${VERSION_FILE_PATH} | grep IB_SRIOV_VERSION | awk '{print $2}')
echo "Installing ib-sriov: ${VERSION}"
rm -f ${COPY_DST_DIR}/ib-sriov.old || true
( [ -f "${COPY_DST_DIR}/ib-sriov" ] && mv ${COPY_DST_DIR}/ib-sriov ${COPY_DST_DIR}/ib-sriov.old ) || true
Expand All @@ -118,7 +117,7 @@ if [ "$INSTALL_IB_SRIOV_PLUGIN" = "true" ]; then
fi

if [ "$INSTALL_IPOIB_PLUGIN" = "true" ]; then
VERSION=$(cat VERSION.info | grep IPOIB_VERSION | awk '{print $2}')
VERSION=$(cat ${VERSION_FILE_PATH} | grep IPOIB_VERSION | awk '{print $2}')
echo "Installing ipoib: ${VERSION}"
rm -f ${COPY_DST_DIR}/ipoib.old || true
( [ -f "${COPY_DST_DIR}/ipoib" ] && mv ${COPY_DST_DIR}/ipoib ${COPY_DST_DIR}/ipoib.old ) || true
Expand Down

0 comments on commit cce480f

Please sign in to comment.