Skip to content
Snippets Groups Projects
Commit 275c6b35 authored by Jeremy Scott's avatar Jeremy Scott Committed by Derek Su
Browse files

Refactor volume type provisioning

parent 50819747
No related branches found
No related tags found
No related merge requests found
......@@ -282,16 +282,17 @@ func (p *LocalPathProvisioner) Provision(ctx context.Context, opts pvController.
fs := v1.PersistentVolumeFilesystem
var pvs v1.PersistentVolumeSource
if pvcVal, ok := opts.PVC.GetAnnotations()["volumeType"]; ok {
// volume type specified in PVC
pvs = createPersistentVolumeSource(pvcVal, path)
} else if scVal, ok := opts.StorageClass.GetAnnotations()["defaultVolumeType"]; ok {
// default volume type provided for storage class
pvs = createPersistentVolumeSource(scVal, path)
defaultVolumeType := "hostPath"
if dVal, ok := opts.StorageClass.GetAnnotations()["defaultVolumeType"]; ok {
defaultVolumeType = dVal
}
var volumeType string
if val, ok := opts.PVC.GetAnnotations()["volumeType"]; ok {
volumeType = val
} else {
// volume type unspecified, we default to hostPath
pvs = createPersistentVolumeSource("hostPath", path)
volumeType = defaultVolumeType
}
pvs = createPersistentVolumeSource(volumeType, path)
var nodeAffinity *v1.VolumeNodeAffinity
if sharedFS {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment