Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
ee9079f8
Commit
ee9079f8
authored
Apr 01, 2019
by
Humble Chirammal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use better variable names in validation.go
Signed-off-by:
Humble Chirammal
<
hchiramm@redhat.com
>
parent
1b711267
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
validation.go
pkg/apis/core/validation/validation.go
+10
-10
No files found.
pkg/apis/core/validation/validation.go
View file @
ee9079f8
...
@@ -63,7 +63,7 @@ const isNotIntegerErrorMsg string = `must be an integer`
...
@@ -63,7 +63,7 @@ const isNotIntegerErrorMsg string = `must be an integer`
const
isNotPositiveErrorMsg
string
=
`must be greater than zero`
const
isNotPositiveErrorMsg
string
=
`must be greater than zero`
var
pdPartitionErrorMsg
string
=
validation
.
InclusiveRangeError
(
1
,
255
)
var
pdPartitionErrorMsg
string
=
validation
.
InclusiveRangeError
(
1
,
255
)
var
fileModeErrorMsg
string
=
"must be a number between 0 and 0777 (octal), both inclusive"
var
fileModeErrorMsg
=
"must be a number between 0 and 0777 (octal), both inclusive"
// BannedOwners is a black list of object that are not allowed to be owners.
// BannedOwners is a black list of object that are not allowed to be owners.
var
BannedOwners
=
apimachineryvalidation
.
BannedOwners
var
BannedOwners
=
apimachineryvalidation
.
BannedOwners
...
@@ -1305,8 +1305,8 @@ func validateAzureDisk(azure *core.AzureDiskVolumeSource, fldPath *field.Path) f
...
@@ -1305,8 +1305,8 @@ func validateAzureDisk(azure *core.AzureDiskVolumeSource, fldPath *field.Path) f
var
supportedCachingModes
=
sets
.
NewString
(
string
(
core
.
AzureDataDiskCachingNone
),
string
(
core
.
AzureDataDiskCachingReadOnly
),
string
(
core
.
AzureDataDiskCachingReadWrite
))
var
supportedCachingModes
=
sets
.
NewString
(
string
(
core
.
AzureDataDiskCachingNone
),
string
(
core
.
AzureDataDiskCachingReadOnly
),
string
(
core
.
AzureDataDiskCachingReadWrite
))
var
supportedDiskKinds
=
sets
.
NewString
(
string
(
core
.
AzureSharedBlobDisk
),
string
(
core
.
AzureDedicatedBlobDisk
),
string
(
core
.
AzureManagedDisk
))
var
supportedDiskKinds
=
sets
.
NewString
(
string
(
core
.
AzureSharedBlobDisk
),
string
(
core
.
AzureDedicatedBlobDisk
),
string
(
core
.
AzureManagedDisk
))
diskU
ri
SupportedManaged
:=
[]
string
{
"/subscriptions/{sub-id}/resourcegroups/{group-name}/providers/microsoft.compute/disks/{disk-id}"
}
diskU
RI
SupportedManaged
:=
[]
string
{
"/subscriptions/{sub-id}/resourcegroups/{group-name}/providers/microsoft.compute/disks/{disk-id}"
}
diskU
ri
Supportedblob
:=
[]
string
{
"https://{account-name}.blob.core.windows.net/{container-name}/{disk-name}.vhd"
}
diskU
RI
Supportedblob
:=
[]
string
{
"https://{account-name}.blob.core.windows.net/{container-name}/{disk-name}.vhd"
}
allErrs
:=
field
.
ErrorList
{}
allErrs
:=
field
.
ErrorList
{}
if
azure
.
DiskName
==
""
{
if
azure
.
DiskName
==
""
{
...
@@ -1327,11 +1327,11 @@ func validateAzureDisk(azure *core.AzureDiskVolumeSource, fldPath *field.Path) f
...
@@ -1327,11 +1327,11 @@ func validateAzureDisk(azure *core.AzureDiskVolumeSource, fldPath *field.Path) f
// validate that DiskUri is the correct format
// validate that DiskUri is the correct format
if
azure
.
Kind
!=
nil
&&
*
azure
.
Kind
==
core
.
AzureManagedDisk
&&
strings
.
Index
(
azure
.
DataDiskURI
,
"/subscriptions/"
)
!=
0
{
if
azure
.
Kind
!=
nil
&&
*
azure
.
Kind
==
core
.
AzureManagedDisk
&&
strings
.
Index
(
azure
.
DataDiskURI
,
"/subscriptions/"
)
!=
0
{
allErrs
=
append
(
allErrs
,
field
.
NotSupported
(
fldPath
.
Child
(
"diskURI"
),
azure
.
DataDiskURI
,
diskU
ri
SupportedManaged
))
allErrs
=
append
(
allErrs
,
field
.
NotSupported
(
fldPath
.
Child
(
"diskURI"
),
azure
.
DataDiskURI
,
diskU
RI
SupportedManaged
))
}
}
if
azure
.
Kind
!=
nil
&&
*
azure
.
Kind
!=
core
.
AzureManagedDisk
&&
strings
.
Index
(
azure
.
DataDiskURI
,
"https://"
)
!=
0
{
if
azure
.
Kind
!=
nil
&&
*
azure
.
Kind
!=
core
.
AzureManagedDisk
&&
strings
.
Index
(
azure
.
DataDiskURI
,
"https://"
)
!=
0
{
allErrs
=
append
(
allErrs
,
field
.
NotSupported
(
fldPath
.
Child
(
"diskURI"
),
azure
.
DataDiskURI
,
diskU
ri
Supportedblob
))
allErrs
=
append
(
allErrs
,
field
.
NotSupported
(
fldPath
.
Child
(
"diskURI"
),
azure
.
DataDiskURI
,
diskU
RI
Supportedblob
))
}
}
return
allErrs
return
allErrs
...
@@ -4709,8 +4709,8 @@ func ValidateResourceRequirements(requirements *core.ResourceRequirements, fldPa
...
@@ -4709,8 +4709,8 @@ func ValidateResourceRequirements(requirements *core.ResourceRequirements, fldPa
allErrs
:=
field
.
ErrorList
{}
allErrs
:=
field
.
ErrorList
{}
limPath
:=
fldPath
.
Child
(
"limits"
)
limPath
:=
fldPath
.
Child
(
"limits"
)
reqPath
:=
fldPath
.
Child
(
"requests"
)
reqPath
:=
fldPath
.
Child
(
"requests"
)
limContainsC
pu
OrMemory
:=
false
limContainsC
PU
OrMemory
:=
false
reqContainsC
pu
OrMemory
:=
false
reqContainsC
PU
OrMemory
:=
false
limContainsHugePages
:=
false
limContainsHugePages
:=
false
reqContainsHugePages
:=
false
reqContainsHugePages
:=
false
supportedQoSComputeResources
:=
sets
.
NewString
(
string
(
core
.
ResourceCPU
),
string
(
core
.
ResourceMemory
))
supportedQoSComputeResources
:=
sets
.
NewString
(
string
(
core
.
ResourceCPU
),
string
(
core
.
ResourceMemory
))
...
@@ -4728,7 +4728,7 @@ func ValidateResourceRequirements(requirements *core.ResourceRequirements, fldPa
...
@@ -4728,7 +4728,7 @@ func ValidateResourceRequirements(requirements *core.ResourceRequirements, fldPa
}
}
if
supportedQoSComputeResources
.
Has
(
string
(
resourceName
))
{
if
supportedQoSComputeResources
.
Has
(
string
(
resourceName
))
{
limContainsC
pu
OrMemory
=
true
limContainsC
PU
OrMemory
=
true
}
}
}
}
for
resourceName
,
quantity
:=
range
requirements
.
Requests
{
for
resourceName
,
quantity
:=
range
requirements
.
Requests
{
...
@@ -4754,11 +4754,11 @@ func ValidateResourceRequirements(requirements *core.ResourceRequirements, fldPa
...
@@ -4754,11 +4754,11 @@ func ValidateResourceRequirements(requirements *core.ResourceRequirements, fldPa
reqContainsHugePages
=
true
reqContainsHugePages
=
true
}
}
if
supportedQoSComputeResources
.
Has
(
string
(
resourceName
))
{
if
supportedQoSComputeResources
.
Has
(
string
(
resourceName
))
{
reqContainsC
pu
OrMemory
=
true
reqContainsC
PU
OrMemory
=
true
}
}
}
}
if
!
limContainsC
puOrMemory
&&
!
reqContainsCpu
OrMemory
&&
(
reqContainsHugePages
||
limContainsHugePages
)
{
if
!
limContainsC
PUOrMemory
&&
!
reqContainsCPU
OrMemory
&&
(
reqContainsHugePages
||
limContainsHugePages
)
{
allErrs
=
append
(
allErrs
,
field
.
Forbidden
(
fldPath
,
fmt
.
Sprintf
(
"HugePages require cpu or memory"
)))
allErrs
=
append
(
allErrs
,
field
.
Forbidden
(
fldPath
,
fmt
.
Sprintf
(
"HugePages require cpu or memory"
)))
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment