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
f666e872
Commit
f666e872
authored
Mar 04, 2016
by
Janet Kuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Filter out inactive pods first when determining if it's available
parent
a75c0a3c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
controller_utils.go
pkg/controller/controller_utils.go
+7
-3
deployment.go
pkg/util/deployment/deployment.go
+4
-0
No files found.
pkg/controller/controller_utils.go
View file @
f666e872
...
...
@@ -490,9 +490,7 @@ func FilterActivePods(pods []api.Pod) []*api.Pod {
var
result
[]
*
api
.
Pod
for
i
:=
range
pods
{
p
:=
pods
[
i
]
if
api
.
PodSucceeded
!=
p
.
Status
.
Phase
&&
api
.
PodFailed
!=
p
.
Status
.
Phase
&&
p
.
DeletionTimestamp
==
nil
{
if
IsPodActive
(
p
)
{
result
=
append
(
result
,
&
p
)
}
else
{
glog
.
V
(
4
)
.
Infof
(
"Ignoring inactive pod %v/%v in state %v, deletion time %v"
,
...
...
@@ -502,6 +500,12 @@ func FilterActivePods(pods []api.Pod) []*api.Pod {
return
result
}
func
IsPodActive
(
p
api
.
Pod
)
bool
{
return
api
.
PodSucceeded
!=
p
.
Status
.
Phase
&&
api
.
PodFailed
!=
p
.
Status
.
Phase
&&
p
.
DeletionTimestamp
==
nil
}
// FilterActiveReplicaSets returns replica sets that have (or at least ought to have) pods.
func
FilterActiveReplicaSets
(
replicaSets
[]
*
extensions
.
ReplicaSet
)
[]
*
extensions
.
ReplicaSet
{
active
:=
[]
*
extensions
.
ReplicaSet
{}
...
...
pkg/util/deployment/deployment.go
View file @
f666e872
...
...
@@ -27,6 +27,7 @@ import (
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apis/extensions"
clientset
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/kubernetes/pkg/controller"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/util/integer"
intstrutil
"k8s.io/kubernetes/pkg/util/intstr"
...
...
@@ -346,6 +347,9 @@ func getReadyPodsCount(pods []api.Pod, minReadySeconds int) int {
}
func
IsPodAvailable
(
pod
*
api
.
Pod
,
minReadySeconds
int
)
bool
{
if
!
controller
.
IsPodActive
(
*
pod
)
{
return
false
}
// Check if we've passed minReadySeconds since LastTransitionTime
// If so, this pod is ready
for
_
,
c
:=
range
pod
.
Status
.
Conditions
{
...
...
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