diff --git a/pkg/blobfuse-proxy/install-proxy-rhcos.sh b/pkg/blobfuse-proxy/install-proxy-rhcos.sh index fa09c6bca8..91f51f8bcd 100644 --- a/pkg/blobfuse-proxy/install-proxy-rhcos.sh +++ b/pkg/blobfuse-proxy/install-proxy-rhcos.sh @@ -16,7 +16,7 @@ set -xe -# install blobfuse2 +# in coreos, we could just copy the blobfuse2 binary to /usr/local/bin/blobfuse2 if [ "${INSTALL_BLOBFUSE}" = "true" ] || [ "${INSTALL_BLOBFUSE2}" = "true" ] then echo "copy blobfuse2...." diff --git a/pkg/blobfuse-proxy/server/server.go b/pkg/blobfuse-proxy/server/server.go index 19c89c6f01..c93ec65056 100644 --- a/pkg/blobfuse-proxy/server/server.go +++ b/pkg/blobfuse-proxy/server/server.go @@ -115,14 +115,24 @@ func RunGRPCServer( } func getBlobfuseVersion() BlobfuseVersion { - osinfo, err := util.GetOSInfo("/etc/lsb-release") + osinfo, err := util.GetOSInfo("/etc/os-release") if err != nil { klog.Warningf("failed to get OS info: %v, default using blobfuse v1", err) return BlobfuseV1 } - if osinfo.Distro == "Ubuntu" && osinfo.Version >= "22.04" { - klog.V(2).Info("proxy default using blobfuse V2 for mounting") + if strings.EqualFold(osinfo.Distro, "mariner") && osinfo.Version >= "2.0" { + klog.V(2).Info("proxy default using blobfuse V2 for mounting on Mariner 2.0+") + return BlobfuseV2 + } + + if strings.EqualFold(osinfo.Distro, "rhcos") { + klog.V(2).Info("proxy default using blobfuse V2 for mounting on RHCOS") + return BlobfuseV2 + } + + if strings.EqualFold(osinfo.Distro, "ubuntu") && osinfo.Version >= "22.04" { + klog.V(2).Info("proxy default using blobfuse V2 for mounting on Ubuntu 22.04+") return BlobfuseV2 } diff --git a/pkg/util/util.go b/pkg/util/util.go index 6afc446007..b0552ef056 100644 --- a/pkg/util/util.go +++ b/pkg/util/util.go @@ -167,8 +167,8 @@ type OsInfo struct { } const ( - keyDistribID = "DISTRIB_ID" - keyDistribRelease = "DISTRIB_RELEASE" + keyID = "ID" + keyVersionID = "VERSION_ID" ) func GetOSInfo(f interface{}) (*OsInfo, error) { @@ -178,8 +178,8 @@ func GetOSInfo(f interface{}) (*OsInfo, error) { } oi := &OsInfo{} - oi.Distro = cfg.Section("").Key(keyDistribID).String() - oi.Version = cfg.Section("").Key(keyDistribRelease).String() + oi.Distro = cfg.Section("").Key(keyID).String() + oi.Version = cfg.Section("").Key(keyVersionID).String() klog.V(2).Infof("get OS info: %v", oi) return oi, nil diff --git a/pkg/util/util_test.go b/pkg/util/util_test.go index 77eab65b09..32cce6b364 100644 --- a/pkg/util/util_test.go +++ b/pkg/util/util_test.go @@ -271,10 +271,10 @@ func TestGetOSInfo(t *testing.T) { { name: "parse os info correctly", args: args{ - f: []byte("DISTRIB_ID=Ubuntu\nDISTRIB_RELEASE=22.04"), + f: []byte("ID=ubuntu\nVERSION_ID=\"22.04\""), }, want: &OsInfo{ - Distro: "Ubuntu", + Distro: "ubuntu", Version: "22.04", }, wantErr: false,