Skip to content

Commit ee9079f

Browse files
committed
Use better variable names in validation.go
Signed-off-by: Humble Chirammal <[email protected]>
1 parent 1b71126 commit ee9079f

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

pkg/apis/core/validation/validation.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const isNotIntegerErrorMsg string = `must be an integer`
6363
const isNotPositiveErrorMsg string = `must be greater than zero`
6464

6565
var pdPartitionErrorMsg string = validation.InclusiveRangeError(1, 255)
66-
var fileModeErrorMsg string = "must be a number between 0 and 0777 (octal), both inclusive"
66+
var fileModeErrorMsg = "must be a number between 0 and 0777 (octal), both inclusive"
6767

6868
// BannedOwners is a black list of object that are not allowed to be owners.
6969
var BannedOwners = apimachineryvalidation.BannedOwners
@@ -1305,8 +1305,8 @@ func validateAzureDisk(azure *core.AzureDiskVolumeSource, fldPath *field.Path) f
13051305
var supportedCachingModes = sets.NewString(string(core.AzureDataDiskCachingNone), string(core.AzureDataDiskCachingReadOnly), string(core.AzureDataDiskCachingReadWrite))
13061306
var supportedDiskKinds = sets.NewString(string(core.AzureSharedBlobDisk), string(core.AzureDedicatedBlobDisk), string(core.AzureManagedDisk))
13071307

1308-
diskUriSupportedManaged := []string{"/subscriptions/{sub-id}/resourcegroups/{group-name}/providers/microsoft.compute/disks/{disk-id}"}
1309-
diskUriSupportedblob := []string{"https://{account-name}.blob.core.windows.net/{container-name}/{disk-name}.vhd"}
1308+
diskURISupportedManaged := []string{"/subscriptions/{sub-id}/resourcegroups/{group-name}/providers/microsoft.compute/disks/{disk-id}"}
1309+
diskURISupportedblob := []string{"https://{account-name}.blob.core.windows.net/{container-name}/{disk-name}.vhd"}
13101310

13111311
allErrs := field.ErrorList{}
13121312
if azure.DiskName == "" {
@@ -1327,11 +1327,11 @@ func validateAzureDisk(azure *core.AzureDiskVolumeSource, fldPath *field.Path) f
13271327

13281328
// validate that DiskUri is the correct format
13291329
if azure.Kind != nil && *azure.Kind == core.AzureManagedDisk && strings.Index(azure.DataDiskURI, "/subscriptions/") != 0 {
1330-
allErrs = append(allErrs, field.NotSupported(fldPath.Child("diskURI"), azure.DataDiskURI, diskUriSupportedManaged))
1330+
allErrs = append(allErrs, field.NotSupported(fldPath.Child("diskURI"), azure.DataDiskURI, diskURISupportedManaged))
13311331
}
13321332

13331333
if azure.Kind != nil && *azure.Kind != core.AzureManagedDisk && strings.Index(azure.DataDiskURI, "https://") != 0 {
1334-
allErrs = append(allErrs, field.NotSupported(fldPath.Child("diskURI"), azure.DataDiskURI, diskUriSupportedblob))
1334+
allErrs = append(allErrs, field.NotSupported(fldPath.Child("diskURI"), azure.DataDiskURI, diskURISupportedblob))
13351335
}
13361336

13371337
return allErrs
@@ -4709,8 +4709,8 @@ func ValidateResourceRequirements(requirements *core.ResourceRequirements, fldPa
47094709
allErrs := field.ErrorList{}
47104710
limPath := fldPath.Child("limits")
47114711
reqPath := fldPath.Child("requests")
4712-
limContainsCpuOrMemory := false
4713-
reqContainsCpuOrMemory := false
4712+
limContainsCPUOrMemory := false
4713+
reqContainsCPUOrMemory := false
47144714
limContainsHugePages := false
47154715
reqContainsHugePages := false
47164716
supportedQoSComputeResources := sets.NewString(string(core.ResourceCPU), string(core.ResourceMemory))
@@ -4728,7 +4728,7 @@ func ValidateResourceRequirements(requirements *core.ResourceRequirements, fldPa
47284728
}
47294729

47304730
if supportedQoSComputeResources.Has(string(resourceName)) {
4731-
limContainsCpuOrMemory = true
4731+
limContainsCPUOrMemory = true
47324732
}
47334733
}
47344734
for resourceName, quantity := range requirements.Requests {
@@ -4754,11 +4754,11 @@ func ValidateResourceRequirements(requirements *core.ResourceRequirements, fldPa
47544754
reqContainsHugePages = true
47554755
}
47564756
if supportedQoSComputeResources.Has(string(resourceName)) {
4757-
reqContainsCpuOrMemory = true
4757+
reqContainsCPUOrMemory = true
47584758
}
47594759

47604760
}
4761-
if !limContainsCpuOrMemory && !reqContainsCpuOrMemory && (reqContainsHugePages || limContainsHugePages) {
4761+
if !limContainsCPUOrMemory && !reqContainsCPUOrMemory && (reqContainsHugePages || limContainsHugePages) {
47624762
allErrs = append(allErrs, field.Forbidden(fldPath, fmt.Sprintf("HugePages require cpu or memory")))
47634763
}
47644764

0 commit comments

Comments
 (0)