Skip to content

Commit

Permalink
Added new PVC annotations to specify block size and file system type
Browse files Browse the repository at this point in the history
Added PVC annotation trident.netapp.io/blockSize to specify block/sector size for SolidFire backends. Possible values are 512 (for 512-byte sector emulation) and 4096. If unspecified, the default value of 512 is used.
Added PVC annotation trident.netapp.io/fileSystem to specify the file system type for iSCSI volumes. If unspecified, ext4 is used for the file system type.
Closes #33
Closes #37
  • Loading branch information
kangarlou committed Jul 7, 2017
1 parent 2f75804 commit 2281214
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 13 deletions.
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,9 @@ Volume configurations are unique to Trident and are unused in the nDVP.
| exportPolicy | string | No | For ONTAP backends, specifies the export policy to use. Ignored for SolidFire and E-Series. |
| snapshotDirectory | bool | No | For ONTAP backends, specifies whether the snapshot directory should be visible. Ignored for SolidFire and E-Series. |
| unixPermissions | string | No | For ONTAP backends, initial NFS permissions to set on the created volume. Ignored for SolidFire and E-Series. |
| blockSize | string | No | For SolidFire backends, specifies the block/sector size for the created volume. Possible values are 512 and 4096. If not specified, 512 will be used to enable 512B sector emulation. Ignored for ONTAP and E-Series. |
| fileSystem | string | No | For ONTAP SAN, SolidFire, and E-Series backends, specifies the file system for the created volume. If not specified, `ext4` will be set as the file system. Ignored for ONTAP NAS. |


As mentioned, Trident generates internalName when creating the volume. This
consists of two steps. First, it prepends the storage prefix--either the
Expand Down Expand Up @@ -972,13 +975,16 @@ corresponding PV, Trident follows the following rules:
* Other volume configuration parameters can be specified using the following
PVC annotations:
| Annotation | Volume Parameter |
| ---------- | ---------------- |
| `trident.netapp.io/protocol` | `protocol` |
| `trident.netapp.io/exportPolicy` | `exportPolicy`|
| `trident.netapp.io/snapshotPolicy` | `snapshotPolicy`|
| `trident.netapp.io/snapshotDirectory` | `snapshotDirectory`|
| `trident.netapp.io/unixPermissions` | `unixPermissions`|
| Annotation | Volume Parameter | Supported Drivers |
| ---------- | ---------------- | ----------------- |
| `trident.netapp.io/protocol` | `protocol` | `ontap-nas`, `ontap-san`, `solidfire-san` |
| `trident.netapp.io/exportPolicy` | `exportPolicy`| `ontap-nas`, `ontap-san` |
| `trident.netapp.io/snapshotPolicy` | `snapshotPolicy`| `ontap-nas`, `ontap-san` |
| `trident.netapp.io/snapshotDirectory` | `snapshotDirectory`| `ontap-nas` |
| `trident.netapp.io/unixPermissions` | `unixPermissions`| `ontap-nas` |
| `trident.netapp.io/blockSize` | `blockSize`| `solidfire-san` |
| `trident.netapp.io/fileSystem` | `fileSystem` | `ontap-san`, `solidfire-san`, `eseries-iscsi` |
| `trident.netapp.io/reclaimPolicy` | N/A | N/A |
The reclaim policy for the created PV can be determined by setting the
annotation `trident.netapp.io/reclaimPolicy` in the PVC to either `Delete` or
Expand Down
2 changes: 2 additions & 0 deletions frontend/kubernetes/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ const (
AnnVendor = AnnPrefix + "/vendor"
AnnBackendID = AnnPrefix + "/backendID"
AnnExportPolicy = AnnPrefix + "/exportPolicy"
AnnBlockSize = AnnPrefix + "/blockSize"
AnnFileSystem = AnnPrefix + "/fileSystem"

// Minimum and maximum supported Kubernetes versions
KubernetesVersionMin = "v1.4.0"
Expand Down
7 changes: 6 additions & 1 deletion frontend/kubernetes/volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ func getVolumeConfig(
} else {
accessMode = config.AccessMode(accessModes[0])
}
if getAnnotation(annotations, AnnFileSystem) == "" {
annotations[AnnFileSystem] = "ext4"
}
return &storage.VolumeConfig{
Name: name,
Size: fmt.Sprintf("%d", size.Value()),
Expand All @@ -86,6 +89,8 @@ func getVolumeConfig(
SnapshotDir: getAnnotation(annotations, AnnSnapshotDir),
UnixPermissions: getAnnotation(annotations, AnnUnixPermissions),
StorageClass: getAnnotation(annotations, AnnClass),
BlockSize: getAnnotation(annotations, AnnBlockSize),
FileSystem: getAnnotation(annotations, AnnFileSystem),
AccessMode: accessMode,
}
}
Expand All @@ -103,6 +108,6 @@ func CreateISCSIVolumeSource(volConfig *storage.VolumeConfig) *v1.ISCSIVolumeSou
IQN: volConfig.AccessInfo.IscsiTargetIQN,
Lun: volConfig.AccessInfo.IscsiLunNumber,
ISCSIInterface: volConfig.AccessInfo.IscsiInterface,
FSType: "ext4",
FSType: volConfig.FileSystem,
}
}
6 changes: 3 additions & 3 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ import:
- jlexer
- jwriter
- package: github.com/netapp/netappdvp
version: b5b73c6d71b91c7c9c86acc317bd181cbe5453db
version: b37188a9ddf361ab7ea0d7acfe29f9f5acc9a2df
subpackages:
- apis/eseries
- apis/ontap
Expand Down
4 changes: 3 additions & 1 deletion storage/solidfire/solidfire_san.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ func (d *SolidfireSANStorageDriver) GetVolumeOpts(
) (map[string]string, error) {
opts := make(map[string]string)
opts["type"] = pool.Name

if volConfig.BlockSize != "" {
opts["blocksize"] = volConfig.BlockSize
}
return opts, nil
}

Expand Down
2 changes: 2 additions & 0 deletions storage/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ type VolumeConfig struct {
StorageClass string `json:"storageClass,omitempty"`
AccessMode config.AccessMode `json:"accessMode,omitempty"`
AccessInfo VolumeAccessInfo `json:"accessInformation"`
BlockSize string `json:"blockSize"`
FileSystem string `json:"fileSystem"`
}

type VolumeAccessInfo struct {
Expand Down

0 comments on commit 2281214

Please sign in to comment.