mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Merge pull request #112238 from demoManito/feat/optimize-ifelse
Optimize: correction code specification
This commit is contained in:
commit
64a38b165e
@ -211,7 +211,9 @@ func (attacher *awsElasticBlockStoreAttacher) MountDevice(spec *volume.Spec, dev
|
|||||||
mounter := attacher.host.GetMounter(awsElasticBlockStorePluginName)
|
mounter := attacher.host.GetMounter(awsElasticBlockStorePluginName)
|
||||||
notMnt, err := mounter.IsLikelyNotMountPoint(deviceMountPath)
|
notMnt, err := mounter.IsLikelyNotMountPoint(deviceMountPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if os.IsNotExist(err) {
|
if !os.IsNotExist(err) {
|
||||||
|
return err
|
||||||
|
}
|
||||||
dir := deviceMountPath
|
dir := deviceMountPath
|
||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS == "windows" {
|
||||||
// On Windows, FormatAndMount will mklink (create a symbolic link) at deviceMountPath later, so don't create a
|
// On Windows, FormatAndMount will mklink (create a symbolic link) at deviceMountPath later, so don't create a
|
||||||
@ -225,9 +227,6 @@ func (attacher *awsElasticBlockStoreAttacher) MountDevice(spec *volume.Spec, dev
|
|||||||
return fmt.Errorf("making dir %s failed with %s", dir, err)
|
return fmt.Errorf("making dir %s failed with %s", dir, err)
|
||||||
}
|
}
|
||||||
notMnt = true
|
notMnt = true
|
||||||
} else {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
volumeSource, readOnly, err := getVolumeSource(spec)
|
volumeSource, readOnly, err := getVolumeSource(spec)
|
||||||
@ -235,7 +234,7 @@ func (attacher *awsElasticBlockStoreAttacher) MountDevice(spec *volume.Spec, dev
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
options := []string{}
|
var options []string
|
||||||
if readOnly {
|
if readOnly {
|
||||||
options = append(options, "ro")
|
options = append(options, "ro")
|
||||||
}
|
}
|
||||||
|
@ -534,10 +534,10 @@ func (c *awsElasticBlockStoreProvisioner) Provision(selectedNode *v1.Node, allow
|
|||||||
pv.Spec.AccessModes = c.plugin.GetAccessModes()
|
pv.Spec.AccessModes = c.plugin.GetAccessModes()
|
||||||
}
|
}
|
||||||
|
|
||||||
requirements := make([]v1.NodeSelectorRequirement, 0)
|
requirements := make([]v1.NodeSelectorRequirement, 0, len(labels))
|
||||||
if len(labels) != 0 {
|
if len(labels) != 0 {
|
||||||
if pv.Labels == nil {
|
if pv.Labels == nil {
|
||||||
pv.Labels = make(map[string]string)
|
pv.Labels = make(map[string]string, len(labels))
|
||||||
}
|
}
|
||||||
for k, v := range labels {
|
for k, v := range labels {
|
||||||
pv.Labels[k] = v
|
pv.Labels[k] = v
|
||||||
|
@ -218,7 +218,7 @@ func verifyDevicePath(devicePaths []string) (string, error) {
|
|||||||
// This is more interesting on GCE (where we are able to identify volumes under /dev/disk-by-id)
|
// This is more interesting on GCE (where we are able to identify volumes under /dev/disk-by-id)
|
||||||
// Here it is mostly about applying the partition path
|
// Here it is mostly about applying the partition path
|
||||||
func getDiskByIDPaths(volumeID aws.KubernetesVolumeID, partition string, devicePath string) []string {
|
func getDiskByIDPaths(volumeID aws.KubernetesVolumeID, partition string, devicePath string) []string {
|
||||||
devicePaths := []string{}
|
var devicePaths []string
|
||||||
if devicePath != "" {
|
if devicePath != "" {
|
||||||
devicePaths = append(devicePaths, devicePath)
|
devicePaths = append(devicePaths, devicePath)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user