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
4b8050e3
Commit
4b8050e3
authored
Aug 23, 2018
by
Tim Allclair
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address @thockin feedback
parent
87164e0b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
17 deletions
+23
-17
util.go
pkg/api/pod/util.go
+2
-2
types.go
pkg/apis/core/types.go
+5
-3
validation.go
pkg/apis/core/validation/validation.go
+9
-7
validation_test.go
pkg/apis/core/validation/validation_test.go
+2
-2
types.go
staging/src/k8s.io/api/core/v1/types.go
+5
-3
No files found.
pkg/api/pod/util.go
View file @
4b8050e3
...
...
@@ -259,8 +259,8 @@ func DropDisabledAlphaFields(podSpec *api.PodSpec) {
DropDisabledRunAsGroupField
(
podSpec
)
if
!
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
RuntimeClass
)
&&
podSpec
.
RuntimeClassName
!=
""
{
podSpec
.
RuntimeClassName
=
""
if
!
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
RuntimeClass
)
&&
podSpec
.
RuntimeClassName
!=
nil
{
podSpec
.
RuntimeClassName
=
nil
}
}
...
...
pkg/apis/core/types.go
View file @
4b8050e3
...
...
@@ -2571,12 +2571,14 @@ type PodSpec struct {
// More info: https://github.com/kubernetes/community/blob/master/keps/sig-network/0007-pod-ready%2B%2B.md
// +optional
ReadinessGates
[]
PodReadinessGate
// RuntimeClassName refers to a RuntimeClass object with the same name, which should be used to
// run this pod. If no RuntimeClass resource matches the named class, the pod will not be run.
// RuntimeClassName refers to a RuntimeClass object in the node.k8s.io group, which should be used
// to run this pod. If no RuntimeClass resource matches the named class, the pod will not be run.
// If unset or empty, the "legacy" RuntimeClass will be used, which is an implicit class with an
// empty definition that uses the default runtime handler.
// More info: https://github.com/kubernetes/community/blob/master/keps/sig-node/0014-runtime-class.md
// This is an alpha feature and may change in the future.
// +optional
RuntimeClassName
string
RuntimeClassName
*
string
}
// HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the
...
...
pkg/apis/core/validation/validation.go
View file @
4b8050e3
...
...
@@ -259,7 +259,13 @@ var ValidatePriorityClassName = apimachineryvalidation.NameIsDNSSubdomain
// ValidateRuntimeClassName can be used to check whether the given RuntimeClass name is valid.
// Prefix indicates this name will be used as part of generation, in which case
// trailing dashes are allowed.
var
ValidateRuntimeClassName
=
apimachineryvalidation
.
NameIsDNSSubdomain
func
ValidateRuntimeClassName
(
name
string
,
fldPath
*
field
.
Path
)
field
.
ErrorList
{
var
allErrs
field
.
ErrorList
for
_
,
msg
:=
range
apimachineryvalidation
.
NameIsDNSSubdomain
(
name
,
false
)
{
allErrs
=
append
(
allErrs
,
field
.
Invalid
(
fldPath
,
name
,
msg
))
}
return
allErrs
}
// Validates that given value is not negative.
func
ValidateNonnegativeField
(
value
int64
,
fldPath
*
field
.
Path
)
field
.
ErrorList
{
...
...
@@ -3004,12 +3010,8 @@ func ValidatePodSpec(spec *core.PodSpec, fldPath *field.Path) field.ErrorList {
}
}
if
len
(
spec
.
RuntimeClassName
)
>
0
{
if
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
RuntimeClass
)
{
for
_
,
msg
:=
range
ValidateRuntimeClassName
(
spec
.
RuntimeClassName
,
false
)
{
allErrs
=
append
(
allErrs
,
field
.
Invalid
(
fldPath
.
Child
(
"runtimeClassName"
),
spec
.
RuntimeClassName
,
msg
))
}
}
if
spec
.
RuntimeClassName
!=
nil
&&
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
RuntimeClass
)
{
allErrs
=
append
(
allErrs
,
ValidateRuntimeClassName
(
*
spec
.
RuntimeClassName
,
fldPath
.
Child
(
"runtimeClassName"
))
...
)
}
return
allErrs
...
...
pkg/apis/core/validation/validation_test.go
View file @
4b8050e3
...
...
@@ -6171,7 +6171,7 @@ func TestValidatePodSpec(t *testing.T) {
Containers
:
[]
core
.
Container
{{
Name
:
"ctr"
,
Image
:
"image"
,
ImagePullPolicy
:
"IfNotPresent"
,
TerminationMessagePolicy
:
"File"
}},
RestartPolicy
:
core
.
RestartPolicyAlways
,
DNSPolicy
:
core
.
DNSClusterFirst
,
RuntimeClassName
:
"valid-sandbox"
,
RuntimeClassName
:
utilpointer
.
StringPtr
(
"valid-sandbox"
)
,
},
}
for
i
:=
range
successCases
{
...
...
@@ -6358,7 +6358,7 @@ func TestValidatePodSpec(t *testing.T) {
Containers
:
[]
core
.
Container
{{
Name
:
"ctr"
,
Image
:
"image"
,
ImagePullPolicy
:
"IfNotPresent"
,
TerminationMessagePolicy
:
"File"
}},
RestartPolicy
:
core
.
RestartPolicyAlways
,
DNSPolicy
:
core
.
DNSClusterFirst
,
RuntimeClassName
:
"invalid/sandbox"
,
RuntimeClassName
:
utilpointer
.
StringPtr
(
"invalid/sandbox"
)
,
},
}
for
k
,
v
:=
range
failureCases
{
...
...
staging/src/k8s.io/api/core/v1/types.go
View file @
4b8050e3
...
...
@@ -2865,12 +2865,14 @@ type PodSpec struct {
// More info: https://github.com/kubernetes/community/blob/master/keps/sig-network/0007-pod-ready%2B%2B.md
// +optional
ReadinessGates
[]
PodReadinessGate
`json:"readinessGates,omitempty" protobuf:"bytes,28,opt,name=readinessGates"`
// RuntimeClassName refers to a RuntimeClass object with the same name, which should be used to
// run this pod. If no RuntimeClass resource matches the named class, the pod will not be run.
// RuntimeClassName refers to a RuntimeClass object in the node.k8s.io group, which should be used
// to run this pod. If no RuntimeClass resource matches the named class, the pod will not be run.
// If unset or empty, the "legacy" RuntimeClass will be used, which is an implicit class with an
// empty definition that uses the default runtime handler.
// More info: https://github.com/kubernetes/community/blob/master/keps/sig-node/0014-runtime-class.md
// This is an alpha feature and may change in the future.
// +optional
RuntimeClassName
string
`json:"runtimeClassName,omitempty" protobuf:"bytes,29,opt,name=runtimeClassName"`
RuntimeClassName
*
string
`json:"runtimeClassName,omitempty" protobuf:"bytes,29,opt,name=runtimeClassName"`
}
// HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the
...
...
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