### Start Method Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/csi-grpc-interface.md Example of starting the gRPC server. ```go identityServer := driver.NewIdentityServer(drv) controllerServer := driver.NewControllerServer(drv) nodeServer := driver.NewNodeServer(drv) grpcServer := driver.NewNonBlockingGRPCServer() grpcServer.Start( "unix:///var/lib/kubelet/plugins/csi.san.synology.com/csi.sock", identityServer, controllerServer, nodeServer, ) ``` -------------------------------- ### Complete Server Startup Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/csi-grpc-interface.md A complete Go example demonstrating how to initialize and start the Synology CSI driver's gRPC server. ```go import ( "os" "os/signal" "syscall" "github.com/SynologyOpenSource/synology-csi/pkg/driver" "github.com/SynologyOpenSource/synology-csi/pkg/dsm/service" "github.com/SynologyOpenSource/synology-csi/pkg/dsm/common" log "github.com/sirupsen/logrus" ) func main() { // Configuration endpoint := "unix:///var/lib/kubelet/plugins/csi.san.synology.com/csi.sock" nodeID := "k8s-node-1" configPath := "/etc/synology/client-info.yml" // Load DSM configuration synoInfo, err := common.LoadConfig(configPath) if err != nil { log.Fatalf("Failed to load config: %v", err) } // Initialize DSM service dsmService := service.NewDsmService() for _, client := range synoInfo.Clients { if err := dsmService.AddDsm(client); err != nil { log.Warnf("Failed to add DSM: %v", err) } } defer dsmService.RemoveAllDsms() // Create tools tools := driver.NewTools(cmdExecutor) // Create driver drv, err := driver.NewControllerAndNodeDriver( nodeID, endpoint, dsmService, tools, ) if err != nil { log.Fatalf("Failed to create driver: %v", err) } // Create gRPC server grpcServer := driver.NewNonBlockingGRPCServer() // Create service implementations identityServer := driver.NewIdentityServer(drv) controllerServer := driver.NewControllerServer(drv) nodeServer := driver.NewNodeServer(drv) // Start server grpcServer.Start(endpoint, identityServer, controllerServer, nodeServer) log.Infof("CSI server started on %s", endpoint) // Wait for termination signal sigChan := make(chan os.Signal, 1) signal.Notify(sigChan, syscall.SIGTERM, os.Interrupt) sig := <-sigChan log.Infof("Received signal: %v", sig) grpcServer.Stop() grpcServer.Wait() log.Infof("CSI server stopped") } ``` -------------------------------- ### Starting the Driver Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/INDEX.md Example code for initializing and activating the CSI driver. ```go drv, _ := driver.NewControllerAndNodeDriver(nodeID, endpoint, dsmService, tools) drv.Activate() // Runs gRPC server in background ``` -------------------------------- ### Login Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/dsm-webapi.md Example of how to authenticate with DSM. ```go dsm := &webapi.DSM{ Ip: "192.168.1.100", Port: 5000, Username: "admin", Password: "password", Https: false, } err := dsm.Login() ``` -------------------------------- ### ClientInfo Usage Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/dsm-common.md Example of how to instantiate a ClientInfo struct. ```go client := common.ClientInfo{ Host: "192.168.1.100", Port: 5000, Https: false, Username: "admin", Password: "password", } ``` -------------------------------- ### Logout Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/dsm-webapi.md Example of how to defer logout. ```go defer dsm.Logout() ``` -------------------------------- ### ClientInfo Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/types.md Example configuration for ClientInfo. ```yaml host: 192.168.1.100 port: 5000 https: false username: admin password: synology ``` -------------------------------- ### VolumeList Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/dsm-webapi.md Example of listing volumes and printing free space. ```go volumes, err := dsm.VolumeList() for _, vol := range volumes { fmt.Printf("Volume %s: %s bytes free\n", vol.Path, vol.Free) } ``` -------------------------------- ### SynoInfo Usage Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/dsm-common.md Example of how to instantiate a SynoInfo struct with multiple clients. ```go info := &common.SynoInfo{ Clients: []common.ClientInfo{ { Host: "192.168.1.100", Port: 5000, Https: false, Username: "admin", Password: "password", }, { Host: "192.168.1.101", Port: 5001, Https: true, Username: "admin", Password: "password", }, }, } ``` -------------------------------- ### SynoInfo Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/types.md Example configuration for SynoInfo. ```yaml clients: - host: 192.168.1.100 port: 5000 https: false username: admin password: password1 - host: 192.168.1.101 port: 5001 https: true username: admin password: password2 ``` -------------------------------- ### Activate Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/driver.md Example of activating the CSI driver and keeping the server running. ```go drv.Activate() // Server is now running in background // Block until shutdown signal select {} ``` -------------------------------- ### NodePublishVolume Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/node-server.md Example request for mounting a volume into a pod. ```go req := &csi.NodePublishVolumeRequest{ VolumeId: "192.168.1.100:vol-uuid", StagingTargetPath: "/var/lib/kubelet/plugins/kubernetes.io/csi/pv/pv-abc/globalmount", TargetPath: "/var/lib/kubelet/pods/pod-abc/volumes/kubernetes.io~csi/pvc-123/mount", VolumeCapability: &csi.VolumeCapability{ AccessType: &csi.VolumeCapability_Mount{ Mount: &csi.VolumeCapability_MountVolume{ FsType: "ext4", }, }, }, Readonly: false, } resp, err := nodeServer.NodePublishVolume(ctx, req) ``` -------------------------------- ### Command-Line Flags Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/configuration.md Example of how to run the Synology CSI driver with various command-line flags. ```bash synology-csi-driver \ --nodeid k8s-node-1 \ --endpoint unix:///var/lib/kubelet/plugins/csi.san.synology.com/csi.sock \ --client-info /etc/synology/client-info.yml \ --log-level info \ --debug false \ --multipath true ``` -------------------------------- ### Get Helm Release Details Source: https://github.com/synologyopensource/synology-csi/blob/main/deploy/helm/templates/NOTES.txt Command to retrieve all details about the installed Helm release. ```bash helm get all {{ .Release.Name }} --namespace {{ .Release.Namespace }} ``` -------------------------------- ### CreateK8sVolumeSnapshotSpec Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/types.md Example usage of CreateK8sVolumeSnapshotSpec. ```go spec := &models.CreateK8sVolumeSnapshotSpec{ K8sVolumeId: "192.168.1.100:vol-uuid", SnapshotName: "snapshot-abc123", Description: "Automated backup", IsLocked: false, } snap, err := service.CreateSnapshot(spec) ``` -------------------------------- ### ListVolumes Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/dsm-service.md Example of how to list all Kubernetes volumes across all DSMs and print their names and sizes. ```go volumes := service.ListVolumes() for _, vol := range volumes { fmt.Printf("Volume: %s, Size: %d bytes\n", vol.Name, vol.SizeInBytes) } ``` -------------------------------- ### CreateSnapshot Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/dsm-service.md Example of creating a snapshot with a name, description, and lock status. ```go spec := &models.CreateK8sVolumeSnapshotSpec{ K8sVolumeId: "192.168.1.100:vol-uuid", SnapshotName: "snapshot-abc123", Description: "Backup snapshot", IsLocked: false, } snap, err := service.CreateSnapshot(spec) ``` -------------------------------- ### ExpandVolume Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/dsm-service.md Example of how to expand an existing volume to a new size (20 GB). ```go vol, err := service.ExpandVolume("192.168.1.100:uuid", 21474836480) // 20 GB ``` -------------------------------- ### Driver Activate Method Usage Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/csi-grpc-interface.md Example usage of the Driver.Activate() method to start the CSI driver server in the background. ```go drv, _ := driver.NewControllerAndNodeDriver(nodeID, endpoint, dsmService, tools) drv.Activate() // Server starts in background ``` -------------------------------- ### CreateVolume example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/controller-server.md Example of creating a new persistent volume using the CreateVolume method. ```go req := &csi.CreateVolumeRequest{ Name: "pvc-abc123", CapacityRange: &csi.CapacityRange{ RequiredBytes: 10737418240, // 10 GB }, VolumeCapabilities: []*csi.VolumeCapability{ { AccessMode: &csi.VolumeCapability_AccessMode{ Mode: csi.VolumeCapability_AccessMode_MULTI_NODE_MULTI_WRITER, }, AccessType: &csi.VolumeCapability_Mount{ Mount: &csi.VolumeCapability_MountVolume{ FsType: "nfs4", MountFlags: []string{"nfsvers=4.1"}, }, }, }, }, Parameters: map[string]string{ "protocol": "nfs", "dsm": "192.168.1.100", "location": "/volume1", }, } resp, err := controller.CreateVolume(ctx, req) if err != nil { log.Errorf("Failed to create volume: %v", err) } ``` -------------------------------- ### NewControllerAndNodeDriver Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/driver.md Example of creating and initializing a new CSI driver instance. ```go dsmService := service.NewDsmService() // Add DSM instances... tools := driver.NewTools(cmdExecutor) drv, err := driver.NewControllerAndNodeDriver( "k8s-node-1", "unix:///var/lib/kubelet/plugins/csi.san.synology.com/csi.sock", dsmService, tools, ) if err != nil { log.Fatal(err) } drv.Activate() ``` -------------------------------- ### NodeStageVolume Example Request Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/node-server.md Example of a NodeStageVolumeRequest. ```go req := &csi.NodeStageVolumeRequest{ VolumeId: "192.168.1.100:vol-uuid", StagingTargetPath: "/var/lib/kubelet/plugins/kubernetes.io/csi/pv/pv-abc/globalmount", VolumeCapability: &csi.VolumeCapability{ AccessType: &csi.VolumeCapability_Mount{ Mount: &csi.VolumeCapability_MountVolume{ FsType: "ext4", }, }, AccessMode: &csi.VolumeCapability_AccessMode{ Mode: csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER, }, }, VolumeContext: map[string]string{ "dsm": "192.168.1.100", "protocol": "iscsi", }, } resp, err := nodeServer.NodeStageVolume(ctx, req) ``` -------------------------------- ### Client Configuration File Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/configuration.md Example of a client-info.yml file specifying DSM connection details for two Synology NAS instances. ```yaml clients: - host: 192.168.1.100 port: 5000 https: false username: admin password: synology_password - host: 192.168.1.101 port: 5001 https: true username: admin password: synology_password ``` -------------------------------- ### LoadConfig Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/dsm-common.md Example demonstrating how to use the LoadConfig function to load and process DSM configurations. ```go import "github.com/SynologyOpenSource/synology-csi/pkg/dsm/common" config, err := common.LoadConfig("/etc/synology/client-info.yml") if err != nil { log.Fatalf("Failed to load config: %v", err) } // Access loaded configurations for _, client := range config.Clients { fmt.Printf("DSM: %s:%d (HTTPS: %v)\n", client.Host, client.Port, client.Https) } ``` -------------------------------- ### DeleteVolume Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/dsm-service.md Example of how to delete a volume using its ID. ```go err := service.DeleteVolume("192.168.1.100:550e8400-e29b-41d4-a716-446655440000") ``` -------------------------------- ### Creating Driver Instance Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/configuration.md Go code example for creating and activating the Synology CSI driver instance. ```go import ( "github.com/SynologyOpenSource/synology-csi/pkg/driver" "github.com/SynologyOpenSource/synology-csi/pkg/dsm/service" "github.com/SynologyOpenSource/synology-csi/pkg/dsm/common" "github.com/SynologyOpenSource/synology-csi/pkg/utils/hostexec" ) // Load DSM credentials config, err := common.LoadConfig("/etc/synology/client-info.yml") if err != nil { log.Fatal(err) } // Initialize DSM service dsmService := service.NewDsmService() for _, client := range config.Clients { if err := dsmService.AddDsm(client); err != nil { log.Warn(err) } } def dsmService.RemoveAllDsms() // Create command executor cmdMap := map[string]string{ "iscsiadm": "/usr/sbin/iscsiadm", "multipath": "/sbin/multipath", "multipathd": "/sbin/multipathd", "nvme": "/usr/sbin/nvme", } cmdExecutor, err := hostexec.New(cmdMap, "") if err != nil { log.Fatal(err) } tools := driver.NewTools(cmdExecutor) // Create driver drv, err := driver.NewControllerAndNodeDriver( "k8s-node-1", "unix:///var/lib/kubelet/plugins/csi.san.synology.com/csi.sock", dsmService, tools, ) if err != nil { log.Fatal(err) } // Start driver drv.Activate() ``` -------------------------------- ### ListVolumes Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/controller-server.md Example of how to call the ListVolumes function to retrieve a list of all volumes accessible via the driver, with pagination. ```Go resp, err := controller.ListVolumes(ctx, &csi.ListVolumesRequest{ MaxEntries: 100, }) for _, entry := range resp.Entries { fmt.Printf("Volume: %s, Size: %d\n", entry.Volume.VolumeId, entry.Volume.CapacityBytes) } ``` -------------------------------- ### NodeUnstageVolume Example Request Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/node-server.md Example of a NodeUnstageVolumeRequest. ```go resp, err := nodeServer.NodeUnstageVolume(ctx, &csi.NodeUnstageVolumeRequest{ VolumeId: "192.168.1.100:vol-uuid", StagingTargetPath: "/var/lib/kubelet/plugins/kubernetes.io/csi/pv/pv-abc/globalmount", }) ``` -------------------------------- ### NodeExpandVolume Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/node-server.md Example request for expanding a filesystem after the controller has expanded the volume. ```go resp, err := nodeServer.NodeExpandVolume(ctx, &csi.NodeExpandVolumeRequest{ VolumeId: "192.168.1.100:vol-uuid", VolumePath: "/var/lib/kubelet/pods/pod-abc/volumes/kubernetes.io~csi/pvc-123/mount", CapacityRange: &csi.CapacityRange{ RequiredBytes: 21474836480, // 20 GB }, }) ``` -------------------------------- ### NodeUnpublishVolume Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/node-server.md Example request for unmounting a volume from a pod. ```go resp, err := nodeServer.NodeUnpublishVolume(ctx, &csi.NodeUnpublishVolumeRequest{ VolumeId: "192.168.1.100:vol-uuid", TargetPath: "/var/lib/kubelet/pods/pod-abc/volumes/kubernetes.io~csi/pvc-123/mount", }) ``` -------------------------------- ### GetCapacity Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/controller-server.md Example of how to call the GetCapacity function to report storage capacity, with optional filtering by DSM or location. ```Go resp, err := controller.GetCapacity(ctx, &csi.GetCapacityRequest{ Parameters: map[string]string{ "dsm": "192.168.1.100", }, }) fmt.Printf("Available: %d bytes\n", resp.AvailableCapacity) ``` -------------------------------- ### ControllerExpandVolume Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/controller-server.md Example of how to call the ControllerExpandVolume method to expand a volume's capacity. ```go resp, err := controller.ControllerExpandVolume(ctx, &csi.ControllerExpandVolumeRequest{ VolumeId: "192.168.1.100:vol-uuid", CapacityRange: &csi.CapacityRange{ RequiredBytes: 21474836480, // 20 GB }, }) ``` -------------------------------- ### ByVolumeId Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/types.md Example of sorting volumes by ID using ByVolumeId. ```go volumes := service.ListVolumes() sort.Sort(models.ByVolumeId(volumes)) ``` -------------------------------- ### ShareSystemBusyError Catch Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/errors.md Example demonstrating retry logic with backoff for a ShareSystemBusyError. ```go var err error for i := 0; i < 3; i++ { err = dsm.ShareCreate(spec) if err != nil { if _, ok := err.(utils.ShareSystemBusyError); ok { time.Sleep(time.Duration(i+1) * time.Second) continue } } break } ``` -------------------------------- ### VolumeSnapshotClass Example Source: https://github.com/synologyopensource/synology-csi/blob/main/README.md Example YAML configuration for a Kubernetes VolumeSnapshotClass. ```yaml apiVersion: snapshot.storage.k8s.io/v1beta1 # v1 for kubernetes v1.20 and above kind: VolumeSnapshotClass metadata: name: synology-snapshotclass annotations: storageclass.kubernetes.io/is-default-class: "false" driver: csi.san.synology.com deletionPolicy: Delete # parameters: # description: 'Kubernetes CSI' # is_locked: 'false' ``` -------------------------------- ### Complete YAML Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/dsm-common.md A complete example of a DSM configuration YAML file with multiple client entries. ```yaml clients: - host: 192.168.1.100 port: 5000 https: false username: admin password: MyPassword123 - host: 192.168.1.101 port: 5001 https: true username: admin password: AnotherPassword456 - host: 10.0.0.50 port: 5000 https: false username: storage_admin password: StoragePass789 ``` -------------------------------- ### Endpoint Examples Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/csi-grpc-interface.md Examples of CSI endpoints. ```shell unix:///var/lib/kubelet/plugins/csi.san.synology.com/csi.sock tcp://localhost:50051 tcp://127.0.0.1:50051 ``` -------------------------------- ### Install the Chart Source: https://github.com/synologyopensource/synology-csi/blob/main/deploy/helm/README.md Installs the Synology CSI chart in a Kubernetes cluster. ```bash helm install synology-csi-chart/synology-csi ``` -------------------------------- ### CreateK8sVolumeSpec Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/types.md Example usage of CreateK8sVolumeSpec. ```go spec := &models.CreateK8sVolumeSpec{ DsmIp: "192.168.1.100", K8sVolumeName: "pvc-abc123", BackendName: "k8s-csi-pvc-abc123", Size: 10737418240, // 10 GB Location: "/volume1", Protocol: "iscsi", ThinProvisioning: true, } ``` -------------------------------- ### Creating a Volume Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/INDEX.md Example code for creating a Kubernetes volume. ```go spec := &models.CreateK8sVolumeSpec{ DsmIp: "192.168.1.100", K8sVolumeName: "pvc-abc", Size: 10737418240, Location: "/volume1", Protocol: "iscsi", } vol, err := dsmService.CreateVolume(spec) ``` -------------------------------- ### CreateSnapshot Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/controller-server.md Example of how to call the CreateSnapshot function to create a point-in-time snapshot of a volume, including optional parameters like description. ```Go resp, err := controller.CreateSnapshot(ctx, &csi.CreateSnapshotRequest{ Name: "snapshot-abc123", SourceVolumeId: "192.168.1.100:vol-uuid", Parameters: map[string]string{ "description": "Backup before upgrade", }, }) ``` -------------------------------- ### Install from Source using Makefile Source: https://github.com/synologyopensource/synology-csi/blob/main/deploy/helm/README.md Installs the Helm chart from a local source directory using the provided Makefile. ```bash $ make up ``` ```bash $ make ``` -------------------------------- ### DeleteVolume Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/controller-server.md Example of how to call the DeleteVolume function to delete a persistent volume from DSM. ```Go resp, err := controller.DeleteVolume(ctx, &csi.DeleteVolumeRequest{ VolumeId: "192.168.1.100:550e8400-e29b-41d4", }) ``` -------------------------------- ### NodeGetVolumeStats Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/node-server.md Example request for reporting volume usage statistics and printing the results. ```go resp, err := nodeServer.NodeGetVolumeStats(ctx, &csi.NodeGetVolumeStatsRequest{ VolumeId: "192.168.1.100:vol-uuid", VolumePath: "/var/lib/kubelet/pods/pod-abc/volumes/kubernetes.io~csi/pvc-123/mount", }) fmt.Printf("Used: %d, Available: %d, Total: %d\n", resp.Usage.UsedBytes, resp.Usage.AvailableBytes, resp.Usage.TotalBytes, ) ``` -------------------------------- ### Start Method Signature Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/csi-grpc-interface.md Signature for the Start method of the nonBlockingGRPCServer. ```go func (s *nonBlockingGRPCServer) Start(endpoint string, ids csi.IdentityServer, cs csi.ControllerServer, ns csi.NodeServer) ``` -------------------------------- ### ShareReachMaxCountError Catch Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/errors.md Example of how to catch a ShareReachMaxCountError when creating a share. ```go err := dsm.ShareCreate(spec) if err != nil { if _, ok := err.(utils.ShareReachMaxCountError); ok { log.Error("Share count limit exceeded") } } ``` -------------------------------- ### SanReachMaxCountError Catch Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/errors.md Example of how to catch a SanReachMaxCountError when creating an NVMe resource. ```go uuid, err := dsm.NamespaceCreate(spec) if err != nil { if _, ok := err.(utils.SanReachMaxCountError); ok { log.Error("NVMe resource limit exceeded") } } ``` -------------------------------- ### ForceStop Method Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/csi-grpc-interface.md Example of forcefully stopping the gRPC server. ```go grpcServer.ForceStop() ``` -------------------------------- ### Creating a Snapshot Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/INDEX.md Example code for creating a volume snapshot. ```go spec := &models.CreateK8sVolumeSnapshotSpec{ K8sVolumeId: "192.168.1.100:vol-uuid", SnapshotName: "snap-abc123", } snap, err := dsmService.CreateSnapshot(spec) ``` -------------------------------- ### File Permissions for Configuration Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/dsm-common.md Examples of how to set file permissions for the client-info.yml configuration file to restrict access. ```bash chmod 600 /etc/synology/client-info.yml # Root and system can read chmod 640 /etc/synology/client-info.yml ``` -------------------------------- ### NewNonBlockingGRPCServer Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/csi-grpc-interface.md Example of creating a new non-blocking gRPC server instance. ```go grpcServer := driver.NewNonBlockingGRPCServer() ``` -------------------------------- ### NoSuchShareError Catch Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/errors.md Example of how to catch a NoSuchShareError when attempting to delete a share. ```go err := dsm.ShareDelete(shareName) if err != nil { if _, ok := err.(utils.NoSuchShareError); ok { log.Error("Share not found") } } ``` -------------------------------- ### HTTPS Configuration Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/dsm-common.md YAML snippet demonstrating the recommended HTTPS configuration for production environments. ```yaml https: true port: 5001 ``` -------------------------------- ### HELM Installation Step 3 Source: https://github.com/synologyopensource/synology-csi/blob/main/README.md Deploy the CSI driver using Helm. ```bash cd deploy/helm; make up ``` -------------------------------- ### Catch Example for FailedToGetSubsystemError Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/errors.md Demonstrates how to catch and handle a `FailedToGetSubsystemError` when interacting with the DSM subsystem. ```go err := dsm.SubsystemCreate(spec) if err != nil { if _, ok := err.(utils.FailedToGetSubsystemError); ok { log.Error("Cannot access NVMe subsystem service") // May require DSM restart or service recovery } } ``` -------------------------------- ### HELM Installation Step 1 Source: https://github.com/synologyopensource/synology-csi/blob/main/README.md Create a namespace for the CSI driver and label it for privileged security. ```bash kubectl create ns synology-csi; kubectl label ns synology-csi pod-security.kubernetes.io/enforce=privileged --overwrite ``` -------------------------------- ### SMB Mount Options Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/node-server.md Example SMB/CIFS mount options. ```text vers=3.0 username= password= uid= gid= ``` -------------------------------- ### SMB/CIFS Protocol StorageClass Example Source: https://github.com/synologyopensource/synology-csi/blob/main/README.md Example YAML configuration for a StorageClass using the SMB/CIFS protocol, referencing a secret for credentials. ```yaml apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: synostorage-smb provisioner: csi.san.synology.com parameters: protocol: "smb" dsm: '192.168.1.1' location: '/volume1' csi.storage.k8s.io/node-stage-secret-name: "cifs-csi-credentials" csi.storage.k8s.io/node-stage-secret-namespace: "default" reclaimPolicy: Delete allowVolumeExpansion: true ``` -------------------------------- ### NFS Protocol StorageClass Example Source: https://github.com/synologyopensource/synology-csi/blob/main/README.md Example YAML configuration for a StorageClass using the NFS protocol. ```yaml apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: synostorage-nfs provisioner: csi.san.synology.com parameters: protocol: "nfs" dsm: "192.168.1.1" location: '/volume1' mountPermissions: '0755' mountOptions: - nfsvers=4.1 reclaimPolicy: Delete allowVolumeExpansion: true ``` -------------------------------- ### Stop Method Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/csi-grpc-interface.md Example of gracefully stopping the gRPC server on a signal. ```go // On signal sigChan := make(chan os.Signal, 1) signal.Notify(sigChan, syscall.SIGTERM, os.Interrupt) <- sigChan grpcServer.Stop() ``` -------------------------------- ### Troubleshooting: File Not Found Error Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/dsm-common.md Example error message and solution for when the configuration file cannot be found. ```text Unable to open config file: open /etc/synology/client-info.yml: no such file or directory Solution: Verify file path and ensure file exists with correct permissions ``` -------------------------------- ### NFS Mount Options Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/node-server.md Example NFS mount options. ```bash -t nfs -o nfsvers=4.1,rw ``` -------------------------------- ### HELM Installation Step 2 Source: https://github.com/synologyopensource/synology-csi/blob/main/README.md Create a Kubernetes secret for client information. ```bash kubectl create secret -n synology-csi generic client-info-secret --from-file=./config/client-info.yml ``` -------------------------------- ### ShareDefaultError Catch Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/errors.md Example of how to catch a generic ShareDefaultError for unmapped SMB/NFS API errors. ```go err := dsm.ShareCreate(spec) if err != nil { if shareErr, ok := err.(utils.ShareDefaultError); ok { log.Errorf("Unmapped share error: %d", shareErr.ErrCode) } } ``` -------------------------------- ### Multiple DSMs Configuration Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/dsm-common.md YAML snippet showing how to configure multiple DSM instances for load balancing. ```yaml clients: - host: 192.168.1.100 port: 5001 https: true username: admin password: pass1 - host: 192.168.1.101 port: 5001 https: true username: admin password: pass2 ``` -------------------------------- ### Install CSI Driver Source: https://github.com/synologyopensource/synology-csi/blob/main/README.md Commands for installing the Synology CSI driver on a Kubernetes cluster. ```bash ./scripts/deploy.sh install --all ``` ```bash ./scripts/deploy.sh install --basic ``` ```bash ./scripts/deploy.sh --help ``` -------------------------------- ### iSCSI Storage Class Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/configuration.md Example of a Kubernetes StorageClass definition for an iSCSI provisioned volume. ```yaml apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: synology-iscsi provisioner: csi.san.synology.com parameters: protocol: "iscsi" fsType: "btrfs" dsm: "192.168.1.100" location: "/volume1" formatOptions: "--nodiscard" enableSpaceReclamation: "false" enableFuaSyncCache: "false" reclaimPolicy: Retain allowVolumeExpansion: true volumeBindingMode: WaitForFirstConsumer ``` -------------------------------- ### Catch Example for SanDefaultError Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/errors.md Shows how to catch and handle a generic `SanDefaultError` for unmapped NVMe API errors. ```go err := dsm.NamespaceCreate(spec) if err != nil { if sanErr, ok := err.(utils.SanDefaultError); ok { log.Errorf("Unmapped NVMe error: %d", sanErr.ErrCode) } } ``` -------------------------------- ### Basic Deployment from Docker Image Source: https://github.com/synologyopensource/synology-csi/blob/main/README.md Command to install the CSI driver using a basic deployment by pulling the image from Docker. ```bash ./scripts/deploy.sh install --basic ``` -------------------------------- ### iSCSI Protocol StorageClass Example Source: https://github.com/synologyopensource/synology-csi/blob/main/README.md Example YAML configuration for a StorageClass using the iSCSI protocol. ```yaml apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: annotations: storageclass.kubernetes.io/is-default-class: "false" name: synostorage provisioner: csi.san.synology.com parameters: fsType: 'btrfs' dsm: '192.168.1.1' location: '/volume1' formatOptions: '--nodiscard' reclaimPolicy: Retain allowVolumeExpansion: true ``` -------------------------------- ### SMB/CIFS Protocol Secret Example Source: https://github.com/synologyopensource/synology-csi/blob/main/README.md Example YAML configuration for a Kubernetes Secret to store SMB/CIFS credentials. ```yaml apiVersion: v1 kind: Secret metadata: name: cifs-csi-credentials namespace: default type: Opaque stringData: username: # DSM user account accessing the shared folder password: # DSM user password accessing the shared folder ``` -------------------------------- ### Troubleshooting: Connection Refused Error Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/dsm-common.md Example error message and solution for network connection issues when trying to reach a DSM instance. ```text Failed to connect to DSM: [192.168.1.100]. err: connection refused Solution: Check DSM IP address, port, firewall rules, and DSM service status ``` -------------------------------- ### Basic Deployment using YAML Source: https://github.com/synologyopensource/synology-csi/blob/main/README.md Command to install the CSI driver with a basic deployment, excluding the snapshotter. ```bash ./scripts/deploy.sh build && ./scripts/deploy.sh install --basic ``` -------------------------------- ### Volume Identifier Format Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/INDEX.md Example of the volume and snapshot identifier format used by the Synology CSI driver. ```text {DSM_IP}:{UUID} Example: 192.168.1.100:550e8400-e29b-41d4-a716-446655440000 ``` -------------------------------- ### Troubleshooting: Invalid Credentials Error Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/dsm-common.md Example error message and solution for authentication failures when adding a DSM client. ```text Failed to login to DSM: [192.168.1.100]. err: response status: 401 Solution: Verify username, password, and that account exists on DSM ``` -------------------------------- ### Example client-info.yml configuration Source: https://github.com/synologyopensource/synology-csi/blob/main/README.md This YAML configuration defines the connection details for Synology NAS clients, including host, port, HTTPS status, username, and password. ```yaml clients: - host: 192.168.1.1 port: 5000 https: false username: password: - host: 192.168.1.2 port: 5001 https: true username: password: ``` -------------------------------- ### Adding a DSM Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/INDEX.md Example code for adding a DSM client to the service. ```go client := common.ClientInfo{ Host: "192.168.1.100", Port: 5000, Https: false, Username: "admin", Password: "password", } dsmService.AddDsm(client) ``` -------------------------------- ### Full Deployment using YAML Source: https://github.com/synologyopensource/synology-csi/blob/main/README.md Command to install the CSI driver with a full deployment, including the snapshotter. ```bash ./scripts/deploy.sh run ``` -------------------------------- ### Troubleshooting: YAML Parsing Error Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/dsm-common.md Example error message and solution for common YAML syntax errors. ```text Failed to parse config: yaml: line X: mapping values are not allowed in this context Solution: Check YAML indentation and syntax. Use YAML validator tool. ``` -------------------------------- ### Volume Snapshot Class Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/configuration.md Example Kubernetes VolumeSnapshotClass definition. ```yaml apiVersion: snapshot.storage.k8s.io/v1 kind: VolumeSnapshotClass metadata: name: synology-snapshotclass driver: csi.san.synology.com deletionPolicy: Delete parameters: description: "Kubernetes CSI Snapshot" is_locked: "false" ``` -------------------------------- ### NoSuchNamespaceError Catch Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/errors.md Example of how to catch a NoSuchNamespaceError when deleting a namespace. ```go err := dsm.NamespaceDelete(namespaceUuid) if err != nil { if _, ok := err.(utils.NoSuchNamespaceError); ok { log.Error("Namespace not found") } } ``` -------------------------------- ### Full Deployment from Docker Image Source: https://github.com/synologyopensource/synology-csi/blob/main/README.md Command to install the CSI driver using a full deployment by pulling the image from Docker. ```bash ./scripts/deploy.sh install --all ``` -------------------------------- ### Loading Client Configuration Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/configuration.md Go code snippet demonstrating how to load the client configuration file and add DSM instances to the service. ```go import "github.com/SynologyOpenSource/synology-csi/pkg/dsm/common" info, err := common.LoadConfig("/etc/synology/client-info.yml") if err != nil { log.Fatal(err) } for _, client := range info.Clients { dsmService.AddDsm(client) } ``` -------------------------------- ### SnapshotReachMaxCountError Catch Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/errors.md Example of how to catch a SnapshotReachMaxCountError when creating a snapshot. ```go uuid, err := dsm.SnapshotCreate(lunUuid, desc, locked) if err != nil { if _, ok := err.(utils.SnapshotReachMaxCountError); ok { log.Error("Snapshot limit reached on DSM") } } ``` -------------------------------- ### Connection Initialization Flow Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/dsm-common.md A step-by-step diagram illustrating the configuration loading and validation process. ```text 1. LoadConfig(path) ↓ 2. Parse YAML file ↓ 3. Validate ClientInfo structures ↓ 4. Return SynoInfo with Clients array ↓ 5. Application calls AddDsm(client) for each ↓ 6. DSM.Login() authenticates ↓ 7. DSM is ready for operations ``` -------------------------------- ### Go Integration with DSM Service Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/dsm-common.md Go code snippet demonstrating how to load configuration and initialize the DSM service, registering multiple DSM clients. ```go import ( "github.com/SynologyOpenSource/synology-csi/pkg/dsm/common" "github.com/SynologyOpenSource/synology-csi/pkg/dsm/service" ) // Load configuration synoInfo, err := common.LoadConfig("/etc/synology/client-info.yml") if err != nil { log.Fatal(err) } // Initialize service dsmService := service.NewDsmService() // Register all configured DSMs for _, client := range synoInfo.Clients { if err := dsmService.AddDsm(client); err != nil { log.Warnf("Failed to add DSM %s: %v", client.Host, err) } } // Service is ready to use ``` -------------------------------- ### Enter the directory Source: https://github.com/synologyopensource/synology-csi/blob/main/README.md Command to navigate into the cloned repository directory. ```bash cd synology-csi ``` -------------------------------- ### IscsiDefaultError Catch Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/errors.md Example of how to catch a generic IscsiDefaultError for unmapped iSCSI API errors. ```go err := dsm.LunCreate(spec) if err != nil { if iscsiErr, ok := err.(utils.IscsiDefaultError); ok { log.Errorf("Unmapped iSCSI error: %d", iscsiErr.ErrCode) // Check DSM release notes for error code meaning } } ``` -------------------------------- ### Wait Method Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/csi-grpc-interface.md Example of using the Wait method to block until the server stops. ```go grpcServer.Start(endpoint, ids, cs, ns) grpcServer.Wait() // Block forever ``` -------------------------------- ### Go Error Handling for Configuration Loading Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/dsm-common.md Go code snippet demonstrating how to load and validate the client configuration, including error handling for common issues. ```go config, err := common.LoadConfig(configPath) if err != nil { // File not found, unreadable, or invalid YAML log.Errorf("Configuration error: %v", err) return err } if len(config.Clients) == 0 { log.Error("No DSM clients configured") return fmt.Errorf("empty client list") } // Validate before use for _, c := range config.Clients { if c.Host == "" || c.Username == "" || c.Password == "" { return fmt.Errorf("invalid client config: missing required fields") } if c.Port < 1 || c.Port > 65535 { return fmt.Errorf("invalid port: %d", c.Port) } } ``` -------------------------------- ### gRPC Status Codes Example Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/csi-grpc-interface.md Example of how to return standard gRPC error codes for CSI operations in Go. ```go if volumeName == "" { return nil, status.Errorf(codes.InvalidArgument, "No volume name provided") } if !service.VolumeExists(volumeId) { return nil, status.Errorf(codes.NotFound, "Volume not found") } if service.IsFull() { return nil, status.Errorf(codes.ResourceExhausted, "Storage pool full") } ``` -------------------------------- ### Enable Configuration Debugging Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/dsm-common.md This Go code snippet demonstrates how to enable and use debug logging for loading DSM configurations, including error handling and logging loaded client details. ```go config, err := common.LoadConfig(path) if err != nil { log.Debugf("Config file: %s", path) log.Debugf("Error: %v", err) } log.Debugf("Loaded %d DSM configurations", len(config.Clients)) for i, c := range config.Clients { log.Debugf("[%d] Host: %s, Port: %d, HTTPS: %v, User: %s", i, c.Host, c.Port, c.Https, c.Username) } ``` -------------------------------- ### Check Helm Release Status Source: https://github.com/synologyopensource/synology-csi/blob/main/deploy/helm/templates/NOTES.txt Command to check the status of the installed Helm release. ```bash helm status {{ .Release.Name }} --namespace {{ .Release.Namespace }} ``` -------------------------------- ### SynoInfo Struct Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/dsm-common.md Container for all DSM configurations in a file. ```go type SynoInfo struct { Clients []ClientInfo `yaml:"clients"` } ``` -------------------------------- ### LunCreate Method Signature Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/dsm-webapi.md Creates a new iSCSI LUN. ```go func (dsm *DSM) LunCreate(spec LunCreateSpec) (string, error) ``` -------------------------------- ### Example Secret for Client Info Source: https://github.com/synologyopensource/synology-csi/blob/main/deploy/helm/README.md An example of a Kubernetes Secret containing client connection parameters and credentials for accessing a Synology Diskstation. ```yaml apiVersion: v1 kind: Secret metadata: name: -client-info data: client-info.yaml: |- Y2xpZW50czoKLSBob3N0OiAxOTIuMTY4LjEuMQogIGh0dHBzOiBmYWxzZQogIHBhc3N3b3JkOiBwYXNzd29yZAogIHBvcnQ6IDUwMDAKICB1c2VybmFtZTogdXNlcm5hbWU KLSBob3N0OiAxOTIuMTY4LjEuMQogIGh0dHBzOiBmYWxzZQogIHBhc3N3b3JkOiBwYXNzd29yZAogIHBvcnQ6IDUwMDEKICB1c2VybmFtZTogdXNlcm5hbWU= ``` -------------------------------- ### SubsystemCreate Function Signature Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/dsm-webapi.md Creates a new NVMe subsystem. ```Go func (dsm *DSM) SubsystemCreate(spec SubsystemCreateSpec) (string, error) ``` -------------------------------- ### NoSuchSnapshotError Type Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/errors.md Defines the NoSuchSnapshotError type and provides an example of how to catch it. ```Go type NoSuchSnapshotError string ``` ```Go err := dsm.SnapshotDelete(lunUuid, snapUuid) if err != nil { if _, ok := err.(utils.NoSuchSnapshotError); ok { log.Error("Snapshot not found") } } ``` -------------------------------- ### ClientInfo Struct Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/dsm-common.md Represents a single Synology NAS connection configuration. ```go type ClientInfo struct { Host string `yaml:"host"` Port int `yaml:"port"` Https bool `yaml:"https"` Username string `yaml:"username"` Password string `yaml:"password"` } ``` -------------------------------- ### TargetReachMaxCountError Type Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/errors.md Defines the TargetReachMaxCountError type and provides an example of how to catch it. ```Go type TargetReachMaxCountError string ``` ```Go targetId, err := dsm.TargetCreate(spec) if err != nil { if _, ok := err.(utils.TargetReachMaxCountError); ok { log.Error("Target count limit exceeded") } } ``` -------------------------------- ### ClientInfo Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/types.md DSM connection configuration. ```go type ClientInfo struct { Host string `yaml:"host"` // IPv4 address Port int `yaml:"port"` // Port number Https bool `yaml:"https"` // Use HTTPS Username string `yaml:"username"` // User account Password string `yaml:"password"` // User password } ``` -------------------------------- ### LunReachMaxCountError Type Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/errors.md Defines the LunReachMaxCountError type and provides an example of how to catch it. ```Go type LunReachMaxCountError string ``` ```Go uuid, err := dsm.LunCreate(spec) if err != nil { if _, ok := err.(utils.LunReachMaxCountError); ok { log.Error("LUN count limit exceeded on DSM") // May need to delete unused LUNs or upgrade DSM } } ``` -------------------------------- ### NoSuchLunError Type Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/errors.md Defines the NoSuchLunError type and provides an example of how to catch it. ```Go type NoSuchLunError string ``` ```Go err := dsm.LunDelete(lunUuid) if err != nil { if _, ok := err.(utils.NoSuchLunError); ok { log.Error("LUN not found") } } ``` -------------------------------- ### Protocols Constants Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/configuration.md Go constants for supported protocols. ```go const ( ProtocolSmb = "smb" // SMB/CIFS protocol ProtocolIscsi = "iscsi" // iSCSI protocol (default) ProtocolNfs = "nfs" // NFS protocol ProtocolNvme = "nvme" // NVMe/TCP protocol ) ``` -------------------------------- ### BadParametersError Type Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/errors.md Defines the BadParametersError type and provides an example of how to catch it. ```Go type BadParametersError string ``` ```Go cap, err := controller.CreateVolume(ctx, req) if err != nil { if strings.Contains(err.Error(), "Invalid") { log.Error("Bad parameter in request") } } ``` -------------------------------- ### AlreadyExistError Type Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/errors.md Defines the AlreadyExistError type and provides an example of how to catch it. ```Go type AlreadyExistError string ``` ```Go uuid, err := dsm.LunCreate(spec) if err != nil { if _, ok := err.(utils.AlreadyExistError); ok { log.Error("LUN name already exists") } } ``` -------------------------------- ### OutOfFreeSpaceError Type Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/errors.md Defines the OutOfFreeSpaceError type and provides an example of how to catch it. ```Go type OutOfFreeSpaceError string ``` ```Go vol, err := service.CreateVolume(spec) if err != nil { if _, ok := err.(utils.OutOfFreeSpaceError); ok { log.Error("Storage pool is full") } } ``` -------------------------------- ### ShareCreate Function Signature Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/dsm-webapi.md Creates a new shared folder. ```Go func (dsm *DSM) ShareCreate(spec ShareCreateSpec) error ``` -------------------------------- ### NFS Storage Class Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/configuration.md Example Kubernetes StorageClass definition for NFS protocol. ```yaml apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: synology-nfs provisioner: csi.san.synology.com parameters: protocol: "nfs" dsm: "192.168.1.100" location: "/volume1" mountPermissions: "0755" mountOptions: - nfsvers=4.1 reclaimPolicy: Delete allowVolumeExpansion: true ``` -------------------------------- ### LunClone Method Signature Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/dsm-webapi.md Creates a copy of an existing LUN. ```go func (dsm *DSM) LunClone(spec LunCloneSpec) (string, error) ``` -------------------------------- ### SMB Credentials Secret Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/configuration.md Example Kubernetes Secret definition for SMB/CIFS credentials. ```yaml apiVersion: v1 kind: Secret metadata: name: cifs-csi-credentials namespace: default type: Opaque stringData: username: password: ``` -------------------------------- ### SMB/CIFS Storage Class Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/configuration.md Example Kubernetes StorageClass definition for SMB/CIFS protocol. ```yaml apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: synology-smb provisioner: csi.san.synology.com parameters: protocol: "smb" dsm: "192.168.1.100" location: "/volume1" csi.storage.k8s.io/node-stage-secret-name: "cifs-csi-credentials" csi.storage.k8s.io/node-stage-secret-namespace: "default" reclaimPolicy: Delete allowVolumeExpansion: true ``` -------------------------------- ### File System Types Constants Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/configuration.md Go constants for file system types. ```go const ( FsTypeExt4 = "ext4" // ext4 filesystem FsTypeBtrfs = "btrfs" // btrfs filesystem ) ``` -------------------------------- ### iSCSI Mount Options Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/node-server.md Example iSCSI mount options for ext4 and btrfs filesystems. ```bash -t ext4 -o defaults -t btrfs -o defaults ``` -------------------------------- ### NamespaceCreate Function Signature Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/dsm-webapi.md Creates a new NVMe namespace. ```Go func (dsm *DSM) NamespaceCreate(spec NamespaceCreateSpec) (string, error) ``` -------------------------------- ### LunList Method Signature Source: https://github.com/synologyopensource/synology-csi/blob/main/_autodocs/dsm-webapi.md Lists all LUNs on DSM. ```go func (dsm *DSM) LunList() ([]LunInfo, error) ```