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
562bc03c
Commit
562bc03c
authored
Feb 22, 2019
by
Minhan Xia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
promote PodReadinessGate feature to GA
parent
472b8a9a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
114 deletions
+3
-114
util.go
pkg/api/pod/util.go
+0
-15
util_test.go
pkg/api/pod/util_test.go
+0
-96
kube_features.go
pkg/features/kube_features.go
+3
-3
No files found.
pkg/api/pod/util.go
View file @
562bc03c
...
@@ -318,10 +318,6 @@ func dropDisabledFields(
...
@@ -318,10 +318,6 @@ func dropDisabledFields(
podSpec
.
PriorityClassName
=
""
podSpec
.
PriorityClassName
=
""
}
}
if
!
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
PodReadinessGates
)
&&
!
podReadinessGatesInUse
(
oldPodSpec
)
{
podSpec
.
ReadinessGates
=
nil
}
if
!
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
Sysctls
)
&&
!
sysctlsInUse
(
oldPodSpec
)
{
if
!
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
Sysctls
)
&&
!
sysctlsInUse
(
oldPodSpec
)
{
if
podSpec
.
SecurityContext
!=
nil
{
if
podSpec
.
SecurityContext
!=
nil
{
podSpec
.
SecurityContext
.
Sysctls
=
nil
podSpec
.
SecurityContext
.
Sysctls
=
nil
...
@@ -534,17 +530,6 @@ func podPriorityInUse(podSpec *api.PodSpec) bool {
...
@@ -534,17 +530,6 @@ func podPriorityInUse(podSpec *api.PodSpec) bool {
return
false
return
false
}
}
// podReadinessGatesInUse returns true if the pod spec is non-nil and has ReadinessGates
func
podReadinessGatesInUse
(
podSpec
*
api
.
PodSpec
)
bool
{
if
podSpec
==
nil
{
return
false
}
if
podSpec
.
ReadinessGates
!=
nil
{
return
true
}
return
false
}
func
sysctlsInUse
(
podSpec
*
api
.
PodSpec
)
bool
{
func
sysctlsInUse
(
podSpec
*
api
.
PodSpec
)
bool
{
if
podSpec
==
nil
{
if
podSpec
==
nil
{
return
false
return
false
...
...
pkg/api/pod/util_test.go
View file @
562bc03c
...
@@ -1101,102 +1101,6 @@ func TestDropAppArmor(t *testing.T) {
...
@@ -1101,102 +1101,6 @@ func TestDropAppArmor(t *testing.T) {
}
}
}
}
func
TestDropReadinessGates
(
t
*
testing
.
T
)
{
podWithoutReadinessGates
:=
func
()
*
api
.
Pod
{
return
&
api
.
Pod
{
Spec
:
api
.
PodSpec
{
ReadinessGates
:
nil
,
},
}
}
podWithReadinessGates
:=
func
()
*
api
.
Pod
{
return
&
api
.
Pod
{
Spec
:
api
.
PodSpec
{
ReadinessGates
:
[]
api
.
PodReadinessGate
{
{
ConditionType
:
api
.
PodConditionType
(
"example.com/condition1"
),
},
{
ConditionType
:
api
.
PodConditionType
(
"example.com/condition2"
),
},
},
},
}
}
podInfo
:=
[]
struct
{
description
string
hasPodReadinessGates
bool
pod
func
()
*
api
.
Pod
}{
{
description
:
"has ReadinessGates"
,
hasPodReadinessGates
:
true
,
pod
:
podWithReadinessGates
,
},
{
description
:
"does not have ReadinessGates"
,
hasPodReadinessGates
:
false
,
pod
:
podWithoutReadinessGates
,
},
{
description
:
"is nil"
,
hasPodReadinessGates
:
false
,
pod
:
func
()
*
api
.
Pod
{
return
nil
},
},
}
for
_
,
enabled
:=
range
[]
bool
{
true
,
false
}
{
for
_
,
oldPodInfo
:=
range
podInfo
{
for
_
,
newPodInfo
:=
range
podInfo
{
oldPodHasReadinessGates
,
oldPod
:=
oldPodInfo
.
hasPodReadinessGates
,
oldPodInfo
.
pod
()
newPodHasReadinessGates
,
newPod
:=
newPodInfo
.
hasPodReadinessGates
,
newPodInfo
.
pod
()
if
newPod
==
nil
{
continue
}
t
.
Run
(
fmt
.
Sprintf
(
"featue enabled=%v, old pod %v, new pod %v"
,
enabled
,
oldPodInfo
.
description
,
newPodInfo
.
description
),
func
(
t
*
testing
.
T
)
{
defer
utilfeaturetesting
.
SetFeatureGateDuringTest
(
t
,
utilfeature
.
DefaultFeatureGate
,
features
.
PodReadinessGates
,
enabled
)()
var
oldPodSpec
*
api
.
PodSpec
if
oldPod
!=
nil
{
oldPodSpec
=
&
oldPod
.
Spec
}
dropDisabledFields
(
&
newPod
.
Spec
,
nil
,
oldPodSpec
,
nil
)
// old pod should never be changed
if
!
reflect
.
DeepEqual
(
oldPod
,
oldPodInfo
.
pod
())
{
t
.
Errorf
(
"old pod changed: %v"
,
diff
.
ObjectReflectDiff
(
oldPod
,
oldPodInfo
.
pod
()))
}
switch
{
case
enabled
||
oldPodHasReadinessGates
:
// new pod should not be changed if the feature is enabled, or if the old pod had ReadinessGates
if
!
reflect
.
DeepEqual
(
newPod
,
newPodInfo
.
pod
())
{
t
.
Errorf
(
"new pod changed: %v"
,
diff
.
ObjectReflectDiff
(
newPod
,
newPodInfo
.
pod
()))
}
case
newPodHasReadinessGates
:
// new pod should be changed
if
reflect
.
DeepEqual
(
newPod
,
newPodInfo
.
pod
())
{
t
.
Errorf
(
"new pod was not changed"
)
}
// new pod should not have ReadinessGates
if
!
reflect
.
DeepEqual
(
newPod
,
podWithoutReadinessGates
())
{
t
.
Errorf
(
"new pod had ReadinessGates: %v"
,
diff
.
ObjectReflectDiff
(
newPod
,
podWithoutReadinessGates
()))
}
default
:
// new pod should not need to be changed
if
!
reflect
.
DeepEqual
(
newPod
,
newPodInfo
.
pod
())
{
t
.
Errorf
(
"new pod changed: %v"
,
diff
.
ObjectReflectDiff
(
newPod
,
newPodInfo
.
pod
()))
}
}
})
}
}
}
}
func
TestDropTokenRequestProjection
(
t
*
testing
.
T
)
{
func
TestDropTokenRequestProjection
(
t
*
testing
.
T
)
{
podWithoutTRProjection
:=
func
()
*
api
.
Pod
{
podWithoutTRProjection
:=
func
()
*
api
.
Pod
{
return
&
api
.
Pod
{
return
&
api
.
Pod
{
...
...
pkg/features/kube_features.go
View file @
562bc03c
...
@@ -313,9 +313,9 @@ const (
...
@@ -313,9 +313,9 @@ const (
BalanceAttachedNodeVolumes
utilfeature
.
Feature
=
"BalanceAttachedNodeVolumes"
BalanceAttachedNodeVolumes
utilfeature
.
Feature
=
"BalanceAttachedNodeVolumes"
// owner @freehan
// owner @freehan
//
beta: v1.11
//
GA: v1.14
//
//
//
Support Pod Ready++
//
Allow user to specify additional conditions to be evaluated for Pod readiness.
PodReadinessGates
utilfeature
.
Feature
=
"PodReadinessGates"
PodReadinessGates
utilfeature
.
Feature
=
"PodReadinessGates"
// owner: @kevtaylor
// owner: @kevtaylor
...
@@ -470,7 +470,7 @@ var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureS
...
@@ -470,7 +470,7 @@ var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureS
RunAsGroup
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
RunAsGroup
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
VolumeSubpath
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
GA
},
VolumeSubpath
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
GA
},
BalanceAttachedNodeVolumes
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
BalanceAttachedNodeVolumes
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
PodReadinessGates
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
Beta
},
PodReadinessGates
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
GA
,
LockToDefault
:
true
},
// remove in 1.16
VolumeSubpathEnvExpansion
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
VolumeSubpathEnvExpansion
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
KubeletPluginsWatcher
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
GA
},
KubeletPluginsWatcher
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
GA
},
ResourceQuotaScopeSelectors
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
Beta
},
ResourceQuotaScopeSelectors
:
{
Default
:
true
,
PreRelease
:
utilfeature
.
Beta
},
...
...
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