Skip to content

[release-1.21] fix: install blobfuse package issue in blobfuse-proxy initContainer #897

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
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
21 changes: 16 additions & 5 deletions pkg/blobfuse-proxy/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,27 @@ READ_AHEAD_KB=${READ_AHEAD_KB:-15380}

HOST_CMD="nsenter --mount=/proc/1/ns/mnt"

if [ "${INSTALL_BLOBFUSE}" = "true" ] || [ "${INSTALL_BLOBFUSE2}" = "true" ]
DISTRIBUTION=$($HOST_CMD cat /etc/os-release | grep ^ID= | cut -d'=' -f2 | tr -d '"')
echo "Linux distribution: $DISTRIBUTION"

if [ "${DISTRIBUTION}" = "ubuntu" ] && { [ "${INSTALL_BLOBFUSE}" = "true" ] || [ "${INSTALL_BLOBFUSE2}" = "true" ]; }
then
cp /blobfuse-proxy/packages-microsoft-prod.deb /host/etc/
release=$($HOST_CMD lsb_release -rs)
echo "Ubuntu release: $release"

if [ "$(expr "$release" \< "22.04")" -eq 1 ]
then
cp /blobfuse-proxy/packages-microsoft-prod-18.04.deb /host/etc/packages-microsoft-prod.deb
else
cp /blobfuse-proxy/packages-microsoft-prod-22.04.deb /host/etc/packages-microsoft-prod.deb
fi

# when running dpkg -i /etc/packages-microsoft-prod.deb, need to enter y to continue.
# refer to https://stackoverflow.com/questions/45349571/how-to-install-deb-with-dpkg-non-interactively
yes | $HOST_CMD dpkg -i /etc/packages-microsoft-prod.deb && $HOST_CMD apt update

pkg_list=""
if [ "${INSTALL_BLOBFUSE}" = "true" ]
if [ "${INSTALL_BLOBFUSE}" = "true" ] && [ "$(expr "$release" \< "22.04")" -eq 1 ]
then
pkg_list="${pkg_list} fuse"
# install blobfuse with latest version or specific version
Expand All @@ -46,8 +58,7 @@ then

if [ "${INSTALL_BLOBFUSE2}" = "true" ]
then
release=$($HOST_CMD lsb_release -rs)
if [ "$release" = "18.04" ]; then
if [ "$(expr "$release" \< "22.04")" -eq 1 ]; then
echo "install fuse for blobfuse2"
pkg_list="${pkg_list} fuse"
else
Expand Down
5 changes: 3 additions & 2 deletions pkg/blobplugin/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ RUN apt update && apt upgrade -y && apt-mark unhold libcap2 && clean-install ca-
ARG ARCH=amd64
RUN if [ "$ARCH" = "amd64" ] ; then \
clean-install libcurl4-gnutls-dev && \
wget -O /blobfuse-proxy/packages-microsoft-prod.deb https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb && \
dpkg -i /blobfuse-proxy/packages-microsoft-prod.deb && apt update && apt install blobfuse blobfuse2 fuse -y && apt remove wget -y; fi
wget -O /blobfuse-proxy/packages-microsoft-prod-22.04.deb https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb && \
wget -O /blobfuse-proxy/packages-microsoft-prod-18.04.deb https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb && \
dpkg -i /blobfuse-proxy/packages-microsoft-prod-18.04.deb && apt update && apt install blobfuse blobfuse2 fuse -y && apt remove wget -y; fi
LABEL maintainers="andyzhangx"
LABEL description="Azure Blob Storage CSI driver"

Expand Down