Skip to content

Commit b4be0c6

Browse files
authored
Merge pull request #2125 from andyzhangx/support-cos
fix: support blobfuse2 install for GKE cos node
2 parents 69883b2 + 1b670aa commit b4be0c6

File tree

4 files changed

+33
-15
lines changed

4 files changed

+33
-15
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ CSI_IMAGE_TAG ?= $(REGISTRY)/$(IMAGE_NAME):$(IMAGE_VERSION)
2929
CSI_IMAGE_TAG_LATEST = $(REGISTRY)/$(IMAGE_NAME):latest
3030
BUILD_DATE ?= $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
3131
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'"
32-
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
32+
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
3333
ifdef ENABLE_BLOBFUSE_PROXY
3434
E2E_HELM_OPTIONS += --set node.enableBlobfuseProxy=true --set image.blob.pullPolicy=Always --set controller.logLevel=6 --set node.logLevel=6
3535
endif

pkg/blobfuse-proxy/init.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ echo "Linux distribution: $DISTRIBUTION, Arch: $ARCH"
3939

4040
# install blobfuse-proxy and blobfuse/blofuse2 if needed
4141
case "${DISTRIBUTION}" in
42-
"rhcos")
42+
"rhcos" | "cos" | "gardenlinux")
4343
. ./blobfuse-proxy/install-proxy-rhcos.sh
4444
;;
4545
*)

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

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,26 @@
1616

1717
set -xe
1818

19-
# in coreos, we could just copy the blobfuse2 binary to /usr/local/bin/blobfuse2
19+
BIN_PATH=${BIN_PATH:-/usr/local/bin}
20+
if [ "${DISTRIBUTION}" = "cos" ]; then
21+
echo "set BIN_PATH to /home/kubernetes/bin"
22+
BIN_PATH="/home/kubernetes/bin"
23+
fi
24+
if [ "${DISTRIBUTION}" = "gardenlinux" ]; then
25+
echo "set BIN_PATH to /var/bin"
26+
BIN_PATH="/var/bin"
27+
fi
28+
if [ "${CUSTOM_BIN_PATH}" != "" ]; then
29+
echo "set BIN_PATH to ${CUSTOM_BIN_PATH}"
30+
BIN_PATH="${CUSTOM_BIN_PATH}"
31+
fi
32+
33+
#copy blobfuse2 binary to BIN_PATH/blobfuse2
2034
updateBlobfuse2="true"
2135
if [ "${INSTALL_BLOBFUSE}" = "true" ] || [ "${INSTALL_BLOBFUSE2}" = "true" ]
2236
then
23-
if [ -f "/host/usr/local/bin/blobfuse2" ];then
24-
old=$(sha256sum /host/usr/local/bin/blobfuse2 | awk '{print $1}')
37+
if [ -f "/host/${BIN_PATH}/blobfuse2" ];then
38+
old=$(sha256sum /host/${BIN_PATH}/blobfuse2 | awk '{print $1}')
2539
new=$(sha256sum /usr/bin/blobfuse2 | awk '{print $1}')
2640
if [ "$old" = "$new" ];then
2741
updateBlobfuse2="false"
@@ -34,15 +48,15 @@ else
3448
fi
3549
if [ "$updateBlobfuse2" = "true" ];then
3650
echo "copy blobfuse2...."
37-
cp /usr/bin/blobfuse2 /host/usr/local/bin/blobfuse2 --force
38-
chmod 755 /host/usr/local/bin/blobfuse2
51+
cp /usr/bin/blobfuse2 /host/${BIN_PATH}/blobfuse2 --force
52+
chmod 755 /host/${BIN_PATH}/blobfuse2
3953
fi
4054

4155
if [ "${INSTALL_BLOBFUSE_PROXY}" = "true" ];then
4256
# install blobfuse-proxy
4357
updateBlobfuseProxy="true"
44-
if [ -f "/host/usr/local/bin/blobfuse-proxy" ];then
45-
old=$(sha256sum /host/usr/local/bin/blobfuse-proxy | awk '{print $1}')
58+
if [ -f "/host/${BIN_PATH}/blobfuse-proxy" ];then
59+
old=$(sha256sum /host/${BIN_PATH}/blobfuse-proxy | awk '{print $1}')
4660
new=$(sha256sum /blobfuse-proxy/blobfuse-proxy | awk '{print $1}')
4761
if [ "$old" = "$new" ];then
4862
updateBlobfuseProxy="false"
@@ -51,14 +65,18 @@ if [ "${INSTALL_BLOBFUSE_PROXY}" = "true" ];then
5165
fi
5266
if [ "$updateBlobfuseProxy" = "true" ];then
5367
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
68+
rm -rf /host/${KUBELET_PATH}/plugins/blob.csi.azure.com/blobfuse-proxy.sock
69+
cp /blobfuse-proxy/blobfuse-proxy /host/${BIN_PATH}/blobfuse-proxy --force
70+
chmod 755 /host/${BIN_PATH}/blobfuse-proxy
5771
fi
5872

5973
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
74+
echo "change from /usr/bin/blobfuse-proxy to ${BIN_PATH}/blobfuse-proxy in blobfuse-proxy.service"
75+
sed -i "s|/usr/bin/blobfuse-proxy|${BIN_PATH}/blobfuse-proxy|g" /blobfuse-proxy/blobfuse-proxy.service
76+
if [ "${BIN_PATH}" != "/usr/local/bin" ]; then
77+
echo "add Environment=\"PATH=${BIN_PATH}:$PATH\" in blobfuse-proxy.service"
78+
sed -i "/Delegate=yes/a Environment=\"PATH=${BIN_PATH}:\$PATH\"" /blobfuse-proxy/blobfuse-proxy.service
79+
fi
6280
if [ -f "/host/etc/systemd/system/blobfuse-proxy.service" ];then
6381
old=$(sha256sum /host/etc/systemd/system/blobfuse-proxy.service | awk '{print $1}')
6482
new=$(sha256sum /blobfuse-proxy/blobfuse-proxy.service | awk '{print $1}')

pkg/blobfuse-proxy/install-proxy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ if [ "${INSTALL_BLOBFUSE_PROXY}" = "true" ];then
100100
fi
101101
if [ "$updateBlobfuseProxy" = "true" ];then
102102
echo "copy blobfuse-proxy...."
103-
rm -rf /host/"$KUBELET_PATH"/plugins/blob.csi.azure.com/blobfuse-proxy.sock
103+
rm -rf /host/${KUBELET_PATH}/plugins/blob.csi.azure.com/blobfuse-proxy.sock
104104
cp /blobfuse-proxy/blobfuse-proxy /host/usr/bin/blobfuse-proxy --force
105105
chmod 755 /host/usr/bin/blobfuse-proxy
106106
fi

0 commit comments

Comments
 (0)