mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Merge pull request #78532 from cwdsuzhou/simplify_construct_volume_spec
Simplify func ConstructVolumeSpec
This commit is contained in:
commit
365283e202
@ -482,20 +482,18 @@ func (p *csiPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.S
|
|||||||
var spec *volume.Spec
|
var spec *volume.Spec
|
||||||
inlineEnabled := utilfeature.DefaultFeatureGate.Enabled(features.CSIInlineVolume)
|
inlineEnabled := utilfeature.DefaultFeatureGate.Enabled(features.CSIInlineVolume)
|
||||||
|
|
||||||
|
// If inlineEnabled is true and mode is ephemeralDriverMode,
|
||||||
|
// use constructVolSourceSpec to construct volume source spec.
|
||||||
|
// If inlineEnabled is false or mode is persistentDriverMode,
|
||||||
|
// use constructPVSourceSpec to construct volume construct pv source spec.
|
||||||
if inlineEnabled {
|
if inlineEnabled {
|
||||||
mode := driverMode(volData[volDataKey.driverMode])
|
if driverMode(volData[volDataKey.driverMode]) == ephemeralDriverMode {
|
||||||
switch {
|
|
||||||
case mode == ephemeralDriverMode:
|
|
||||||
spec = p.constructVolSourceSpec(volData[volDataKey.specVolID], volData[volDataKey.driverName])
|
spec = p.constructVolSourceSpec(volData[volDataKey.specVolID], volData[volDataKey.driverName])
|
||||||
|
return spec, nil
|
||||||
|
|
||||||
case mode == persistentDriverMode:
|
|
||||||
fallthrough
|
|
||||||
default:
|
|
||||||
spec = p.constructPVSourceSpec(volData[volDataKey.specVolID], volData[volDataKey.driverName], volData[volDataKey.volHandle])
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
spec = p.constructPVSourceSpec(volData[volDataKey.specVolID], volData[volDataKey.driverName], volData[volDataKey.volHandle])
|
|
||||||
}
|
}
|
||||||
|
spec = p.constructPVSourceSpec(volData[volDataKey.specVolID], volData[volDataKey.driverName], volData[volDataKey.volHandle])
|
||||||
|
|
||||||
return spec, nil
|
return spec, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user