mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-05-28 04:04:39 -04:00
Automatic merge from submit-queue (batch tested with PRs 59097, 57076, 59295). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. delete duplicate function for getting volume source **What this PR does / why we need it**: these two methods have same function. ```go func getVolumeSource( spec *volume.Spec) (*v1.GlusterfsVolumeSource, bool, error) { if spec.Volume != nil && spec.Volume.Glusterfs != nil { return spec.Volume.Glusterfs, spec.Volume.Glusterfs.ReadOnly, nil } else if spec.PersistentVolume != nil && spec.PersistentVolume.Spec.Glusterfs != nil { return spec.PersistentVolume.Spec.Glusterfs, spec.ReadOnly, nil } return nil, false, fmt.Errorf("Spec does not reference a Glusterfs volume type") } func (plugin *glusterfsPlugin) getGlusterVolumeSource(spec *volume.Spec) (*v1.GlusterfsVolumeSource, bool) { // Glusterfs volumes used directly in a pod have a ReadOnly flag set by the pod author. // Glusterfs volumes used as a PersistentVolume gets the ReadOnly flag indirectly through the persistent-claim volume used to mount the PV if spec.Volume != nil && spec.Volume.Glusterfs != nil { return spec.Volume.Glusterfs, spec.Volume.Glusterfs.ReadOnly } return spec.PersistentVolume.Spec.Glusterfs, spec.ReadOnly } ``` `getVolumeSource` seems to be much better. **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # **Special notes for your reviewer**: **Release note**: ```release-note NONE ``` |
||
|---|---|---|
| .. | ||
| aws_ebs | ||
| azure_dd | ||
| azure_file | ||
| cephfs | ||
| cinder | ||
| configmap | ||
| csi | ||
| downwardapi | ||
| empty_dir | ||
| fc | ||
| flexvolume | ||
| flocker | ||
| gce_pd | ||
| git_repo | ||
| glusterfs | ||
| host_path | ||
| iscsi | ||
| local | ||
| nfs | ||
| photon_pd | ||
| portworx | ||
| projected | ||
| quobyte | ||
| rbd | ||
| scaleio | ||
| secret | ||
| storageos | ||
| testing | ||
| util | ||
| validation | ||
| vsphere_volume | ||
| BUILD | ||
| doc.go | ||
| metrics_cached.go | ||
| metrics_du.go | ||
| metrics_du_test.go | ||
| metrics_errors.go | ||
| metrics_nil.go | ||
| metrics_nil_test.go | ||
| metrics_statfs.go | ||
| metrics_statfs_test.go | ||
| OWNERS | ||
| plugins.go | ||
| plugins_test.go | ||
| util.go | ||
| util_test.go | ||
| volume.go | ||
| volume_linux.go | ||
| volume_unsupported.go | ||