diff --git a/charts/latest/blob-csi-driver-v0.0.0.tgz b/charts/latest/blob-csi-driver-v0.0.0.tgz index 046171f22..9833a8921 100644 Binary files a/charts/latest/blob-csi-driver-v0.0.0.tgz and b/charts/latest/blob-csi-driver-v0.0.0.tgz differ diff --git a/charts/latest/blob-csi-driver/templates/csi-blob-node.yaml b/charts/latest/blob-csi-driver/templates/csi-blob-node.yaml index 7cdd28211..7d4f7680a 100644 --- a/charts/latest/blob-csi-driver/templates/csi-blob-node.yaml +++ b/charts/latest/blob-csi-driver/templates/csi-blob-node.yaml @@ -111,7 +111,7 @@ spec: - name: host-home-kubernetes-bin mountPath: /host/home/kubernetes/bin {{- end }} -{{- if eq .Values.linux.distro "gardenlinux" }} +{{- if or (eq .Values.linux.distro "gardenlinux") (eq .Values.linux.distro "flatcar") }} - name: host-var-bin mountPath: /host/var/bin {{- end }} @@ -300,7 +300,7 @@ spec: hostPath: path: /home/kubernetes/bin {{- end }} -{{- if eq .Values.linux.distro "gardenlinux" }} +{{- if or (eq .Values.linux.distro "gardenlinux") (eq .Values.linux.distro "flatcar") }} - name: host-var-bin hostPath: path: /var/bin diff --git a/pkg/blobfuse-proxy/init.sh b/pkg/blobfuse-proxy/init.sh index af4487c02..1e714fbe2 100755 --- a/pkg/blobfuse-proxy/init.sh +++ b/pkg/blobfuse-proxy/init.sh @@ -39,7 +39,7 @@ echo "Linux distribution: $DISTRIBUTION, Arch: $ARCH" # install blobfuse-proxy and blobfuse/blobfuse2 if needed case "${DISTRIBUTION}" in - "rhcos" | "rhel" | "cos" | "gardenlinux") + "rhcos" | "rhel" | "cos" | "gardenlinux" | "flatcar") . ./blobfuse-proxy/install-proxy-rhcos.sh ;; *) diff --git a/pkg/blobfuse-proxy/install-proxy-rhcos.sh b/pkg/blobfuse-proxy/install-proxy-rhcos.sh index 1fdbacedb..7c55803f9 100644 --- a/pkg/blobfuse-proxy/install-proxy-rhcos.sh +++ b/pkg/blobfuse-proxy/install-proxy-rhcos.sh @@ -16,19 +16,19 @@ set -xe -BIN_PATH=${BIN_PATH:-/usr/local/bin} -if [ "${DISTRIBUTION}" = "cos" ]; then - echo "set BIN_PATH to /home/kubernetes/bin" - BIN_PATH="/home/kubernetes/bin" -fi -if [ "${DISTRIBUTION}" = "gardenlinux" ]; then - echo "set BIN_PATH to /var/bin" - BIN_PATH="/var/bin" -fi -if [ "${CUSTOM_BIN_PATH}" != "" ]; then - echo "set BIN_PATH to ${CUSTOM_BIN_PATH}" - BIN_PATH="${CUSTOM_BIN_PATH}" +if [ -z "${CUSTOM_BIN_PATH:-}" ] ; then + case "${DISTRIBUTION}" in + "cos") + BIN_PATH="/home/kubernetes/bin" ;; + "gardenlinux" | "flatcar") + BIN_PATH="/var/bin" ;; + *) + BIN_PATH=${BIN_PATH:-/usr/local/bin} ;; + esac +else + BIN_PATH="/${CUSTOM_BIN_PATH#/}" fi +echo "set BIN_PATH to ${BIN_PATH}" #copy blobfuse2 binary to BIN_PATH/blobfuse2 updateBlobfuse2="true" @@ -50,6 +50,15 @@ if [ "$updateBlobfuse2" = "true" ];then echo "copy blobfuse2...." cp /usr/bin/blobfuse2 /host${BIN_PATH}/blobfuse2 --force chmod 755 /host${BIN_PATH}/blobfuse2 + if [ "$DISTRIBUTION" = "flatcar" ] ; then + find /usr/ -name 'libfuse.so.*' -exec cp '{}' /host${BIN_PATH} \; + mv /host${BIN_PATH}/blobfuse2 /host${BIN_PATH}/blobfuse2.bin + { + echo '#!/usr/bin/bash' + echo "LD_LIBRARY_PATH='${BIN_PATH}' exec ${BIN_PATH}/blobfuse2.bin \"\${@}\"" + } >/host${BIN_PATH}/blobfuse2 + chmod 755 /host${BIN_PATH}/blobfuse2 + fi fi if [ "${INSTALL_BLOBFUSE_PROXY}" = "true" ];then @@ -74,8 +83,9 @@ if [ "${INSTALL_BLOBFUSE_PROXY}" = "true" ];then echo "change from /usr/bin/blobfuse-proxy to ${BIN_PATH}/blobfuse-proxy in blobfuse-proxy.service" sed -i "s|/usr/bin/blobfuse-proxy|${BIN_PATH}/blobfuse-proxy|g" /blobfuse-proxy/blobfuse-proxy.service if [ "${BIN_PATH}" != "/usr/local/bin" ]; then - echo "add Environment=\"PATH=${BIN_PATH}:$PATH\" in blobfuse-proxy.service" - sed -i "/Delegate=yes/a Environment=\"PATH=${BIN_PATH}:\$PATH\"" /blobfuse-proxy/blobfuse-proxy.service + echo "add \"PATH=${BIN_PATH}:\$PATH\" in blobfuse-proxy.service ExecStart." + sed "s,^ExecStart[[:space:]]*=\\(.*\\)\$,ExecStart=/usr/bin/bash -c \"PATH=${BIN_PATH}:\$PATH \\1\"," \ + /blobfuse-proxy/blobfuse-proxy.service fi if [ -f "/host/etc/systemd/system/blobfuse-proxy.service" ];then old=$(sha256sum /host/etc/systemd/system/blobfuse-proxy.service | awk '{print $1}') diff --git a/pkg/blobfuse-proxy/server/server.go b/pkg/blobfuse-proxy/server/server.go index 9730c83dd..ab7c4bf96 100644 --- a/pkg/blobfuse-proxy/server/server.go +++ b/pkg/blobfuse-proxy/server/server.go @@ -150,6 +150,11 @@ func getBlobfuseVersion() BlobfuseVersion { return BlobfuseV2 } + if strings.EqualFold(osinfo.Distro, "flatcar") { + klog.V(2).Info("proxy default using blobfuse V2 for mounting on Flatcar Container Linux") + return BlobfuseV2 + } + klog.V(2).Info("proxy default using blobfuse V1 for mounting") return BlobfuseV1 }