Skip to content

Commit

Permalink
Revert "fix: fix set volume without storage, set default volume type (#…
Browse files Browse the repository at this point in the history
…4180)" (#4278) (#4279)

This reverts commit 96a4fc2.

Co-authored-by: sixther <[email protected]>
  • Loading branch information
erda-bot and sixther-dc authored Mar 4, 2022
1 parent a46217d commit 6a73078
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -438,11 +438,6 @@ func setServiceVolumes(clusterName string, service *diceyml.Service, clusterinfo
if v.Path != "" && v.TargetPath != "" && v.Path != v.TargetPath {
return []apistructs.Volume{}, errors.New("if path and taragetPath set in volume, they must same.")
}

if v.TargetPath == "" && v.Path != "" {
v.TargetPath = v.Path
}

// 卷映射的容器目录合法性检查
if v.TargetPath == "" || v.TargetPath == "/" {
return []apistructs.Volume{}, errors.New(fmt.Sprintf("invalid targetPath [%s]", v.TargetPath))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1522,7 +1522,7 @@ func (fsm *DeployFSMContext) convertService(serviceName string, service *diceyml
oldTypeVolumes := make([]diceyml.Volume, 0)
newVolumes := make([]diceyml.Volume, 0)
for _, vol := range service.Volumes {
if vol.Path != "" {
if vol.Storage != "" {
oldTypeVolumes = append(oldTypeVolumes, vol)
} else {
newVolumes = append(newVolumes, vol)
Expand Down
2 changes: 1 addition & 1 deletion pkg/k8s/storage/detect_sc.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func VolumeTypeToSCName(diskType string, vendor string) (string, error) {
}
*/
case "":
return apistructs.DiceNFSVolumeSC, nil
return apistructs.DiceLocalVolumeSC, nil
//case apistructs.VolumeTypeOSS:
default:
return "", errors.New(fmt.Sprintf("unsupported disk type %s", diskType))
Expand Down
2 changes: 1 addition & 1 deletion pkg/k8s/storage/detect_sc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestVolumeTypeToSCName(t *testing.T) {
args: args{
vendor: apistructs.CSIVendorAlibaba,
},
want: apistructs.DiceNFSVolumeSC,
want: apistructs.DiceLocalVolumeSC,
wantErr: false,
},
{
Expand Down

0 comments on commit 6a73078

Please sign in to comment.