Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat (provisioner-localpv): Support config device type #145

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cmd/provisioner-localpv/app/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ const (
// can be configured via the StorageClass annotations.
KeyPVBasePath = "BasePath"

//KeyPVDeviceType defines the type of device like
// sparse, disk, partition, lvm, crypt
KeyPVDeviceType = "DeviceType"

//KeyPVFSType defines filesystem type to be used with devices
// and can be configured via the StorageClass annotations.
KeyPVFSType = "FSType"
Expand Down
11 changes: 8 additions & 3 deletions cmd/provisioner-localpv/app/helper_blockdevice.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ type HelperBlockDeviceOptions struct {
//nodeAffinityLabels represents the labels of the node where pod should be launched.
nodeAffinityLabels map[string]string

capacity string
// deviceType string
bdcName string
capacity string
deviceType string
bdcName string

// volumeMode of PVC
volumeMode corev1.PersistentVolumeMode

Expand Down Expand Up @@ -126,6 +127,10 @@ func (p *Provisioner) createBlockDeviceClaim(ctx context.Context, blkDevOpts *He
WithFinalizer(LocalPVFinalizer).
WithBlockVolumeMode(blkDevOpts.volumeMode)

if blkDevOpts.deviceType != "" {
bdcObjBuilder.WithDeviceType(blkDevOpts.deviceType)
}

// if block device selectors are present, set it on the BDC
if blkDevOpts.bdSelectors != nil {
bdcObjBuilder.WithSelector(blkDevOpts.bdSelectors)
Expand Down
1 change: 1 addition & 0 deletions cmd/provisioner-localpv/app/provisioner_blockdevice.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ func (p *Provisioner) ProvisionBlockDevice(ctx context.Context, opts pvControlle
name: name,
nodeAffinityLabels: nodeAffinityLabels,
capacity: capacity.String(),
deviceType: volumeConfig.getValue(KeyPVDeviceType),
volumeMode: *opts.PVC.Spec.VolumeMode,
bdSelectors: volumeConfig.GetBlockDeviceSelectors(),
}
Expand Down