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
aa9e1398
Commit
aa9e1398
authored
Feb 23, 2016
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #21726 from janetkuo/log-on-timeout
Auto commit by PR queue bot
parents
9470a7e6
4369a219
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
15 deletions
+22
-15
deployment.go
test/e2e/deployment.go
+1
-5
util.go
test/e2e/util.go
+21
-10
No files found.
test/e2e/deployment.go
View file @
aa9e1398
...
...
@@ -380,11 +380,7 @@ func testRecreateDeployment(f *Framework) {
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
defer
stopDeployment
(
c
,
f
.
Client
,
ns
,
deploymentName
)
err
=
waitForDeploymentStatus
(
c
,
ns
,
deploymentName
,
replicas
,
0
,
replicas
,
0
)
if
err
!=
nil
{
deployment
,
_
:=
c
.
Extensions
()
.
Deployments
(
ns
)
.
Get
(
deploymentName
)
Logf
(
"deployment = %+v"
,
deployment
)
}
waitForDeploymentStatus
(
c
,
ns
,
deploymentName
,
replicas
,
0
,
replicas
,
0
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
// Verify that the pods were scaled up and down as expected. We use events to verify that.
...
...
test/e2e/util.go
View file @
aa9e1398
...
...
@@ -2098,17 +2098,21 @@ func waitForReplicaSetPodsGone(c *client.Client, rs *extensions.ReplicaSet) erro
// Waits for the deployment to reach desired state.
// Returns an error if minAvailable or maxCreated is broken at any times.
func
waitForDeploymentStatus
(
c
clientset
.
Interface
,
ns
,
deploymentName
string
,
desiredUpdatedReplicas
,
minAvailable
,
maxCreated
,
minReadySeconds
int
)
error
{
return
wait
.
Poll
(
poll
,
5
*
time
.
Minute
,
func
()
(
bool
,
error
)
{
var
oldRSs
,
allRSs
[]
*
extensions
.
ReplicaSet
var
newRS
*
extensions
.
ReplicaSet
var
deployment
*
extensions
.
Deployment
err
:=
wait
.
Poll
(
poll
,
5
*
time
.
Minute
,
func
()
(
bool
,
error
)
{
deployment
,
err
:=
c
.
Extensions
()
.
Deployments
(
ns
)
.
Get
(
deploymentName
)
var
err
error
deployment
,
err
=
c
.
Extensions
()
.
Deployments
(
ns
)
.
Get
(
deploymentName
)
if
err
!=
nil
{
return
false
,
err
}
oldRSs
,
_
,
err
:
=
deploymentutil
.
GetOldReplicaSets
(
*
deployment
,
c
)
oldRSs
,
_
,
err
=
deploymentutil
.
GetOldReplicaSets
(
*
deployment
,
c
)
if
err
!=
nil
{
return
false
,
err
}
newRS
,
err
:
=
deploymentutil
.
GetNewReplicaSet
(
*
deployment
,
c
)
newRS
,
err
=
deploymentutil
.
GetNewReplicaSet
(
*
deployment
,
c
)
if
err
!=
nil
{
return
false
,
err
}
...
...
@@ -2116,19 +2120,19 @@ func waitForDeploymentStatus(c clientset.Interface, ns, deploymentName string, d
// New RC hasn't been created yet.
return
false
,
nil
}
allRSs
:
=
append
(
oldRSs
,
newRS
)
allRSs
=
append
(
oldRSs
,
newRS
)
totalCreated
:=
deploymentutil
.
GetReplicaCountForReplicaSets
(
allRSs
)
totalAvailable
,
err
:=
deploymentutil
.
GetAvailablePodsForReplicaSets
(
c
,
allRSs
,
minReadySeconds
)
if
err
!=
nil
{
return
false
,
err
}
if
totalCreated
>
maxCreated
{
logReplicaSetsOfDeployment
(
deployment
Name
,
oldRSs
,
newRS
)
logReplicaSetsOfDeployment
(
deployment
,
oldRSs
,
newRS
)
logPodsOfReplicaSets
(
c
,
allRSs
,
minReadySeconds
)
return
false
,
fmt
.
Errorf
(
"total pods created: %d, more than the max allowed: %d"
,
totalCreated
,
maxCreated
)
}
if
totalAvailable
<
minAvailable
{
logReplicaSetsOfDeployment
(
deployment
Name
,
oldRSs
,
newRS
)
logReplicaSetsOfDeployment
(
deployment
,
oldRSs
,
newRS
)
logPodsOfReplicaSets
(
c
,
allRSs
,
minReadySeconds
)
return
false
,
fmt
.
Errorf
(
"total pods available: %d, less than the min required: %d"
,
totalAvailable
,
minAvailable
)
}
...
...
@@ -2142,6 +2146,12 @@ func waitForDeploymentStatus(c clientset.Interface, ns, deploymentName string, d
}
return
false
,
nil
})
if
err
==
wait
.
ErrWaitTimeout
{
logReplicaSetsOfDeployment
(
deployment
,
oldRSs
,
newRS
)
logPodsOfReplicaSets
(
c
,
allRSs
,
minReadySeconds
)
}
return
err
}
func
waitForPodsReady
(
c
*
clientset
.
Clientset
,
ns
,
name
string
,
minReadySeconds
int
)
error
{
...
...
@@ -2176,11 +2186,12 @@ func waitForDeploymentOldRSsNum(c *clientset.Clientset, ns, deploymentName strin
})
}
func
logReplicaSetsOfDeployment
(
deploymentName
string
,
oldRSs
[]
*
extensions
.
ReplicaSet
,
newRS
*
extensions
.
ReplicaSet
)
{
func
logReplicaSetsOfDeployment
(
deployment
*
extensions
.
Deployment
,
oldRSs
[]
*
extensions
.
ReplicaSet
,
newRS
*
extensions
.
ReplicaSet
)
{
Logf
(
"Deployment = %+v"
,
deployment
)
for
i
:=
range
oldRSs
{
Logf
(
"Old ReplicaSets (%d/%d) of deployment %s: %+v"
,
i
+
1
,
len
(
oldRSs
),
deploymentName
,
oldRSs
[
i
])
Logf
(
"Old ReplicaSets (%d/%d) of deployment %s: %+v"
,
i
+
1
,
len
(
oldRSs
),
deployment
.
Name
,
oldRSs
[
i
])
}
Logf
(
"New ReplicaSet of deployment %s: %+v"
,
deploymentName
,
newRS
)
Logf
(
"New ReplicaSet of deployment %s: %+v"
,
deployment
.
Name
,
newRS
)
}
func
logPodsOfReplicaSets
(
c
clientset
.
Interface
,
rss
[]
*
extensions
.
ReplicaSet
,
minReadySeconds
int
)
{
...
...
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