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
832bc37e
Commit
832bc37e
authored
Feb 24, 2016
by
Brian Grant
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #21713 from janetkuo/deployment-actual-replicas
Report actual replicas in deployment status
parents
b5c6341e
39014232
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
deployment_controller.go
pkg/controller/deployment/deployment_controller.go
+2
-2
deployment.go
pkg/util/deployment/deployment.go
+9
-0
No files found.
pkg/controller/deployment/deployment_controller.go
View file @
832bc37e
...
@@ -1048,8 +1048,8 @@ func (dc *DeploymentController) updateDeploymentStatus(allRSs []*extensions.Repl
...
@@ -1048,8 +1048,8 @@ func (dc *DeploymentController) updateDeploymentStatus(allRSs []*extensions.Repl
}
}
func
(
dc
*
DeploymentController
)
calculateStatus
(
allRSs
[]
*
extensions
.
ReplicaSet
,
newRS
*
extensions
.
ReplicaSet
,
deployment
extensions
.
Deployment
)
(
totalReplicas
,
updatedReplicas
,
availableReplicas
,
unavailableReplicas
int
,
err
error
)
{
func
(
dc
*
DeploymentController
)
calculateStatus
(
allRSs
[]
*
extensions
.
ReplicaSet
,
newRS
*
extensions
.
ReplicaSet
,
deployment
extensions
.
Deployment
)
(
totalReplicas
,
updatedReplicas
,
availableReplicas
,
unavailableReplicas
int
,
err
error
)
{
totalReplicas
=
deploymentutil
.
GetReplicaCountForReplicaSets
(
allRSs
)
totalReplicas
=
deploymentutil
.
Get
Actual
ReplicaCountForReplicaSets
(
allRSs
)
updatedReplicas
=
deploymentutil
.
GetReplicaCountForReplicaSets
([]
*
extensions
.
ReplicaSet
{
newRS
})
updatedReplicas
=
deploymentutil
.
Get
Actual
ReplicaCountForReplicaSets
([]
*
extensions
.
ReplicaSet
{
newRS
})
minReadySeconds
:=
deployment
.
Spec
.
MinReadySeconds
minReadySeconds
:=
deployment
.
Spec
.
MinReadySeconds
availableReplicas
,
err
=
deploymentutil
.
GetAvailablePodsForReplicaSets
(
dc
.
client
,
allRSs
,
minReadySeconds
)
availableReplicas
,
err
=
deploymentutil
.
GetAvailablePodsForReplicaSets
(
dc
.
client
,
allRSs
,
minReadySeconds
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
pkg/util/deployment/deployment.go
View file @
832bc37e
...
@@ -330,6 +330,15 @@ func GetReplicaCountForReplicaSets(replicaSets []*extensions.ReplicaSet) int {
...
@@ -330,6 +330,15 @@ func GetReplicaCountForReplicaSets(replicaSets []*extensions.ReplicaSet) int {
return
totalReplicaCount
return
totalReplicaCount
}
}
// GetActualReplicaCountForReplicaSets returns the sum of actual replicas of the given replica sets.
func
GetActualReplicaCountForReplicaSets
(
replicaSets
[]
*
extensions
.
ReplicaSet
)
int
{
totalReplicaCount
:=
0
for
_
,
rs
:=
range
replicaSets
{
totalReplicaCount
+=
rs
.
Status
.
Replicas
}
return
totalReplicaCount
}
// Returns the number of available pods corresponding to the given replica sets.
// Returns the number of available pods corresponding to the given replica sets.
func
GetAvailablePodsForReplicaSets
(
c
clientset
.
Interface
,
rss
[]
*
extensions
.
ReplicaSet
,
minReadySeconds
int
)
(
int
,
error
)
{
func
GetAvailablePodsForReplicaSets
(
c
clientset
.
Interface
,
rss
[]
*
extensions
.
ReplicaSet
,
minReadySeconds
int
)
(
int
,
error
)
{
allPods
,
err
:=
GetPodsForReplicaSets
(
c
,
rss
)
allPods
,
err
:=
GetPodsForReplicaSets
(
c
,
rss
)
...
...
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