Skip to content

fix: support blobfuse2 install for GKE cos node #2125

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ CSI_IMAGE_TAG ?= $(REGISTRY)/$(IMAGE_NAME):$(IMAGE_VERSION)
CSI_IMAGE_TAG_LATEST = $(REGISTRY)/$(IMAGE_NAME):latest
BUILD_DATE ?= $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
LDFLAGS ?= "-X ${PKG}/pkg/blob.driverVersion=${IMAGE_VERSION} -X ${PKG}/pkg/blob.gitCommit=${GIT_COMMIT} -X ${PKG}/pkg/blob.buildDate=${BUILD_DATE} -s -w -extldflags '-static'"
E2E_HELM_OPTIONS ?= --set image.blob.pullPolicy=Always --set image.blob.repository=$(REGISTRY)/$(IMAGE_NAME) --set image.blob.tag=$(IMAGE_VERSION) --set driver.userAgentSuffix="e2e-test" --set node.blobfuseProxy.migrateK8sRepo=true --set controller.runOnControlPlane=true
E2E_HELM_OPTIONS ?= --set image.blob.pullPolicy=Always --set image.blob.repository=$(REGISTRY)/$(IMAGE_NAME) --set image.blob.tag=$(IMAGE_VERSION) --set driver.userAgentSuffix="e2e-test" --set controller.runOnControlPlane=true
ifdef ENABLE_BLOBFUSE_PROXY
E2E_HELM_OPTIONS += --set node.enableBlobfuseProxy=true --set image.blob.pullPolicy=Always --set controller.logLevel=6 --set node.logLevel=6
endif
Expand Down
2 changes: 1 addition & 1 deletion pkg/blobfuse-proxy/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ echo "Linux distribution: $DISTRIBUTION, Arch: $ARCH"

# install blobfuse-proxy and blobfuse/blofuse2 if needed
case "${DISTRIBUTION}" in
"rhcos")
"rhcos" | "cos")
. ./blobfuse-proxy/install-proxy-rhcos.sh
;;
*)
Expand Down
28 changes: 16 additions & 12 deletions pkg/blobfuse-proxy/install-proxy-rhcos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@

set -xe

# in coreos, we could just copy the blobfuse2 binary to /usr/local/bin/blobfuse2
BIN_PATH=${BIN_PATH:-/usr/local/bin}
if [ "${DISTRIBUTION}" = "cos" ]; then
BIN_PATH="/home/kubernetes/bin"
fi
#copy blobfuse2 binary to BIN_PATH/blobfuse2
updateBlobfuse2="true"
if [ "${INSTALL_BLOBFUSE}" = "true" ] || [ "${INSTALL_BLOBFUSE2}" = "true" ]
then
if [ -f "/host/usr/local/bin/blobfuse2" ];then
old=$(sha256sum /host/usr/local/bin/blobfuse2 | awk '{print $1}')
if [ -f "/host/${BIN_PATH}/blobfuse2" ];then
old=$(sha256sum /host/${BIN_PATH}/blobfuse2 | awk '{print $1}')
new=$(sha256sum /usr/bin/blobfuse2 | awk '{print $1}')
if [ "$old" = "$new" ];then
updateBlobfuse2="false"
Expand All @@ -34,15 +38,15 @@ else
fi
if [ "$updateBlobfuse2" = "true" ];then
echo "copy blobfuse2...."
cp /usr/bin/blobfuse2 /host/usr/local/bin/blobfuse2 --force
chmod 755 /host/usr/local/bin/blobfuse2
cp /usr/bin/blobfuse2 /host/${BIN_PATH}/blobfuse2 --force
chmod 755 /host/${BIN_PATH}/blobfuse2
fi

if [ "${INSTALL_BLOBFUSE_PROXY}" = "true" ];then
# install blobfuse-proxy
updateBlobfuseProxy="true"
if [ -f "/host/usr/local/bin/blobfuse-proxy" ];then
old=$(sha256sum /host/usr/local/bin/blobfuse-proxy | awk '{print $1}')
if [ -f "/host/${BIN_PATH}/blobfuse-proxy" ];then
old=$(sha256sum /host/${BIN_PATH}/blobfuse-proxy | awk '{print $1}')
new=$(sha256sum /blobfuse-proxy/blobfuse-proxy | awk '{print $1}')
if [ "$old" = "$new" ];then
updateBlobfuseProxy="false"
Expand All @@ -51,14 +55,14 @@ if [ "${INSTALL_BLOBFUSE_PROXY}" = "true" ];then
fi
if [ "$updateBlobfuseProxy" = "true" ];then
echo "copy blobfuse-proxy...."
rm -rf /host/"$KUBELET_PATH"/plugins/blob.csi.azure.com/blobfuse-proxy.sock
cp /blobfuse-proxy/blobfuse-proxy /host/usr/local/bin/blobfuse-proxy --force
chmod 755 /host/usr/local/bin/blobfuse-proxy
rm -rf /host/${KUBELET_PATH}/plugins/blob.csi.azure.com/blobfuse-proxy.sock
cp /blobfuse-proxy/blobfuse-proxy /host/${BIN_PATH}/blobfuse-proxy --force
chmod 755 /host/${BIN_PATH}/blobfuse-proxy
fi

updateService="true"
echo "change from /usr/bin/blobfuse-proxy to /usr/local/bin/blobfuse-proxy in blobfuse-proxy.service"
sed -i 's/\/usr\/bin\/blobfuse-proxy/\/usr\/local\/bin\/blobfuse-proxy/g' /blobfuse-proxy/blobfuse-proxy.service
echo "change from /usr/bin/blobfuse-proxy to ${BIN_PATH}/blobfuse-proxy in blobfuse-proxy.service"
sed -i "s|/usr/bin/blobfuse-proxy|${BIN_PATH}/blobfuse-proxy|g" /blobfuse-proxy/blobfuse-proxy.service
if [ -f "/host/etc/systemd/system/blobfuse-proxy.service" ];then
old=$(sha256sum /host/etc/systemd/system/blobfuse-proxy.service | awk '{print $1}')
new=$(sha256sum /blobfuse-proxy/blobfuse-proxy.service | awk '{print $1}')
Expand Down
2 changes: 1 addition & 1 deletion pkg/blobfuse-proxy/install-proxy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ if [ "${INSTALL_BLOBFUSE_PROXY}" = "true" ];then
fi
if [ "$updateBlobfuseProxy" = "true" ];then
echo "copy blobfuse-proxy...."
rm -rf /host/"$KUBELET_PATH"/plugins/blob.csi.azure.com/blobfuse-proxy.sock
rm -rf /host/${KUBELET_PATH}/plugins/blob.csi.azure.com/blobfuse-proxy.sock
cp /blobfuse-proxy/blobfuse-proxy /host/usr/bin/blobfuse-proxy --force
chmod 755 /host/usr/bin/blobfuse-proxy
fi
Expand Down
Loading