Skip to content

Commit

Permalink
Merge pull request kubernetes-sigs#857 from andyzhangx/proxy-install-…
Browse files Browse the repository at this point in the history
…specific-version

feat: support install specific blobfuse version using blobfuse-proxy
  • Loading branch information
k8s-ci-robot authored Apr 4, 2023
2 parents a47bc07 + 533af87 commit 07f79d4
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 21 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,15 @@ Please refer to `blob.csi.azure.com` [driver parameters](./docs/driver-parameter
This option does not depend on cloud provider config file, supports cross subscription and on-premise cluster scenario. Refer to [detailed steps](./deploy/example/e2e_usage.md#option2-bring-your-own-storage-account).

### Install driver on a Kubernetes cluster
> To install latest blobfuse v1 & v2 versions, run following command directly after driver is running on the agent node:
> To install specific blobfuse v1 version, run following command directly after driver is running on the agent node:
> ```console
> kubectl patch daemonset csi-blob-node -n kube-system -p '{"spec":{"template":{"spec":{"initContainers":[{"env":[{"name":"INSTALL_BLOBFUSE","value":"true"},{"name":"BLOBFUSE_VERSION","value":"1.4.5"}],"name":"install-blobfuse-proxy"}]}}}}'
> ```
>
> To install specific blobfuse v2 version, run following command directly after driver is running on the agent node:
> ```console
> kubectl patch daemonset csi-blob-node -n kube-system -p '{"spec":{"template":{"spec":{"initContainers":[{"env":[{"name":"INSTALL_BLOBFUSE2","value":"true"},{"name":"BLOBFUSE2_VERSION","value":"2.0.2"}],"name":"install-blobfuse-proxy"}]}}}}'
> ```
>
- install by [helm charts](./charts)
- install by [kubectl](./docs/install-blob-csi-driver.md)
Expand Down
6 changes: 4 additions & 2 deletions charts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,10 @@ The following table lists the configurable parameters of the latest Azure Blob S
| `node.logLevel` | node driver log level | `5` |
| `node.mountPermissions` | mounted folder permissions (only applies for NFS) | `0777`
| `node.enableBlobfuseProxy` | enable blobfuse-proxy on agent node | `false` |
| `node.blobfuseProxy.installBlobfuse` | whether install blobfuse on agent node| `true` |
| `node.blobfuseProxy.blobfuseVersion` | installed blobfuse version on agent node| `1.4.2` |
| `node.blobfuseProxy.installBlobfuse` | whether blobfuse should be installed on agent node| `true` |
| `node.blobfuseProxy.blobfuseVersion` | installed blobfuse version on agent node (if the value is empty, it means that the latest version should be installed.) | `` |
| `node.blobfuseProxy.installBlobfuse2` | whether blobfuse2 should be installed on agent node| `true` |
| `node.blobfuseProxy.blobfuse2Version` | installed blobfuse2 version on agent node (if the value is empty, it means that the latest version should be installed.) | ``
| `node.blobfuseProxy.setMaxOpenFileNum` | whether set max open file num on agent node| `true` |
| `node.blobfuseProxy.maxOpenFileNum` | max open file num on agent node| `9000000` |
| `node.blobfuseProxy.disableUpdateDB` | whether disable updateDB on blobfuse (saving storage account list usage) | `true` |
Expand Down
Binary file modified charts/latest/blob-csi-driver-v0.0.0.tgz
Binary file not shown.
4 changes: 4 additions & 0 deletions charts/latest/blob-csi-driver/templates/csi-blob-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ spec:
value: "{{ .Values.node.blobfuseProxy.installBlobfuse }}"
- name: BLOBFUSE_VERSION
value: "{{ .Values.node.blobfuseProxy.blobfuseVersion }}"
- name: INSTALL_BLOBFUSE2
value: "{{ .Values.node.blobfuseProxy.installBlobfuse2 }}"
- name: BLOBFUSE2_VERSION
value: "{{ .Values.node.blobfuseProxy.blobfuse2Version }}"
- name: SET_MAX_OPEN_FILE_NUM
value: "{{ .Values.node.blobfuseProxy.setMaxOpenFileNum }}"
- name: MAX_FILE_NUM
Expand Down
4 changes: 3 additions & 1 deletion charts/latest/blob-csi-driver/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ node:
enableBlobfuseProxy: false
blobfuseProxy:
installBlobfuse: true
blobfuseVersion: 1.4.5
blobfuseVersion: ""
installBlobfuse2: true
blobfuse2Version: ""
setMaxOpenFileNum: true
maxOpenFileNum: "9000000"
disableUpdateDB: true
Expand Down
10 changes: 7 additions & 3 deletions deploy/csi-blob-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,16 @@ spec:
env:
- name: DEBIAN_FRONTEND
value: "noninteractive"
- name: INSTALL_BLOBFUSE
value: "true"
- name: INSTALL_BLOBFUSE_PROXY
value: "true"
- name: INSTALL_BLOBFUSE
value: "true"
- name: BLOBFUSE_VERSION
value: 1.4.5
value: ""
- name: INSTALL_BLOBFUSE2
value: "true"
- name: BLOBFUSE2_VERSION
value: ""
- name: SET_MAX_OPEN_FILE_NUM
value: "true"
- name: MAX_FILE_NUM
Expand Down
47 changes: 40 additions & 7 deletions pkg/blobfuse-proxy/init.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,54 @@
set -xe

INSTALL_BLOBFUSE_PROXY=${INSTALL_BLOBFUSE_PROXY:-true}
INSTALL_BLOBFUSE=${INSTALL_BLOBFUSE:-true}
DISABLE_UPDATEDB=${DISABLE_UPDATEDB:-true}
SET_MAX_OPEN_FILE_NUM=${SET_MAX_OPEN_FILE_NUM:-true}
SET_READ_AHEAD_SIZE=${SET_READ_AHEAD_SIZE:-true}
READ_AHEAD_KB=${READ_AHEAD_KB:-15380}

HOST_CMD="nsenter --mount=/proc/1/ns/mnt"

# install/update blobfuse
if [ "${INSTALL_BLOBFUSE}" = "true" ]
if [ "${INSTALL_BLOBFUSE}" = "true" ] || [ "${INSTALL_BLOBFUSE2}" = "true" ]
then
cp /blobfuse-proxy/packages-microsoft-prod.deb /host/etc/
yes | $HOST_CMD dpkg -i /etc/packages-microsoft-prod.deb && \
$HOST_CMD apt update && \
$HOST_CMD apt-get install -y fuse blobfuse2 blobfuse="${BLOBFUSE_VERSION}" && \
# when running dpkg -i /etc/packages-microsoft-prod.deb, need to enter y to continue.
# refer to https://stackoverflow.com/questions/45349571/how-to-install-deb-with-dpkg-non-interactively
yes | $HOST_CMD dpkg -i /etc/packages-microsoft-prod.deb && $HOST_CMD apt update

pkg_list=""
if [ "${INSTALL_BLOBFUSE}" = "true" ]
then
pkg_list="${pkg_list} fuse"
# install blobfuse with latest version or specific version
if [ -z "${BLOBFUSE_VERSION}" ]; then
echo "install blobfuse with latest version"
pkg_list="${pkg_list} blobfuse"
else
pkg_list="${pkg_list} blobfuse=${BLOBFUSE_VERSION}"
fi
fi

if [ "${INSTALL_BLOBFUSE2}" = "true" ]
then
release=$($HOST_CMD lsb_release -rs)
if [ "$release" = "18.04" ]; then
echo "install fuse for blobfuse2"
pkg_list="${pkg_list} fuse"
else
echo "install fuse3 for blobfuse2, current release is $release"
pkg_list="${pkg_list} fuse3"
fi

# install blobfuse2 with latest version or specific version
if [ -z "${BLOBFUSE2_VERSION}" ]; then
echo "install blobfuse2 with latest version"
pkg_list="${pkg_list} blobfuse2"
else
pkg_list="${pkg_list} blobfuse2=${BLOBFUSE2_VERSION}"
fi
fi
echo "begin to install ${pkg_list}"
$HOST_CMD apt-get install -y $pkg_list
$HOST_CMD rm -f /etc/packages-microsoft-prod.deb
fi

Expand Down Expand Up @@ -102,4 +135,4 @@ then
SUBSYSTEM=="bdi", ACTION=="add", PROGRAM="$AWK_PATH -v bdi=\$kernel 'BEGIN{ret=1} {if (\$4 == bdi){ret=0}} END{exit ret}' /proc/fs/nfsfs/volumes", ATTR{read_ahead_kb}="$READ_AHEAD_KB"
EOF
$HOST_CMD udevadm control --reload
fi
fi
17 changes: 10 additions & 7 deletions test/utils/blob_log.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,14 @@ echo "==========================================================================
ip=`kubectl get svc csi-$DRIVER-controller -n kube-system | awk '{print $4}'`
curl http://$ip:29634/metrics

if [ -n "$ENABLE_BLOBFUSE_PROXY" ]; then
echo "print out install-blobfuse-proxy logs ..."
echo "======================================================================================"
LABEL="app=csi-$DRIVER-node"
PROXY=install-blobfuse-proxy
kubectl get pods -n${NS} -l${LABEL} \
| awk 'NR>1 {print $1}' \
| xargs -I {} kubectl logs {} --prefix -c${PROXY} -n${NS}
fi


echo "print out sysctl-install-blobfuseproxy logs ..."
echo "======================================================================================"
LABEL='app=csi-blobfuse-proxy'
PROXY=sysctl-install-blobfuse-proxy
kubectl get pods -n${NS} -l${LABEL} \
| awk 'NR>1 {print $1}' \
| xargs -I {} kubectl logs {} --prefix -c${PROXY} -n${NS}

0 comments on commit 07f79d4

Please sign in to comment.