Skip to content

Commit

Permalink
Merge pull request kubernetes-sigs#205 from fredkan/v1.0.3-kata-confi…
Browse files Browse the repository at this point in the history
…gfile

change config file
  • Loading branch information
fredkan authored Mar 5, 2020
2 parents f542ca9 + b0d3754 commit aae7f49
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 15 deletions.
5 changes: 0 additions & 5 deletions pkg/agent/agent.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
package agent

const (
// CsiPluginRunTimeFlagFile tag
CsiPluginRunTimeFlagFile = "alibabacloudcsiplugin.json"
)

// Agent for node server
type Agent struct {
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/agent/queryserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (ks *QueryServer) volumeInfoHandler(w http.ResponseWriter, r *http.Request)
}

// Response with file content
fileName := filepath.Join(reqInfo.Identity, CsiPluginRunTimeFlagFile)
fileName := filepath.Join(reqInfo.Identity, utils.CsiPluginRunTimeFlagFile)
if utils.IsFileExisting(fileName) {
// Unmarshal file content to map
fileContent := utils.GetFileContent(fileName)
Expand Down
6 changes: 2 additions & 4 deletions pkg/disk/nodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ const (
VolumeDir = "/host/etc/kubernetes/volumes/disk/"
// VolumeDirRemove volume dir remove
VolumeDirRemove = "/host/etc/kubernetes/volumes/disk/remove"
// CsiPluginRunTimeFlagFile tag
CsiPluginRunTimeFlagFile = "alibabacloudcsiplugin.json"
// MixRunTimeMode support both runc and runv
MixRunTimeMode = "runc-runv"
// RunvRunTimeMode tag
Expand Down Expand Up @@ -198,7 +196,7 @@ func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis
}

// save volume info to local file
mountFile := filepath.Join(req.GetTargetPath(), CsiPluginRunTimeFlagFile)
mountFile := filepath.Join(req.GetTargetPath(), utils.CsiPluginRunTimeFlagFile)
if err := utils.CreateDest(req.GetTargetPath()); err != nil {
log.Errorf("NodePublishVolume(runv): Create Dest %s error: %s", req.GetTargetPath(), err.Error())
return nil, status.Error(codes.InvalidArgument, "NodePublishVolume(runv): Create Dest "+req.GetTargetPath()+" with error: "+err.Error())
Expand Down Expand Up @@ -320,7 +318,7 @@ func (ns *nodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpu

// check runtime mode
if GlobalConfigVar.RunTimeClass == MixRunTimeMode && utils.IsMountPointRunv(targetPath) {
fileName := filepath.Join(targetPath, CsiPluginRunTimeFlagFile)
fileName := filepath.Join(targetPath, utils.CsiPluginRunTimeFlagFile)
if err := os.Remove(fileName); err != nil {
msg := fmt.Sprintf("NodeUnpublishVolume: Remove Runv File %s with error: %s", fileName, err.Error())
return nil, status.Error(codes.InvalidArgument, msg)
Expand Down
6 changes: 2 additions & 4 deletions pkg/nas/nodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ const (
MixRunTimeMode = "runc-runv"
// RunvRunTimeMode tag
RunvRunTimeMode = "runv"
// CsiPluginRunTimeFlagFile tag
CsiPluginRunTimeFlagFile = "alibabacloudcsiplugin.json"
)

//newNodeServer create the csi node server
Expand Down Expand Up @@ -142,7 +140,7 @@ func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis
if err := utils.CreateDest(mountPath); err != nil {
return nil, errors.New("NodePublishVolume: create dest directory error: " + err.Error())
}
fileName := filepath.Join(mountPath, CsiPluginRunTimeFlagFile)
fileName := filepath.Join(mountPath, utils.CsiPluginRunTimeFlagFile)
runvOptions := RunvNasOptions{}
runvOptions.Options = opt.Options
runvOptions.Server = opt.Server
Expand Down Expand Up @@ -264,7 +262,7 @@ func (ns *nodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpu
log.Infof("NodeUnpublishVolume:: Starting Umount Nas Volume %s at path %s", req.VolumeId, req.TargetPath)
// check runtime mode
if GlobalConfigVar.RunTimeClass == MixRunTimeMode && utils.IsMountPointRunv(req.TargetPath) {
fileName := filepath.Join(req.TargetPath, CsiPluginRunTimeFlagFile)
fileName := filepath.Join(req.TargetPath, utils.CsiPluginRunTimeFlagFile)
if err := os.Remove(fileName); err != nil {
log.Errorf("NodeUnpublishVolume(runv): Remove local runv file with error %s", err.Error())
return nil, status.Error(codes.InvalidArgument, "NodeUnpublishVolume(runv): Remove local file with error "+err.Error())
Expand Down
2 changes: 1 addition & 1 deletion pkg/utils/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const (
// DefaultRegion is default region
DefaultRegion = "cn-hangzhou"
// CsiPluginRunTimeFlagFile tag
CsiPluginRunTimeFlagFile = "alibabacloudcsiplugin.json"
CsiPluginRunTimeFlagFile = "../alibabacloudcsiplugin.json"
// RuncRunTimeTag tag
RuncRunTimeTag = "runc"
// RunvRunTimeTag tag
Expand Down

0 comments on commit aae7f49

Please sign in to comment.