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
bf1a695b
Commit
bf1a695b
authored
Dec 15, 2014
by
Brendan Burns
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2882 from bgrant0607/bugfix1
Count only non-dead pods in replicationController current state replicas count
parents
2d1b2793
9b539262
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
replication_controller.go
pkg/controller/replication_controller.go
+3
-2
rest.go
pkg/registry/controller/rest.go
+3
-1
No files found.
pkg/controller/replication_controller.go
View file @
bf1a695b
...
...
@@ -140,7 +140,8 @@ func (rm *ReplicationManager) watchControllers(resourceVersion *string) {
}
}
func
(
rm
*
ReplicationManager
)
filterActivePods
(
pods
[]
api
.
Pod
)
[]
api
.
Pod
{
// Helper function. Also used in pkg/registry/controller, for now.
func
FilterActivePods
(
pods
[]
api
.
Pod
)
[]
api
.
Pod
{
var
result
[]
api
.
Pod
for
_
,
value
:=
range
pods
{
if
api
.
PodSucceeded
!=
value
.
Status
.
Phase
&&
...
...
@@ -157,7 +158,7 @@ func (rm *ReplicationManager) syncReplicationController(controller api.Replicati
if
err
!=
nil
{
return
err
}
filteredList
:=
rm
.
f
ilterActivePods
(
podList
.
Items
)
filteredList
:=
F
ilterActivePods
(
podList
.
Items
)
diff
:=
len
(
filteredList
)
-
controller
.
Spec
.
Replicas
if
diff
<
0
{
diff
*=
-
1
...
...
pkg/registry/controller/rest.go
View file @
bf1a695b
...
...
@@ -24,6 +24,7 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/validation"
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver"
rc
"github.com/GoogleCloudPlatform/kubernetes/pkg/controller"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
...
...
@@ -149,6 +150,7 @@ func (rs *REST) Watch(ctx api.Context, label, field labels.Selector, resourceVer
return
rs
.
registry
.
WatchControllers
(
ctx
,
label
,
field
,
resourceVersion
)
}
// TODO #2726: The controller should populate the current state, not the apiserver
func
(
rs
*
REST
)
fillCurrentState
(
ctx
api
.
Context
,
controller
*
api
.
ReplicationController
)
error
{
if
rs
.
podLister
==
nil
{
return
nil
...
...
@@ -157,6 +159,6 @@ func (rs *REST) fillCurrentState(ctx api.Context, controller *api.ReplicationCon
if
err
!=
nil
{
return
err
}
controller
.
Status
.
Replicas
=
len
(
list
.
Items
)
controller
.
Status
.
Replicas
=
len
(
rc
.
FilterActivePods
(
list
.
Items
)
)
return
nil
}
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