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
7910dc31
Unverified
Commit
7910dc31
authored
May 20, 2017
by
Michail Kargakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Account newly ready replicas as progress
Signed-off-by:
Michail Kargakis
<
mkargaki@redhat.com
>
parent
a8bff0ed
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
26 deletions
+39
-26
deployment_util.go
pkg/controller/deployment/util/deployment_util.go
+3
-2
deployment_util_test.go
pkg/controller/deployment/util/deployment_util_test.go
+36
-24
No files found.
pkg/controller/deployment/util/deployment_util.go
View file @
7910dc31
...
@@ -841,8 +841,8 @@ func DeploymentComplete(deployment *extensions.Deployment, newStatus *extensions
...
@@ -841,8 +841,8 @@ func DeploymentComplete(deployment *extensions.Deployment, newStatus *extensions
// DeploymentProgressing reports progress for a deployment. Progress is estimated by comparing the
// DeploymentProgressing reports progress for a deployment. Progress is estimated by comparing the
// current with the new status of the deployment that the controller is observing. More specifically,
// current with the new status of the deployment that the controller is observing. More specifically,
// when new pods are scaled up or become
available, or old pods are scaled down, then we consider th
e
// when new pods are scaled up or become
ready or available, or old pods are scaled down, then w
e
// deployment is progressing.
//
consider the
deployment is progressing.
func
DeploymentProgressing
(
deployment
*
extensions
.
Deployment
,
newStatus
*
extensions
.
DeploymentStatus
)
bool
{
func
DeploymentProgressing
(
deployment
*
extensions
.
Deployment
,
newStatus
*
extensions
.
DeploymentStatus
)
bool
{
oldStatus
:=
deployment
.
Status
oldStatus
:=
deployment
.
Status
...
@@ -852,6 +852,7 @@ func DeploymentProgressing(deployment *extensions.Deployment, newStatus *extensi
...
@@ -852,6 +852,7 @@ func DeploymentProgressing(deployment *extensions.Deployment, newStatus *extensi
return
(
newStatus
.
UpdatedReplicas
>
oldStatus
.
UpdatedReplicas
)
||
return
(
newStatus
.
UpdatedReplicas
>
oldStatus
.
UpdatedReplicas
)
||
(
newStatusOldReplicas
<
oldStatusOldReplicas
)
||
(
newStatusOldReplicas
<
oldStatusOldReplicas
)
||
newStatus
.
ReadyReplicas
>
deployment
.
Status
.
ReadyReplicas
||
newStatus
.
AvailableReplicas
>
deployment
.
Status
.
AvailableReplicas
newStatus
.
AvailableReplicas
>
deployment
.
Status
.
AvailableReplicas
}
}
...
...
pkg/controller/deployment/util/deployment_util_test.go
View file @
7910dc31
...
@@ -1002,18 +1002,22 @@ func TestDeploymentComplete(t *testing.T) {
...
@@ -1002,18 +1002,22 @@ func TestDeploymentComplete(t *testing.T) {
}
}
func
TestDeploymentProgressing
(
t
*
testing
.
T
)
{
func
TestDeploymentProgressing
(
t
*
testing
.
T
)
{
deployment
:=
func
(
current
,
updated
int32
)
*
extensions
.
Deployment
{
deployment
:=
func
(
current
,
updated
,
ready
,
available
int32
)
*
extensions
.
Deployment
{
return
&
extensions
.
Deployment
{
return
&
extensions
.
Deployment
{
Status
:
extensions
.
DeploymentStatus
{
Status
:
extensions
.
DeploymentStatus
{
Replicas
:
current
,
Replicas
:
current
,
UpdatedReplicas
:
updated
,
UpdatedReplicas
:
updated
,
ReadyReplicas
:
ready
,
AvailableReplicas
:
available
,
},
},
}
}
}
}
newStatus
:=
func
(
current
,
updated
int32
)
extensions
.
DeploymentStatus
{
newStatus
:=
func
(
current
,
updated
,
ready
,
available
int32
)
extensions
.
DeploymentStatus
{
return
extensions
.
DeploymentStatus
{
return
extensions
.
DeploymentStatus
{
Replicas
:
current
,
Replicas
:
current
,
UpdatedReplicas
:
updated
,
UpdatedReplicas
:
updated
,
ReadyReplicas
:
ready
,
AvailableReplicas
:
available
,
}
}
}
}
...
@@ -1026,52 +1030,60 @@ func TestDeploymentProgressing(t *testing.T) {
...
@@ -1026,52 +1030,60 @@ func TestDeploymentProgressing(t *testing.T) {
expected
bool
expected
bool
}{
}{
{
{
name
:
"progressing"
,
name
:
"progressing
: updated pods
"
,
d
:
deployment
(
10
,
4
),
d
:
deployment
(
10
,
4
,
4
,
4
),
newStatus
:
newStatus
(
10
,
6
),
newStatus
:
newStatus
(
10
,
6
,
4
,
4
),
expected
:
true
,
expected
:
true
,
},
},
{
{
name
:
"not progressing"
,
name
:
"not progressing"
,
d
:
deployment
(
10
,
4
),
d
:
deployment
(
10
,
4
,
4
,
4
),
newStatus
:
newStatus
(
10
,
4
),
newStatus
:
newStatus
(
10
,
4
,
4
,
4
),
expected
:
false
,
expected
:
false
,
},
},
{
{
name
:
"progressing
#2
"
,
name
:
"progressing
: old pods removed
"
,
d
:
deployment
(
10
,
4
),
d
:
deployment
(
10
,
4
,
6
,
6
),
newStatus
:
newStatus
(
8
,
4
),
newStatus
:
newStatus
(
8
,
4
,
6
,
6
),
expected
:
true
,
expected
:
true
,
},
},
{
{
name
:
"not progressing
#2
"
,
name
:
"not progressing
: less new pods
"
,
d
:
deployment
(
10
,
7
),
d
:
deployment
(
10
,
7
,
3
,
3
),
newStatus
:
newStatus
(
10
,
6
),
newStatus
:
newStatus
(
10
,
6
,
3
,
3
),
expected
:
false
,
expected
:
false
,
},
},
{
{
name
:
"progressing
#3
"
,
name
:
"progressing
: less overall but more new pods
"
,
d
:
deployment
(
10
,
4
),
d
:
deployment
(
10
,
4
,
7
,
7
),
newStatus
:
newStatus
(
8
,
8
),
newStatus
:
newStatus
(
8
,
8
,
5
,
5
),
expected
:
true
,
expected
:
true
,
},
},
{
{
name
:
"
not progressing #2
"
,
name
:
"
progressing: more ready pods
"
,
d
:
deployment
(
10
,
7
),
d
:
deployment
(
10
,
10
,
9
,
8
),
newStatus
:
newStatus
(
10
,
7
),
newStatus
:
newStatus
(
10
,
10
,
10
,
8
),
expected
:
false
,
expected
:
true
,
},
{
name
:
"progressing: more available pods"
,
d
:
deployment
(
10
,
10
,
10
,
9
),
newStatus
:
newStatus
(
10
,
10
,
10
,
10
),
expected
:
true
,
},
},
}
}
...
...
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