mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-02 11:18:16 +00:00
Merge pull request #51228 from wongma7/mount-options-sc
Automatic merge from submit-queue Add storageClass.mountOptions and use it in all applicable plugins split off from https://github.com/kubernetes/kubernetes/pull/50919 and still dependent on it. cc @gnufied issue: https://github.com/kubernetes/features/issues/168 ```release-note Add mount options field to StorageClass. The options listed there are automatically added to PVs provisioned using the class. ```
This commit is contained in:
@@ -1283,6 +1283,7 @@ func (ctrl *PersistentVolumeController) provisionClaimOperation(claimObj interfa
|
||||
|
||||
options := vol.VolumeOptions{
|
||||
PersistentVolumeReclaimPolicy: *storageClass.ReclaimPolicy,
|
||||
MountOptions: storageClass.MountOptions,
|
||||
CloudTags: &tags,
|
||||
ClusterName: ctrl.clusterName,
|
||||
PVName: pvName,
|
||||
@@ -1290,6 +1291,15 @@ func (ctrl *PersistentVolumeController) provisionClaimOperation(claimObj interfa
|
||||
Parameters: storageClass.Parameters,
|
||||
}
|
||||
|
||||
// Refuse to provision if the plugin doesn't support mount options, creation
|
||||
// of PV would be rejected by validation anyway
|
||||
if !plugin.SupportsMountOption() && len(options.MountOptions) > 0 {
|
||||
strerr := fmt.Sprintf("Mount options are not supported by the provisioner but StorageClass %q has mount options %v", storageClass.Name, options.MountOptions)
|
||||
glog.V(2).Infof("Mount options are not supported by the provisioner but claim %q's StorageClass %q has mount options %v", claimToClaimKey(claim), storageClass.Name, options.MountOptions)
|
||||
ctrl.eventRecorder.Event(claim, v1.EventTypeWarning, events.ProvisioningFailed, strerr)
|
||||
return
|
||||
}
|
||||
|
||||
// Provision the volume
|
||||
provisioner, err := plugin.NewProvisioner(options)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user