Add kubesystem check config by docker env
@@ -25,7 +25,7 @@ import (
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
"github.com/container-storage-interface/spec/lib/go/csi"
- "github.com/kubernetes-csi/drivers/pkg/csi-common"
+ csicommon "github.com/kubernetes-csi/drivers/pkg/csi-common"
log "github.com/sirupsen/logrus"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
@@ -94,10 +94,11 @@ const (
InputOutputErr = "input/output error"
// BLOCKVOLUMEPREFIX block volume mount prefix
BLOCKVOLUMEPREFIX = "/var/lib/kubelet/plugins/kubernetes.io/csi/volumeDevices/publish"
- // FileSystemLose ...
- FileSystemLose = float64(0.90)
)
+// FileSystemLose ...
+var FileSystemLose = float64(0.90)
+
// QueryResponse response struct for query server
type QueryResponse struct {
device string
@@ -725,7 +726,14 @@ func (ns *nodeServer) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandV
log.Errorf("NodeExpandVolume:: get diskCapacity error %+v", err)
return nil, status.Error(codes.Internal, err.Error())
}
- if diskCapacity <= requestGB && diskCapacity >= requestGB*FileSystemLose {
+ envValue := os.Getenv("FILE_SYSTEM_LOSE_PERCENT")
+ if envValue != "" {
+ percent, err := strconv.ParseFloat(envValue, 64)
+ if err == nil {
+ FileSystemLose = percent
+ }
+ }
+ if diskCapacity >= requestGB*FileSystemLose {
log.Infof("NodeExpandVolume:: resizefs successful volumeId: %s, devicePath: %s, volumePath: %s", diskID, devicePath, volumePath)
return &csi.NodeExpandVolumeResponse{}, nil
}
