Skip to content

Commit ee3dfac

Browse files
committed
release 1.4.0-alpha1 the 1.4.0 will have some breaking changes, this is a test release
2 parents 7a71f48 + 8c244ea commit ee3dfac

11 files changed

Lines changed: 108 additions & 65 deletions

File tree

ReleaseNotes.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,13 @@ Initial test release of version 1.3.0 which includes the following changes:
2222
# [v1.3.2](https://github.com/xphyr/synology-csi/releases/tag/v1.3.2)
2323
- addressed issues with snapshotter not properly creating snapshots
2424
- **NOTE**: You will need to apply the new `deploy\kubernetes\v1.20\snapshotter\snapshotter.yaml` file to your cluster as this updates the external-csi snapshotter application as well as the ClusterRole required to make snapshotting work on clusters based on K8s V1.20 and higher
25-
- All go pkg imports are now pointed to xphyr/synology-csi
25+
26+
# v1.4.0
27+
This release introduces potentially **BREAKING CHANGES** If you are converting from the Upstream synology/synology-csi driver or a prior version of xphyr/synology-csi driver please read the following.
28+
- All go pkg imports are now pointed to xphyr/synology-csi
29+
- In order to start code cleanup, I have remvoed code that is duplicated by go built in packages such as `strconv.ParseBool()`. This means that use of the term "yes" in any configuration file is NO LONGER SUPPORTED. If your storageClass definition contains the word "yes" or "no" for settings, you need to update to "true" or "false". This also aligns with kubernetes defaults for boolean values
30+
- By default the Synology RecycleBin is DISABLED for NFS and SMB shares. If you want to use the #RecycleBin in your NFS or SMB shares, you will need to add
31+
- added new option for disabling the recycle bin on NFS/SMB shares
32+
- **NOTE:** This is a "breaking change". Previous releases enabled the recyclebin by default. This causes issues with many apps in K8s, so going forward all NEW shares will have the recyclebin disabled by default. You can enable the recyclebin by setting `recycleBin: true` in the storageClass definition file.
33+
- **NOTE:** This is also "breaking change". Previous releases with the recyclebin enabled only allowed "Administrator" access to the files in the recycleBin. This causes issues with many apps in K8s, so going forward all NEW shares that have the recyclebin enabled will allow anyone access to the recycleBin. You can change this recyclebin by setting `recycleBinAdminOnly: true` in the storageClass definition file.
34+
- removed the final deprecated function calls from k8s.io/mount-utils from code base

TODO.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,4 @@ The following is a list of tasks to bring the Synology CSI driver up to date.
3939
- [x] Fix Snapshotter functionality
4040
- CSI Snapshotter is based on version 4.2.1 (released in August of 2021) this needs to be updated to v6+
4141
- clusterRole needs to add additional privileges to work properly
42+
- [ ] Add support for the [csi-testing framework](https://github.com/kubernetes-csi/csi-test/tree/master)

pkg/driver/controllerserver.go

Lines changed: 49 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,10 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
136136

137137
isThin := true
138138
if params["thin_provisioning"] != "" {
139-
isThin = utils.StringToBoolean(params["thin_provisioning"])
139+
isThin, err = strconv.ParseBool(params["thin_provisioning"])
140+
if err != nil {
141+
return nil, status.Errorf(codes.InvalidArgument, "unsupported thin_provisioning setting: %s", params["thin_provisioning"])
142+
}
140143
}
141144

142145
protocol := strings.ToLower(params["protocol"])
@@ -159,6 +162,25 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
159162

160163
devAttribs := params["devAttribs"]
161164

165+
// capture recyclebin support for nfs/smb shares
166+
// by default we are DISABLING the recyclebin
167+
// recyclebin does not fit in the general storage model of Kubernetes
168+
enableRecycleBin := false
169+
if params["enableRecycleBin"] != "" {
170+
enableRecycleBin, err = strconv.ParseBool(params["enableRecycleBin"])
171+
if err != nil {
172+
return nil, status.Errorf(codes.InvalidArgument, "unsupported recyclebin setting: %s", params["enableRecycleBin"])
173+
}
174+
}
175+
recycleBinAdminOnly := false
176+
if params["recycleBinAdminOnly"] != "" && enableRecycleBin {
177+
// the recyclebin must be enabled for this option to be valid
178+
recycleBinAdminOnly, err = strconv.ParseBool(params["recycleBinAdminOnly"])
179+
if err != nil {
180+
return nil, status.Errorf(codes.InvalidArgument, "unsupported recyclebinadminonly setting: %s", params["recycleBinAdminOnly"])
181+
}
182+
}
183+
162184
lunDescription := ""
163185
if _, ok := params["csi.storage.k8s.io/pvc/name"]; ok {
164186
// if the /pvc/name is present, the namespace is present too
@@ -174,22 +196,24 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
174196
}
175197

176198
spec := &models.CreateK8sVolumeSpec{
177-
DsmIp: params["dsm"],
178-
K8sVolumeName: volName,
179-
LunName: models.GenLunName(volName),
180-
LunDescription: lunDescription,
181-
ShareName: models.GenShareName(volName),
182-
Location: params["location"],
183-
Size: sizeInByte,
184-
Type: params["type"],
185-
ThinProvisioning: isThin,
186-
TargetName: fmt.Sprintf("%s-%s", models.TargetPrefix, volName),
187-
MultipleSession: multiSession,
188-
SourceSnapshotId: srcSnapshotId,
189-
SourceVolumeId: srcVolumeId,
190-
Protocol: protocol,
191-
NfsVersion: nfsVer,
192-
DevAttribs: devAttribs,
199+
DsmIp: params["dsm"],
200+
K8sVolumeName: volName,
201+
LunName: models.GenLunName(volName),
202+
LunDescription: lunDescription,
203+
ShareName: models.GenShareName(volName),
204+
Location: params["location"],
205+
Size: sizeInByte,
206+
Type: params["type"],
207+
ThinProvisioning: isThin,
208+
TargetName: fmt.Sprintf("%s-%s", models.TargetPrefix, volName),
209+
MultipleSession: multiSession,
210+
SourceSnapshotId: srcSnapshotId,
211+
SourceVolumeId: srcVolumeId,
212+
Protocol: protocol,
213+
NfsVersion: nfsVer,
214+
DevAttribs: devAttribs,
215+
EnableRecycleBin: enableRecycleBin,
216+
RecycleBinAdminOnly: recycleBinAdminOnly,
193217
}
194218

195219
// idempotency
@@ -401,18 +425,24 @@ func (cs *controllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateS
401425
}, nil
402426
}
403427

428+
isLocked, err := strconv.ParseBool(params["is_locked"])
429+
if err != nil {
430+
log.Errorf("failed to parse the is_locked parameter. %s, is not a valid option", params["is_locked"])
431+
return nil, err
432+
}
433+
404434
// not exist, going to create a new snapshot
405435
spec := &models.CreateK8sVolumeSnapshotSpec{
406436
K8sVolumeId: srcVolId,
407437
SnapshotName: snapshotName,
408438
Description: params["description"],
409439
TakenBy: models.K8sCsiName,
410-
IsLocked: utils.StringToBoolean(params["is_locked"]),
440+
IsLocked: isLocked,
411441
}
412442

413443
snapshot, err := cs.dsmService.CreateSnapshot(spec)
414444
if err != nil {
415-
log.Errorf("Failed to CreateSnapshot, snapshotName: %s, srcVolId: %s, err: %v", snapshotName, srcVolId, err)
445+
log.Errorf("failed to CreateSnapshot, snapshotName: %s, srcVolId: %s, err: %v", snapshotName, srcVolId, err)
416446
return nil, err
417447
}
418448

pkg/driver/driver.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ import (
2424
)
2525

2626
const (
27-
DriverName = "csi.san.synology.com" // CSI dirver name
28-
DriverVersion = "1.2.0"
27+
DriverName = "csi.san.synology.com" // CSI driver name
28+
DriverVersion = "1.4.0-xphyr"
2929
)
3030

3131
var (

pkg/driver/nodeserver.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,31 +132,31 @@ func createTargetMountPathNFS(mounter mount.Interface, mountPath string, mountPe
132132
}
133133

134134
func createTargetMountPath(mounter mount.Interface, mountPath string, isBlock bool) (bool, error) {
135-
notMount, err := mount.IsNotMountPoint(mounter, mountPath)
135+
isMount, err := mounter.IsMountPoint(mountPath)
136136
if err != nil {
137137
if os.IsNotExist(err) {
138138
if isBlock {
139139
pathFile, err := os.OpenFile(mountPath, os.O_CREATE|os.O_RDWR, 0750)
140140
if err != nil {
141141
log.Errorf("Failed to create mountPath:%s with error: %v", mountPath, err)
142-
return notMount, err
142+
return isMount, err
143143
}
144144
if err = pathFile.Close(); err != nil {
145145
log.Errorf("Failed to close mountPath:%s with error: %v", mountPath, err)
146-
return notMount, err
146+
return isMount, err
147147
}
148148
} else {
149149
err = os.MkdirAll(mountPath, 0750)
150150
if err != nil {
151-
return notMount, err
151+
return isMount, err
152152
}
153153
}
154-
notMount = true
154+
isMount = true
155155
} else {
156156
return false, err
157157
}
158158
}
159-
return notMount, nil
159+
return isMount, nil
160160
}
161161

162162
func (ns *nodeServer) getPortals(dsmIp string) []string {

pkg/dsm/service/dsm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ func (service *DsmService) createMappingTarget(dsm *webapi.DSM, spec *models.Cre
180180
targetId, err := dsm.TargetCreate(targetSpec)
181181

182182
if err != nil && !errors.Is(err, utils.AlreadyExistError("")) {
183-
return webapi.TargetInfo{}, status.Errorf(codes.Internal, "%s", fmt.Sprintf("Failed to create target with spec: %v, err: %v", targetSpec, err))
183+
return webapi.TargetInfo{}, status.Errorf(codes.Internal, "%s", fmt.Sprintf("Failed to create target with spec: %v, err: %v, targetID: %v", targetSpec, err, targetId))
184184
}
185185

186186
targetInfo, err := dsm.TargetGet(targetSpec.Name)

pkg/dsm/service/share_volume.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ func (service *DsmService) createSMBorNFSVolumeByDsm(dsm *webapi.DSM, spec *mode
159159
VolPath: spec.Location,
160160
Desc: "Created by Synology K8s CSI",
161161
EnableShareCow: false,
162-
EnableRecycleBin: true,
163-
RecycleBinAdminOnly: true,
162+
EnableRecycleBin: spec.EnableRecycleBin,
163+
RecycleBinAdminOnly: spec.RecycleBinAdminOnly,
164164
Encryption: 0,
165165
QuotaForCreate: &sizeInMB,
166166
},

pkg/models/dsm_req_spec.go

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,24 @@ import (
1010
)
1111

1212
type CreateK8sVolumeSpec struct {
13-
DsmIp string
14-
K8sVolumeName string
15-
LunName string
16-
LunDescription string
17-
ShareName string
18-
Location string
19-
Size int64
20-
Type string
21-
ThinProvisioning bool
22-
TargetName string
23-
MultipleSession bool
24-
SourceSnapshotId string
25-
SourceVolumeId string
26-
Protocol string
27-
NfsVersion string
28-
DevAttribs string
13+
DsmIp string
14+
K8sVolumeName string
15+
LunName string
16+
LunDescription string
17+
ShareName string
18+
Location string
19+
Size int64
20+
Type string
21+
ThinProvisioning bool
22+
TargetName string
23+
MultipleSession bool
24+
SourceSnapshotId string
25+
SourceVolumeId string
26+
Protocol string
27+
NfsVersion string
28+
DevAttribs string
29+
EnableRecycleBin bool
30+
RecycleBinAdminOnly bool
2931
}
3032

3133
type K8sVolumeRespSpec struct {

pkg/utils/error.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,38 +25,38 @@ type ShareDefaultError struct {
2525
ErrCode int
2626
}
2727

28-
func (_ OutOfFreeSpaceError) Error() string {
28+
func (OutOfFreeSpaceError) Error() string {
2929
return "Out of free space"
3030
}
31-
func (_ AlreadyExistError) Error() string {
31+
func (AlreadyExistError) Error() string {
3232
return "Already Existed"
3333
}
34-
func (_ BadParametersError) Error() string {
34+
func (BadParametersError) Error() string {
3535
return "Invalid input value"
3636
}
3737

3838
// ISCSI errors
39-
func (_ NoSuchLunError) Error() string {
39+
func (NoSuchLunError) Error() string {
4040
return "No such LUN"
4141
}
4242

43-
func (_ LunReachMaxCountError) Error() string {
43+
func (LunReachMaxCountError) Error() string {
4444
return "Number of LUN reach limit"
4545
}
4646

47-
func (_ TargetReachMaxCountError) Error() string {
47+
func (TargetReachMaxCountError) Error() string {
4848
return "Number of target reach limit"
4949
}
5050

51-
func (_ NoSuchSnapshotError) Error() string {
51+
func (NoSuchSnapshotError) Error() string {
5252
return "No such snapshot uuid"
5353
}
5454

55-
func (_ BadLunTypeError) Error() string {
55+
func (BadLunTypeError) Error() string {
5656
return "Bad LUN type"
5757
}
5858

59-
func (_ SnapshotReachMaxCountError) Error() string {
59+
func (SnapshotReachMaxCountError) Error() string {
6060
return "Number of snapshot reach limit"
6161
}
6262

@@ -65,15 +65,15 @@ func (e IscsiDefaultError) Error() string {
6565
}
6666

6767
// Share errors
68-
func (_ NoSuchShareError) Error() string {
68+
func (NoSuchShareError) Error() string {
6969
return "No such share"
7070
}
7171

72-
func (_ ShareReachMaxCountError) Error() string {
72+
func (ShareReachMaxCountError) Error() string {
7373
return "Number of share reach limit"
7474
}
7575

76-
func (_ ShareSystemBusyError) Error() string {
76+
func (ShareSystemBusyError) Error() string {
7777
return "Share system is temporary busy"
7878
}
7979

pkg/utils/utils.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,6 @@ func BytesToMBCeil(size int64) int64 {
4646
return (size + UNIT_MB - 1) / UNIT_MB
4747
}
4848

49-
func StringToBoolean(value string) bool {
50-
value = strings.ToLower(value)
51-
return value == "yes" || value == "true" || value == "1"
52-
}
53-
5449
func StringToSlice(value string) []string {
5550
return strings.Fields(value)
5651
}

0 commit comments

Comments
 (0)