From 7ca4ebd682689e9b745003d1e94fcd945017f63e Mon Sep 17 00:00:00 2001 From: andyzhangx Date: Mon, 21 Oct 2024 09:30:21 +0000 Subject: [PATCH] fix: skip blobfuse-proxy copy if it's not enabled in driver init --- pkg/blobfuse-proxy/install-proxy-rhcos.sh | 62 +++++++++++------------ pkg/blobfuse-proxy/install-proxy.sh | 58 ++++++++++----------- 2 files changed, 60 insertions(+), 60 deletions(-) diff --git a/pkg/blobfuse-proxy/install-proxy-rhcos.sh b/pkg/blobfuse-proxy/install-proxy-rhcos.sh index 065147d2c..74cb9c8a8 100644 --- a/pkg/blobfuse-proxy/install-proxy-rhcos.sh +++ b/pkg/blobfuse-proxy/install-proxy-rhcos.sh @@ -38,41 +38,41 @@ if [ "$updateBlobfuse2" = "true" ];then chmod 755 /host/usr/local/bin/blobfuse2 fi -# 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}') - new=$(sha256sum /blobfuse-proxy/blobfuse-proxy | awk '{print $1}') - if [ "$old" = "$new" ];then - updateBlobfuseProxy="false" - echo "no need to update blobfuse-proxy" +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}') + new=$(sha256sum /blobfuse-proxy/blobfuse-proxy | awk '{print $1}') + if [ "$old" = "$new" ];then + updateBlobfuseProxy="false" + echo "no need to update blobfuse-proxy" + fi + 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 fi -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 -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 -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}') - if [ "$old" = "$new" ];then - updateService="false" - echo "no need to update blobfuse-proxy.service" + 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 + 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}') + if [ "$old" = "$new" ];then + updateService="false" + echo "no need to update blobfuse-proxy.service" + fi + fi + if [ "$updateService" = "true" ];then + echo "copy blobfuse-proxy.service...." + mkdir -p /host/etc/systemd/system/ + cp /blobfuse-proxy/blobfuse-proxy.service /host/etc/systemd/system/blobfuse-proxy.service fi -fi -if [ "$updateService" = "true" ];then - echo "copy blobfuse-proxy.service...." - mkdir -p /host/etc/systemd/system/ - cp /blobfuse-proxy/blobfuse-proxy.service /host/etc/systemd/system/blobfuse-proxy.service -fi -if [ "${INSTALL_BLOBFUSE_PROXY}" = "true" ];then if [ "$updateBlobfuseProxy" = "true" ] || [ "$updateService" = "true" ];then echo "start blobfuse-proxy...." $HOST_CMD systemctl daemon-reload diff --git a/pkg/blobfuse-proxy/install-proxy.sh b/pkg/blobfuse-proxy/install-proxy.sh index d60ce443f..fb2559c11 100644 --- a/pkg/blobfuse-proxy/install-proxy.sh +++ b/pkg/blobfuse-proxy/install-proxy.sh @@ -74,39 +74,39 @@ then $HOST_CMD rm -f /etc/packages-microsoft-prod.deb fi -# install blobfuse-proxy -updateBlobfuseProxy="true" -if [ -f "/host/usr/bin/blobfuse-proxy" ];then - old=$(sha256sum /host/usr/bin/blobfuse-proxy | awk '{print $1}') - new=$(sha256sum /blobfuse-proxy/blobfuse-proxy | awk '{print $1}') - if [ "$old" = "$new" ];then - updateBlobfuseProxy="false" - echo "no need to update blobfuse-proxy" +if [ "${INSTALL_BLOBFUSE_PROXY}" = "true" ];then + # install blobfuse-proxy + updateBlobfuseProxy="true" + if [ -f "/host/usr/bin/blobfuse-proxy" ];then + old=$(sha256sum /host/usr/bin/blobfuse-proxy | awk '{print $1}') + new=$(sha256sum /blobfuse-proxy/blobfuse-proxy | awk '{print $1}') + if [ "$old" = "$new" ];then + updateBlobfuseProxy="false" + echo "no need to update blobfuse-proxy" + fi + 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/bin/blobfuse-proxy --force + chmod 755 /host/usr/bin/blobfuse-proxy fi -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/bin/blobfuse-proxy --force - chmod 755 /host/usr/bin/blobfuse-proxy -fi -updateService="true" -if [ -f "/host/usr/lib/systemd/system/blobfuse-proxy.service" ];then - old=$(sha256sum /host/usr/lib/systemd/system/blobfuse-proxy.service | awk '{print $1}') - new=$(sha256sum /blobfuse-proxy/blobfuse-proxy.service | awk '{print $1}') - if [ "$old" = "$new" ];then - updateService="false" - echo "no need to update blobfuse-proxy.service" + updateService="true" + if [ -f "/host/usr/lib/systemd/system/blobfuse-proxy.service" ];then + old=$(sha256sum /host/usr/lib/systemd/system/blobfuse-proxy.service | awk '{print $1}') + new=$(sha256sum /blobfuse-proxy/blobfuse-proxy.service | awk '{print $1}') + if [ "$old" = "$new" ];then + updateService="false" + echo "no need to update blobfuse-proxy.service" + fi + fi + if [ "$updateService" = "true" ];then + echo "copy blobfuse-proxy.service...." + mkdir -p /host/usr/lib/systemd/system + cp /blobfuse-proxy/blobfuse-proxy.service /host/usr/lib/systemd/system/blobfuse-proxy.service fi -fi -if [ "$updateService" = "true" ];then - echo "copy blobfuse-proxy.service...." - mkdir -p /host/usr/lib/systemd/system - cp /blobfuse-proxy/blobfuse-proxy.service /host/usr/lib/systemd/system/blobfuse-proxy.service -fi -if [ "${INSTALL_BLOBFUSE_PROXY}" = "true" ];then if [ "$updateBlobfuseProxy" = "true" ] || [ "$updateService" = "true" ];then echo "start blobfuse-proxy...." $HOST_CMD systemctl daemon-reload