Skip to content

Commit 4b01ca5

Browse files
committed
Squashed commit of the following:
commit 0c185e7 Merge: bd1e028 3f47b3e Author: weizhichen <[email protected]> Date: Mon Nov 6 05:27:11 2023 +0000 Merge branch 'master' of https://github.com/kubernetes-sigs/blob-csi-driver into support-openshift commit bd1e028 Author: weizhichen <[email protected]> Date: Wed Oct 18 08:40:28 2023 +0000 fix commit 6270feb Merge: 697f9ab b99e1cf Author: weizhichen <[email protected]> Date: Wed Oct 18 07:30:33 2023 +0000 Merge branch 'master' of https://github.com/kubernetes-sigs/blob-csi-driver into support-openshift commit 697f9ab Author: weizhichen <[email protected]> Date: Mon Oct 16 08:07:59 2023 +0000 arm commit c79dc0f Author: weizhichen <[email protected]> Date: Mon Oct 16 07:16:45 2023 +0000 fix commit 7096aa8 Author: weizhichen <[email protected]> Date: Mon Oct 16 07:06:17 2023 +0000 fix commit 617ea0e Author: weizhichen <[email protected]> Date: Mon Oct 16 06:48:07 2023 +0000 add mariner commit 2f4473c Author: weizhichen <[email protected]> Date: Mon Oct 16 06:06:48 2023 +0000 fix commit ee5e239 Author: weizhichen <[email protected]> Date: Mon Oct 16 06:01:50 2023 +0000 fix commit fd8e1f5 Author: weizhichen <[email protected]> Date: Mon Oct 16 05:47:02 2023 +0000 fix commit babe2f0 Author: weizhichen <[email protected]> Date: Mon Oct 16 05:44:54 2023 +0000 fix commit 6ce12c8 Author: weizhichen <[email protected]> Date: Mon Oct 16 04:17:51 2023 +0000 support openshift commit 38f50a9 Author: weizhichen <[email protected]> Date: Mon Oct 16 02:48:57 2023 +0000 Revert "support openshift" This reverts commit e15df33. commit e15df33 Author: weizhichen <[email protected]> Date: Fri Oct 13 07:27:24 2023 +0000 support openshift
1 parent cf66f5d commit 4b01ca5

File tree

11 files changed

+306
-112
lines changed

11 files changed

+306
-112
lines changed

charts/latest/blob-csi-driver/templates/csi-blob-node.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ spec:
6666
tolerations:
6767
{{ toYaml . | indent 8 }}
6868
{{- end }}
69-
{{- if .Values.node.enableBlobfuseProxy }}
7069
initContainers:
7170
- name: install-blobfuse-proxy
7271
{{- if hasPrefix "/" .Values.image.blob.repository }}
@@ -90,6 +89,8 @@ spec:
9089
value: "{{ .Values.node.blobfuseProxy.installBlobfuse2 }}"
9190
- name: BLOBFUSE2_VERSION
9291
value: "{{ .Values.node.blobfuseProxy.blobfuse2Version }}"
92+
- name: INSTALL_BLOBFUSE_PROXY
93+
value: "{{ .Values.node.enableBlobfuseProxy }}"
9394
- name: SET_MAX_OPEN_FILE_NUM
9495
value: "{{ .Values.node.blobfuseProxy.setMaxOpenFileNum }}"
9596
- name: MAX_FILE_NUM
@@ -99,9 +100,10 @@ spec:
99100
volumeMounts:
100101
- name: host-usr
101102
mountPath: /host/usr
103+
- name: host-usr-local
104+
mountPath: /host/usr/local
102105
- name: host-etc
103106
mountPath: /host/etc
104-
{{- end }}
105107
containers:
106108
- name: liveness-probe
107109
imagePullPolicy: {{ .Values.image.livenessProbe.pullPolicy }}
@@ -265,14 +267,15 @@ spec:
265267
name: mountpoint-dir
266268
{{- end }}
267269
volumes:
268-
{{- if .Values.node.enableBlobfuseProxy }}
269270
- name: host-usr
270271
hostPath:
271272
path: /usr
273+
- name: host-usr-local
274+
hostPath:
275+
path: /usr/local
272276
- name: host-etc
273277
hostPath:
274278
path: /etc
275-
{{- end }}
276279
- hostPath:
277280
path: {{ .Values.linux.kubelet }}/plugins/{{ .Values.driver.name }}
278281
type: DirectoryOrCreate

charts/latest/blob-csi-driver/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ node:
114114
livenessProbe:
115115
healthPort: 29633
116116
logLevel: 5
117-
enableBlobfuseProxy: false
117+
enableBlobfuseProxy: true
118118
blobfuseProxy:
119119
installBlobfuse: true
120120
blobfuseVersion: "1.4.5"

deploy/csi-blob-node.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ spec:
6868
volumeMounts:
6969
- name: host-usr
7070
mountPath: /host/usr
71+
- name: host-usr-local
72+
mountPath: /host/usr/local
7173
- name: host-etc
7274
mountPath: /host/etc
7375
containers:
@@ -177,6 +179,9 @@ spec:
177179
- name: host-usr
178180
hostPath:
179181
path: /usr
182+
- name: host-usr-local
183+
hostPath:
184+
path: /usr/local
180185
- name: host-etc
181186
hostPath:
182187
path: /etc

pkg/blobfuse-proxy/init.sh

Lines changed: 21 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -25,110 +25,32 @@ READ_AHEAD_KB=${READ_AHEAD_KB:-15380}
2525
HOST_CMD="nsenter --mount=/proc/1/ns/mnt"
2626

2727
DISTRIBUTION=$($HOST_CMD cat /etc/os-release | grep ^ID= | cut -d'=' -f2 | tr -d '"')
28-
echo "Linux distribution: $DISTRIBUTION"
2928
ARCH=$($HOST_CMD uname -m)
30-
echo "Linux Arch is $(uname -m)"
31-
32-
if [ "${DISTRIBUTION}" = "ubuntu" ] && { [ "${INSTALL_BLOBFUSE}" = "true" ] || [ "${INSTALL_BLOBFUSE2}" = "true" ]; }
33-
then
34-
release=$($HOST_CMD lsb_release -rs)
35-
echo "Ubuntu release: $release"
36-
37-
if [ "$(expr "$release" \< "22.04")" -eq 1 ]
38-
then
39-
cp /blobfuse-proxy/packages-microsoft-prod-18.04.deb /host/etc/packages-microsoft-prod.deb
40-
else
41-
cp /blobfuse-proxy/packages-microsoft-prod-22.04.deb /host/etc/packages-microsoft-prod.deb
42-
fi
43-
44-
# when running dpkg -i /etc/packages-microsoft-prod.deb, need to enter y to continue.
45-
# refer to https://stackoverflow.com/questions/45349571/how-to-install-deb-with-dpkg-non-interactively
46-
yes | $HOST_CMD dpkg -i /etc/packages-microsoft-prod.deb && $HOST_CMD apt update
47-
48-
pkg_list=""
49-
if [ "${INSTALL_BLOBFUSE}" = "true" ] && [ "$(expr "$release" \< "22.04")" -eq 1 ]
50-
then
51-
pkg_list="${pkg_list} fuse"
52-
# install blobfuse with latest version or specific version
53-
if [ -z "${BLOBFUSE_VERSION}" ]; then
54-
echo "install blobfuse with latest version"
55-
pkg_list="${pkg_list} blobfuse"
56-
else
57-
pkg_list="${pkg_list} blobfuse=${BLOBFUSE_VERSION}"
58-
fi
59-
fi
60-
61-
if [ "${INSTALL_BLOBFUSE2}" = "true" ]
62-
then
63-
if [ "$(expr "$release" \< "22.04")" -eq 1 ]; then
64-
echo "install fuse for blobfuse2"
65-
pkg_list="${pkg_list} fuse"
66-
else
67-
echo "install fuse3 for blobfuse2, current release is $release"
68-
pkg_list="${pkg_list} fuse3"
69-
fi
70-
71-
# install blobfuse2 with latest version or specific version
72-
if [ -z "${BLOBFUSE2_VERSION}" ]; then
73-
echo "install blobfuse2 with latest version"
74-
pkg_list="${pkg_list} blobfuse2"
75-
else
76-
pkg_list="${pkg_list} blobfuse2=${BLOBFUSE2_VERSION}"
77-
fi
78-
fi
79-
echo "begin to install ${pkg_list}"
80-
$HOST_CMD apt-get install -y $pkg_list
81-
$HOST_CMD rm -f /etc/packages-microsoft-prod.deb
82-
fi
83-
84-
updateBlobfuseProxy="true"
85-
if [ -f "/host/usr/bin/blobfuse-proxy" ];then
86-
old=$(sha256sum /host/usr/bin/blobfuse-proxy | awk '{print $1}')
87-
new=$(sha256sum /blobfuse-proxy/blobfuse-proxy | awk '{print $1}')
88-
if [ "$old" = "$new" ];then
89-
updateBlobfuseProxy="false"
90-
echo "no need to update blobfuse-proxy"
91-
fi
92-
fi
93-
94-
if [ "$updateBlobfuseProxy" = "true" ];then
95-
echo "copy blobfuse-proxy...."
96-
rm -rf /host/var/lib/kubelet/plugins/blob.csi.azure.com/blobfuse-proxy.sock
97-
rm -rf /host/usr/bin/blobfuse-proxy
98-
cp /blobfuse-proxy/blobfuse-proxy /host/usr/bin/blobfuse-proxy
99-
chmod 755 /host/usr/bin/blobfuse-proxy
100-
fi
101-
102-
updateService="true"
103-
if [ -f "/host/usr/lib/systemd/system/blobfuse-proxy.service" ];then
104-
old=$(sha256sum /host/usr/lib/systemd/system/blobfuse-proxy.service | awk '{print $1}')
105-
new=$(sha256sum /blobfuse-proxy/blobfuse-proxy.service | awk '{print $1}')
106-
if [ "$old" = "$new" ];then
107-
updateService="false"
108-
echo "no need to update blobfuse-proxy.service"
109-
fi
110-
fi
111-
112-
if [ "$updateService" = "true" ];then
113-
echo "copy blobfuse-proxy.service...."
114-
mkdir -p /host/usr/lib/systemd/system
115-
cp /blobfuse-proxy/blobfuse-proxy.service /host/usr/lib/systemd/system/blobfuse-proxy.service
116-
fi
117-
118-
if [ "${INSTALL_BLOBFUSE_PROXY}" = "true" ];then
119-
if [ "$updateBlobfuseProxy" = "true" ] || [ "$updateService" = "true" ];then
120-
echo "start blobfuse-proxy...."
121-
$HOST_CMD systemctl daemon-reload
122-
$HOST_CMD systemctl enable blobfuse-proxy.service
123-
$HOST_CMD systemctl restart blobfuse-proxy.service
124-
fi
125-
fi
126-
29+
echo "Linux distribution: $DISTRIBUTION, Arch: $ARCH"
30+
31+
# install blobfuse-proxy and blobfuse/blofuse2 if needed
32+
case "${DISTRIBUTION}" in
33+
"ubuntu")
34+
. ./blobfuse-proxy/install-proxy-ubuntu.sh
35+
;;
36+
"rhcos")
37+
. ./blobfuse-proxy/install-proxy-rhcos.sh
38+
;;
39+
"mariner")
40+
. ./blobfuse-proxy/install-proxy-mariner.sh
41+
;;
42+
*)
43+
echo "Unsupported distribution: ${DISTRIBUTION}"
44+
;;
45+
esac
46+
47+
# set max open file num
12748
if [ "${SET_MAX_OPEN_FILE_NUM}" = "true" ]
12849
then
12950
$HOST_CMD sysctl -w fs.file-max="${MAX_FILE_NUM}"
13051
fi
13152

53+
# disable updatedb
13254
updateDBConfigPath="/host/etc/updatedb.conf"
13355
if [ "${DISABLE_UPDATEDB}" = "true" ] && [ -f ${updateDBConfigPath} ]
13456
then
@@ -140,6 +62,7 @@ then
14062
cat ${updateDBConfigPath}
14163
fi
14264

65+
# set read ahead size
14366
if [ "${SET_READ_AHEAD_SIZE}" = "true" ]
14467
then
14568
echo "set read ahead size to ${READ_AHEAD_KB}KB"
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/bin/sh
2+
3+
# Copyright 2019 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -xe
18+
19+
# install blobfuse/blobfuse2
20+
echo "skip install blobfuse/blobfuse2 for mariner...."
21+
22+
# install blobfuse-proxy
23+
updateBlobfuseProxy="true"
24+
if [ -f "/host/usr/bin/blobfuse-proxy" ];then
25+
old=$(sha256sum /host/usr/bin/blobfuse-proxy | awk '{print $1}')
26+
new=$(sha256sum /blobfuse-proxy/blobfuse-proxy | awk '{print $1}')
27+
if [ "$old" = "$new" ];then
28+
updateBlobfuseProxy="false"
29+
echo "no need to update blobfuse-proxy"
30+
fi
31+
fi
32+
if [ "$updateBlobfuseProxy" = "true" ];then
33+
echo "copy blobfuse-proxy...."
34+
rm -rf /host/var/lib/kubelet/plugins/blob.csi.azure.com/blobfuse-proxy.sock
35+
rm -rf /host/usr/bin/blobfuse-proxy
36+
cp /blobfuse-proxy/blobfuse-proxy /host/usr/bin/blobfuse-proxy
37+
chmod 755 /host/usr/bin/blobfuse-proxy
38+
fi
39+
40+
updateService="true"
41+
if [ -f "/host/usr/lib/systemd/system/blobfuse-proxy.service" ];then
42+
old=$(sha256sum /host/usr/lib/systemd/system/blobfuse-proxy.service | awk '{print $1}')
43+
new=$(sha256sum /blobfuse-proxy/blobfuse-proxy.service | awk '{print $1}')
44+
if [ "$old" = "$new" ];then
45+
updateService="false"
46+
echo "no need to update blobfuse-proxy.service"
47+
fi
48+
fi
49+
if [ "$updateService" = "true" ];then
50+
echo "copy blobfuse-proxy.service...."
51+
mkdir -p /host/usr/lib/systemd/system
52+
cp /blobfuse-proxy/blobfuse-proxy.service /host/usr/lib/systemd/system/blobfuse-proxy.service
53+
fi
54+
55+
if [ "${INSTALL_BLOBFUSE_PROXY}" = "true" ];then
56+
if [ "$updateBlobfuseProxy" = "true" ] || [ "$updateService" = "true" ];then
57+
echo "start blobfuse-proxy...."
58+
$HOST_CMD systemctl daemon-reload
59+
$HOST_CMD systemctl enable blobfuse-proxy.service
60+
$HOST_CMD systemctl restart blobfuse-proxy.service
61+
fi
62+
fi
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#!/bin/sh
2+
3+
# Copyright 2019 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -xe
18+
19+
# in coreos, we could just copy the blobfuse2 binary to /usr/local/bin/blobfuse2
20+
if [ "${INSTALL_BLOBFUSE}" = "true" ] || [ "${INSTALL_BLOBFUSE2}" = "true" ]
21+
then
22+
echo "copy blobfuse2...."
23+
cp /usr/bin/blobfuse2 /host/usr/local/bin/blobfuse2
24+
fi
25+
26+
# install blobfuse-proxy
27+
updateBlobfuseProxy="true"
28+
if [ -f "/host/usr/local/bin/blobfuse-proxy" ];then
29+
old=$(sha256sum /host/usr/local/bin/blobfuse-proxy | awk '{print $1}')
30+
new=$(sha256sum /blobfuse-proxy/blobfuse-proxy | awk '{print $1}')
31+
if [ "$old" = "$new" ];then
32+
updateBlobfuseProxy="false"
33+
echo "no need to update blobfuse-proxy"
34+
fi
35+
fi
36+
if [ "$updateBlobfuseProxy" = "true" ];then
37+
echo "copy blobfuse-proxy...."
38+
rm -rf /host/var/lib/kubelet/plugins/blob.csi.azure.com/blobfuse-proxy.sock
39+
rm -rf /host/usr/local/bin/blobfuse-proxy
40+
cp /blobfuse-proxy/blobfuse-proxy /host/usr/local/bin/blobfuse-proxy
41+
chmod 755 /host/usr/local/bin/blobfuse-proxy
42+
fi
43+
44+
updateService="true"
45+
echo "change from /usr/bin/blobfuse-proxy to /usr/local/bin/blobfuse-proxy in blobfuse-proxy.service"
46+
sed -i 's/\/usr\/bin\/blobfuse-proxy/\/usr\/local\/bin\/blobfuse-proxy/g' /blobfuse-proxy/blobfuse-proxy.service
47+
if [ -f "/host/etc/systemd/system/blobfuse-proxy.service" ];then
48+
old=$(sha256sum /host/etc/systemd/system/blobfuse-proxy.service | awk '{print $1}')
49+
new=$(sha256sum /blobfuse-proxy/blobfuse-proxy.service | awk '{print $1}')
50+
if [ "$old" = "$new" ];then
51+
updateService="false"
52+
echo "no need to update blobfuse-proxy.service"
53+
fi
54+
fi
55+
if [ "$updateService" = "true" ];then
56+
echo "copy blobfuse-proxy.service...."
57+
mkdir -p /host/etc/systemd/system/
58+
cp /blobfuse-proxy/blobfuse-proxy.service /host/etc/systemd/system/blobfuse-proxy.service
59+
fi
60+
61+
if [ "${INSTALL_BLOBFUSE_PROXY}" = "true" ];then
62+
if [ "$updateBlobfuseProxy" = "true" ] || [ "$updateService" = "true" ];then
63+
echo "start blobfuse-proxy...."
64+
$HOST_CMD systemctl daemon-reload
65+
$HOST_CMD systemctl enable blobfuse-proxy.service
66+
$HOST_CMD systemctl restart blobfuse-proxy.service
67+
fi
68+
fi

0 commit comments

Comments
 (0)