mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-12-05 13:17:42 +08:00
28 lines
835 B
Go
28 lines
835 B
Go
package util
|
|
|
|
import (
|
|
"strings"
|
|
|
|
dbmodel "github.com/goodrain/rainbond/db/model"
|
|
v1 "github.com/goodrain/rainbond/worker/appm/types/v1"
|
|
"github.com/goodrain/rainbond/worker/server/pb"
|
|
)
|
|
|
|
// ParseVolumeProviderKind parse volume provider kind
|
|
func ParseVolumeProviderKind(detail *pb.StorageClassDetail) string {
|
|
if detail.Name == v1.RainbondStatefuleShareStorageClass {
|
|
return dbmodel.ShareFileVolumeType.String()
|
|
}
|
|
if detail.Name == v1.RainbondStatefuleLocalStorageClass {
|
|
return dbmodel.LocalVolumeType.String()
|
|
}
|
|
if strings.HasSuffix(detail.Provisioner, "rbd") {
|
|
if detail.Parameters != nil {
|
|
if detail.Parameters["adminId"] != "" && detail.Parameters["monitors"] != "" && detail.Parameters["pool"] != "" && detail.Parameters["userId"] != "" {
|
|
return dbmodel.CephRBDVolumeType.String()
|
|
}
|
|
}
|
|
}
|
|
return ""
|
|
}
|