Skip to content

Commit cc67ccb

Browse files
authored
Merge pull request #1651 from andyzhangx/skip-copy-blobfuse-proxy-if-unused
fix: skip blobfuse-proxy copy if it's not enabled in driver init
2 parents 2804061 + 7ca4ebd commit cc67ccb

File tree

2 files changed

+60
-60
lines changed

2 files changed

+60
-60
lines changed

pkg/blobfuse-proxy/install-proxy-rhcos.sh

+31-31
Original file line numberDiff line numberDiff line change
@@ -38,41 +38,41 @@ if [ "$updateBlobfuse2" = "true" ];then
3838
chmod 755 /host/usr/local/bin/blobfuse2
3939
fi
4040

41-
# install blobfuse-proxy
42-
updateBlobfuseProxy="true"
43-
if [ -f "/host/usr/local/bin/blobfuse-proxy" ];then
44-
old=$(sha256sum /host/usr/local/bin/blobfuse-proxy | awk '{print $1}')
45-
new=$(sha256sum /blobfuse-proxy/blobfuse-proxy | awk '{print $1}')
46-
if [ "$old" = "$new" ];then
47-
updateBlobfuseProxy="false"
48-
echo "no need to update blobfuse-proxy"
41+
if [ "${INSTALL_BLOBFUSE_PROXY}" = "true" ];then
42+
# install blobfuse-proxy
43+
updateBlobfuseProxy="true"
44+
if [ -f "/host/usr/local/bin/blobfuse-proxy" ];then
45+
old=$(sha256sum /host/usr/local/bin/blobfuse-proxy | awk '{print $1}')
46+
new=$(sha256sum /blobfuse-proxy/blobfuse-proxy | awk '{print $1}')
47+
if [ "$old" = "$new" ];then
48+
updateBlobfuseProxy="false"
49+
echo "no need to update blobfuse-proxy"
50+
fi
51+
fi
52+
if [ "$updateBlobfuseProxy" = "true" ];then
53+
echo "copy blobfuse-proxy...."
54+
rm -rf /host/"$KUBELET_PATH"/plugins/blob.csi.azure.com/blobfuse-proxy.sock
55+
cp /blobfuse-proxy/blobfuse-proxy /host/usr/local/bin/blobfuse-proxy --force
56+
chmod 755 /host/usr/local/bin/blobfuse-proxy
4957
fi
50-
fi
51-
if [ "$updateBlobfuseProxy" = "true" ];then
52-
echo "copy blobfuse-proxy...."
53-
rm -rf /host/"$KUBELET_PATH"/plugins/blob.csi.azure.com/blobfuse-proxy.sock
54-
cp /blobfuse-proxy/blobfuse-proxy /host/usr/local/bin/blobfuse-proxy --force
55-
chmod 755 /host/usr/local/bin/blobfuse-proxy
56-
fi
5758

58-
updateService="true"
59-
echo "change from /usr/bin/blobfuse-proxy to /usr/local/bin/blobfuse-proxy in blobfuse-proxy.service"
60-
sed -i 's/\/usr\/bin\/blobfuse-proxy/\/usr\/local\/bin\/blobfuse-proxy/g' /blobfuse-proxy/blobfuse-proxy.service
61-
if [ -f "/host/etc/systemd/system/blobfuse-proxy.service" ];then
62-
old=$(sha256sum /host/etc/systemd/system/blobfuse-proxy.service | awk '{print $1}')
63-
new=$(sha256sum /blobfuse-proxy/blobfuse-proxy.service | awk '{print $1}')
64-
if [ "$old" = "$new" ];then
65-
updateService="false"
66-
echo "no need to update blobfuse-proxy.service"
59+
updateService="true"
60+
echo "change from /usr/bin/blobfuse-proxy to /usr/local/bin/blobfuse-proxy in blobfuse-proxy.service"
61+
sed -i 's/\/usr\/bin\/blobfuse-proxy/\/usr\/local\/bin\/blobfuse-proxy/g' /blobfuse-proxy/blobfuse-proxy.service
62+
if [ -f "/host/etc/systemd/system/blobfuse-proxy.service" ];then
63+
old=$(sha256sum /host/etc/systemd/system/blobfuse-proxy.service | awk '{print $1}')
64+
new=$(sha256sum /blobfuse-proxy/blobfuse-proxy.service | awk '{print $1}')
65+
if [ "$old" = "$new" ];then
66+
updateService="false"
67+
echo "no need to update blobfuse-proxy.service"
68+
fi
69+
fi
70+
if [ "$updateService" = "true" ];then
71+
echo "copy blobfuse-proxy.service...."
72+
mkdir -p /host/etc/systemd/system/
73+
cp /blobfuse-proxy/blobfuse-proxy.service /host/etc/systemd/system/blobfuse-proxy.service
6774
fi
68-
fi
69-
if [ "$updateService" = "true" ];then
70-
echo "copy blobfuse-proxy.service...."
71-
mkdir -p /host/etc/systemd/system/
72-
cp /blobfuse-proxy/blobfuse-proxy.service /host/etc/systemd/system/blobfuse-proxy.service
73-
fi
7475

75-
if [ "${INSTALL_BLOBFUSE_PROXY}" = "true" ];then
7676
if [ "$updateBlobfuseProxy" = "true" ] || [ "$updateService" = "true" ];then
7777
echo "start blobfuse-proxy...."
7878
$HOST_CMD systemctl daemon-reload

pkg/blobfuse-proxy/install-proxy.sh

+29-29
Original file line numberDiff line numberDiff line change
@@ -74,39 +74,39 @@ then
7474
$HOST_CMD rm -f /etc/packages-microsoft-prod.deb
7575
fi
7676

77-
# install blobfuse-proxy
78-
updateBlobfuseProxy="true"
79-
if [ -f "/host/usr/bin/blobfuse-proxy" ];then
80-
old=$(sha256sum /host/usr/bin/blobfuse-proxy | awk '{print $1}')
81-
new=$(sha256sum /blobfuse-proxy/blobfuse-proxy | awk '{print $1}')
82-
if [ "$old" = "$new" ];then
83-
updateBlobfuseProxy="false"
84-
echo "no need to update blobfuse-proxy"
77+
if [ "${INSTALL_BLOBFUSE_PROXY}" = "true" ];then
78+
# install blobfuse-proxy
79+
updateBlobfuseProxy="true"
80+
if [ -f "/host/usr/bin/blobfuse-proxy" ];then
81+
old=$(sha256sum /host/usr/bin/blobfuse-proxy | awk '{print $1}')
82+
new=$(sha256sum /blobfuse-proxy/blobfuse-proxy | awk '{print $1}')
83+
if [ "$old" = "$new" ];then
84+
updateBlobfuseProxy="false"
85+
echo "no need to update blobfuse-proxy"
86+
fi
87+
fi
88+
if [ "$updateBlobfuseProxy" = "true" ];then
89+
echo "copy blobfuse-proxy...."
90+
rm -rf /host/"$KUBELET_PATH"/plugins/blob.csi.azure.com/blobfuse-proxy.sock
91+
cp /blobfuse-proxy/blobfuse-proxy /host/usr/bin/blobfuse-proxy --force
92+
chmod 755 /host/usr/bin/blobfuse-proxy
8593
fi
86-
fi
87-
if [ "$updateBlobfuseProxy" = "true" ];then
88-
echo "copy blobfuse-proxy...."
89-
rm -rf /host/"$KUBELET_PATH"/plugins/blob.csi.azure.com/blobfuse-proxy.sock
90-
cp /blobfuse-proxy/blobfuse-proxy /host/usr/bin/blobfuse-proxy --force
91-
chmod 755 /host/usr/bin/blobfuse-proxy
92-
fi
9394

94-
updateService="true"
95-
if [ -f "/host/usr/lib/systemd/system/blobfuse-proxy.service" ];then
96-
old=$(sha256sum /host/usr/lib/systemd/system/blobfuse-proxy.service | awk '{print $1}')
97-
new=$(sha256sum /blobfuse-proxy/blobfuse-proxy.service | awk '{print $1}')
98-
if [ "$old" = "$new" ];then
99-
updateService="false"
100-
echo "no need to update blobfuse-proxy.service"
95+
updateService="true"
96+
if [ -f "/host/usr/lib/systemd/system/blobfuse-proxy.service" ];then
97+
old=$(sha256sum /host/usr/lib/systemd/system/blobfuse-proxy.service | awk '{print $1}')
98+
new=$(sha256sum /blobfuse-proxy/blobfuse-proxy.service | awk '{print $1}')
99+
if [ "$old" = "$new" ];then
100+
updateService="false"
101+
echo "no need to update blobfuse-proxy.service"
102+
fi
103+
fi
104+
if [ "$updateService" = "true" ];then
105+
echo "copy blobfuse-proxy.service...."
106+
mkdir -p /host/usr/lib/systemd/system
107+
cp /blobfuse-proxy/blobfuse-proxy.service /host/usr/lib/systemd/system/blobfuse-proxy.service
101108
fi
102-
fi
103-
if [ "$updateService" = "true" ];then
104-
echo "copy blobfuse-proxy.service...."
105-
mkdir -p /host/usr/lib/systemd/system
106-
cp /blobfuse-proxy/blobfuse-proxy.service /host/usr/lib/systemd/system/blobfuse-proxy.service
107-
fi
108109

109-
if [ "${INSTALL_BLOBFUSE_PROXY}" = "true" ];then
110110
if [ "$updateBlobfuseProxy" = "true" ] || [ "$updateService" = "true" ];then
111111
echo "start blobfuse-proxy...."
112112
$HOST_CMD systemctl daemon-reload

0 commit comments

Comments
 (0)